get borders from drawables' cache

This commit is contained in:
gazer 2017-10-12 21:42:34 +03:00
parent 8a5152c5c2
commit 0f0bbe4f53
1 changed files with 2 additions and 9 deletions

View File

@ -1134,21 +1134,14 @@ class StateDrawable : Drawable {
class CombinedDrawable : Drawable {
DrawableRef background;
Drawable border;
DrawableRef border;
this(uint backgroundColor, string backgroundImageId, string borderDescription) {
background =
(backgroundImageId !is null) ? drawableCache.get(backgroundImageId) :
(!backgroundColor.isFullyTransparentColor) ? new SolidFillDrawable(backgroundColor) :
new EmptyDrawable;
border = borderDescription !is null ? createColorDrawable(borderDescription) : new EmptyDrawable;
}
~this() {
destroy(background);
destroy(border);
background = null;
border = null;
border = borderDescription !is null ? drawableCache.get(borderDescription) : new EmptyDrawable;
}
override void drawTo(DrawBuf buf, Rect rc, uint state = 0, int tilex0 = 0, int tiley0 = 0) {