Modify DrawBitmap with rect For alphaConstant
authorhoonik.lee <hoonik.lee@samsung.com>
Tue, 9 Apr 2013 01:34:42 +0000 (10:34 +0900)
committerhoonik.lee <hoonik.lee@samsung.com>
Tue, 9 Apr 2013 01:34:42 +0000 (10:34 +0900)
Change-Id: I26c14d9f7e5fbd5d115e714a02052abafa857b72
Signed-off-by: hoonik.lee <hoonik.lee@samsung.com>
src/graphics/FGrp_Canvas.cpp

index 6c1777d..9838aff 100755 (executable)
@@ -1307,7 +1307,6 @@ _Canvas::DrawBitmap(const _Util::Rectangle<double>& rectD, const _Bitmap& bitmap
                _DoubleToIntForSize(rectD.h)
        };
 
-       if (alphaConstant >= 255)
        {
                bool pass = false;
 
@@ -1329,7 +1328,20 @@ _Canvas::DrawBitmap(const _Util::Rectangle<double>& rectD, const _Bitmap& bitmap
                                _Util::Pixmap dstImageUnclipped(dstBufferInfo.width, dstBufferInfo.height, dstBufferInfo.bitsPerPixel, dstBufferInfo.pPixels, dstBufferInfo.pitch);
                                _Util::Pixmap dstImage = dstImageUnclipped.GetSubBitmap(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
 
-                               pass = _Pixman::ScalePixmap(dstImage, srcImage, GetDrawingQuality(), GetCompositeMode(), rectD.x - clipRect.x, rectD.y - clipRect.y, rectD.w, rectD.h);
+                               if  (alphaConstant < 255)
+                               {
+                                       std::unique_ptr<_Util::Pixmap> modifiedSrcImage(srcImage.GetAlphaAttenuatedPixmap(alphaConstant));
+
+                                       if (modifiedSrcImage != null)
+                                       {
+                                               pass = _Pixman::ScalePixmap(dstImage, *modifiedSrcImage.get(), GetDrawingQuality(), GetCompositeMode(), rectD.x - clipRect.x, rectD.y - clipRect.y, rectD.w, rectD.h);
+                                       }
+                               }
+
+                               if (!pass)
+                               {
+                                       pass = _Pixman::ScalePixmap(dstImage, srcImage, GetDrawingQuality(), GetCompositeMode(), rectD.x - clipRect.x, rectD.y - clipRect.y, rectD.w, rectD.h);
+                               }
 
                        }
 
@@ -1346,11 +1358,12 @@ _Canvas::DrawBitmap(const _Util::Rectangle<double>& rectD, const _Bitmap& bitmap
 
                }
 
-               SysTryReturnResult(NID_GRP, pass, E_INVALID_ARG, "The source bitmap is invalid.\n");
-
-               return E_SUCCESS;
+               if(pass)
+               {
+                       return E_SUCCESS;
+               }
        }
-       else
+
        {
                _Util::Pixmap tmpImage(rect.w, rect.h, bitmap.GetBitsPerPixel());