From 19d8f0cd0ecf287419c76a44554fea714f11690e Mon Sep 17 00:00:00 2001 From: Youngki Ahn Date: Wed, 27 Mar 2013 10:26:39 +0900 Subject: [PATCH] Fixed nine-patched drawing error in case of whole black bitmap Change-Id: I3e1a3471a7d217208aa5f3f8c6f27d55faa329f9 Signed-off-by: Youngki Ahn --- src/graphics/util/FGrp_Util.cpp | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) mode change 100644 => 100755 src/graphics/util/FGrp_Util.cpp diff --git a/src/graphics/util/FGrp_Util.cpp b/src/graphics/util/FGrp_Util.cpp old mode 100644 new mode 100755 index 846c943..d5e2c42 --- a/src/graphics/util/FGrp_Util.cpp +++ b/src/graphics/util/FGrp_Util.cpp @@ -333,14 +333,25 @@ _FindWidthOfSubregions(const _Util::Pixmap& dstImage, int pRegionWidthes[], bool if (((*pProbe == KEY) && (*pProbeNext != KEY)) || ((*pProbe != KEY) && (*pProbeNext == KEY))) { - pWidthStretchable[index] = (*pProbe == KEY) ? true : false; + pWidthStretchable[index] = (*pProbe == KEY); index++; } pProbe++; pProbeNext++; } -// pRegionWidthes[index]++; + + // in case of whole black + if (index == 0) + { + Pixel* pProbe = (Pixel*) (dstImage.pBitmap) + 1; + Pixel* pProbeEnd = pProbe + dstImage.width - 2; + + if (pProbe < pProbeEnd) + { + pWidthStretchable[index] = (*pProbe == KEY); + } + } return (index + 1); } @@ -372,14 +383,25 @@ _FindHeightOfSubregions(const _Util::Pixmap& dstImage, int pRegionHeights[], boo if (((*pProbe == KEY) && (*pProbeNext != KEY)) || ((*pProbe != KEY) && (*pProbeNext == KEY))) { - pHeightStretchable[index] = (*pProbe == KEY) ? true : false; + pHeightStretchable[index] = (*pProbe == KEY); index++; } pProbe += pitch; pProbeNext += pitch; } -// pRegionHeights[index]++; + + // in case of whole black + if (index == 0) + { + Pixel* pProbe = (Pixel*) (dstImage.pBitmap) + pitch; + Pixel* pProbeEnd = pProbe + (dstImage.height - 2) * pitch; + + if (pProbe < pProbeEnd) + { + pHeightStretchable[index] = (*pProbe == KEY); + } + } return (index + 1); } -- 2.7.4