Fixed nine-patched drawing error in case of whole black bitmap
authorYoungki Ahn <ykahn@samsung.com>
Wed, 27 Mar 2013 01:26:39 +0000 (10:26 +0900)
committerGerrit Code Review <gerrit2@kim11>
Wed, 27 Mar 2013 10:32:30 +0000 (19:32 +0900)
Change-Id: I3e1a3471a7d217208aa5f3f8c6f27d55faa329f9
Signed-off-by: Youngki Ahn <ykahn@samsung.com>
src/graphics/util/FGrp_Util.cpp [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 846c943..d5e2c42
@@ -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);
 }