From 0f0bbe4f5398f778c2e27d6519f842f05c1e64ef Mon Sep 17 00:00:00 2001 From: gazer Date: Thu, 12 Oct 2017 21:42:34 +0300 Subject: [PATCH] get borders from drawables' cache --- src/dlangui/graphics/resources.d | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/dlangui/graphics/resources.d b/src/dlangui/graphics/resources.d index 6ea86c86..046d00af 100644 --- a/src/dlangui/graphics/resources.d +++ b/src/dlangui/graphics/resources.d @@ -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) {