CombinedDrawable - work with solid fill background too

This commit is contained in:
gazer 2017-10-12 20:56:54 +03:00
parent e8f11036c9
commit 8a5152c5c2
2 changed files with 7 additions and 4 deletions

View File

@ -1136,8 +1136,11 @@ class CombinedDrawable : Drawable {
DrawableRef background;
Drawable border;
this(string backgroundImageId, string borderDescription) {
background = backgroundImageId !is null ? drawableCache.get(backgroundImageId) : new EmptyDrawable;
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;
}

View File

@ -412,12 +412,12 @@ public:
if (!(cast(Style)this)._backgroundDrawable.isNull)
return (cast(Style)this)._backgroundDrawable;
string image = backgroundImageId;
uint color = backgroundColor;
if (border !is null) {
(cast(Style)this)._backgroundDrawable = new CombinedDrawable(image, border);
(cast(Style)this)._backgroundDrawable = new CombinedDrawable(color, image, border);
} else if (image !is null) {
(cast(Style)this)._backgroundDrawable = drawableCache.get(image);
} else {
uint color = backgroundColor;
(cast(Style)this)._backgroundDrawable = isFullyTransparentColor(color) ? new EmptyDrawable() : new SolidFillDrawable(color);
}
return (cast(Style)this)._backgroundDrawable;