Rollback to stable code from tizen_2.1 branch
authorYoungki Ahn <ykahn@samsung.com>
Mon, 20 May 2013 08:09:26 +0000 (17:09 +0900)
committerYoungki Ahn <ykahn@samsung.com>
Mon, 20 May 2013 11:50:22 +0000 (20:50 +0900)
Change-Id: I577849499149ce7398b333c27944f63e0d497914
Signed-off-by: Youngki Ahn <ykahn@samsung.com>
src/graphics/FGrp_CanvasPixman.cpp [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index b1fa3ba..da5a8b1
@@ -310,7 +310,7 @@ bool CompositePixmap(Tizen::Graphics::_Util::Pixmap& dstImage, const Tizen::Grap
        return false;
 }
 
-bool CompositePixmap(Tizen::Graphics::_Util::Pixmap& dstImage, const Tizen::Graphics::_Util::Pixmap& srcImage, int rop, pixman_filter_t filter, pixman_transform_t transform, pixman_repeat_t repeatMethod, pixman_region32_t resultRect)
+bool __CompositePixmap(Tizen::Graphics::_Util::Pixmap& dstImage, const Tizen::Graphics::_Util::Pixmap& srcImage, int rop, pixman_filter_t filter, pixman_transform_t transform, pixman_repeat_t repeatMethod, pixman_region32_t resultRect)
 {
        Tizen::Graphics::_Util::AutoDeletor<pixman_image_t> pPixmanDst;
 
@@ -437,33 +437,33 @@ bool CopyPixmap(Tizen::Graphics::_Util::Pixmap& dstImage, const Tizen::Graphics:
 
        pixman_filter_t filter = Tizen::Graphics::_Pixman::GetFilter(drawingQuality);
 
-       pixman_transform_t transform;
-       pixman_transform_init_identity(&transform);
-       pixman_transform_translate(&transform, NULL, pixman_double_to_fixed(-(xDest-0.5)), pixman_double_to_fixed(-(yDest-0.5)));
-
-       return CompositePixmap(dstImage, srcImage, rop, filter, transform, PIXMAN_REPEAT_NONE);
-}
-
-bool CopyPixmap(Tizen::Graphics::_Util::Pixmap& dstImage, const Tizen::Graphics::_Util::Pixmap& srcImage, Tizen::Graphics::BitmapDrawingQuality drawingQuality, Tizen::Graphics::CompositeMode compositeMode, double xDest, double yDest, int wDest, int hDest)
-{
-       if (dstImage.width <= 0 || dstImage.height <= 0)
+       switch (rop)
        {
-               return true;
-       }
-
-       pixman_op_t rop = Tizen::Graphics::_Pixman::GetRop(compositeMode);
-
-       pixman_filter_t filter = Tizen::Graphics::_Pixman::GetFilter(drawingQuality);
-
-       pixman_transform_t transform;
-       pixman_transform_init_identity(&transform);
-
-       pixman_region32_t clipRect, dstRect;
-       pixman_region32_init_rect (&clipRect, xDest, yDest, wDest, hDest);
-       pixman_region32_init_rect (&dstRect, 0, 0, dstImage.width, dstImage.height);
-       pixman_region32_intersect (&dstRect, &clipRect, &dstRect);
+       case PIXMAN_OP_CLEAR:
+       case PIXMAN_OP_SRC:
+               {
+                       int dstX1 = int(floor(xDest));
+                       int dstX2 = int(ceil(xDest + srcImage.width));
+                       int dstY1 = int(floor(yDest));
+                       int dstY2 = int(ceil(yDest + srcImage.height));
+
+                       Tizen::Graphics::_Util::Pixmap dstImageSub = dstImage.GetSubBitmap(dstX1, dstY1, dstX2 - dstX1, dstY2 - dstY1);
+                       Tizen::Graphics::_Util::Pixmap srcImageSub = srcImage.GetSubBitmap((dstX1 >= 0) ? 0 : -dstX1, (dstY1 >= 0) ? 0 : -dstY1, srcImage.width, srcImage.height);
+
+                       pixman_transform_t transform;
+                       pixman_transform_init_identity(&transform);
+                       pixman_transform_translate(&transform, NULL, pixman_double_to_fixed(dstX1 -(xDest - 0.5)), pixman_double_to_fixed(dstY1 -(yDest - 0.5)));
+                       return CompositePixmap(dstImageSub, srcImageSub, rop, filter, transform, PIXMAN_REPEAT_NONE);
+               }
+       default:
+               {
+                       pixman_transform_t transform;
+                       pixman_transform_init_identity(&transform);
+                       pixman_transform_translate(&transform, NULL, pixman_double_to_fixed(-(xDest - 0.5)), pixman_double_to_fixed(-(yDest - 0.5)));
 
-       return CompositePixmap(dstImage, srcImage, rop, filter, transform, PIXMAN_REPEAT_NONE, dstRect);
+                       return CompositePixmap(dstImage, srcImage, rop, filter, transform, PIXMAN_REPEAT_NONE);
+               }
+       }
 }
 
 bool ScalePixmap(Tizen::Graphics::_Util::Pixmap& dstImage, const Tizen::Graphics::_Util::Pixmap& srcImage, Tizen::Graphics::BitmapDrawingQuality drawingQuality, Tizen::Graphics::CompositeMode compositeMode)
@@ -503,32 +503,30 @@ bool ScalePixmap(Tizen::Graphics::_Util::Pixmap& dstImage, const Tizen::Graphics
        pixman_op_t rop = Tizen::Graphics::_Pixman::GetRop(compositeMode);
        pixman_filter_t filter = Tizen::Graphics::_Pixman::GetFilter(drawingQuality);
 
-       pixman_transform_t transform = Tizen::Graphics::_Pixman::GetTransform(srcImage.width, srcImage.height, xDest-0.5, yDest-0.5, wDest, hDest);
-
-       pixman_region32_t dstRect;
-       pixman_region32_init_rect (&dstRect, 0, 0, dstImage.width, dstImage.height);
-
-       return CompositePixmap(dstImage, srcImage, rop, filter, transform, PIXMAN_REPEAT_NONE, dstRect);
-}
-
-bool ScalePixmap(Tizen::Graphics::_Util::Pixmap& dstImage, const Tizen::Graphics::_Util::Pixmap& srcImage, Tizen::Graphics::BitmapDrawingQuality drawingQuality, Tizen::Graphics::CompositeMode compositeMode, double xDest, double yDest, int wDest, int hDest)
-{
-       if (dstImage.width <= 0 || dstImage.height <= 0)
+       switch (rop)
        {
-               return true;
-       }
+       case PIXMAN_OP_CLEAR:
+       case PIXMAN_OP_SRC:
+               {
+                       int dstX1 = int(floor(xDest));
+                       int dstY1 = int(floor(yDest));
+                       int dstX2 = int(ceil(xDest + wDest));
+                       int dstY2 = int(ceil(yDest + hDest));
 
-       pixman_op_t rop = Tizen::Graphics::_Pixman::GetRop(compositeMode);
-       pixman_filter_t filter = Tizen::Graphics::_Pixman::GetFilter(drawingQuality);
+                       Tizen::Graphics::_Util::Pixmap dstImageSub = dstImage.GetSubBitmap(dstX1, dstY1, dstX2 - dstX1, dstY2 - dstY1);
+                       Tizen::Graphics::_Util::Pixmap srcImageSub = srcImage.GetSubBitmap((dstX1 >= 0) ? 0 : int(-dstX1 * srcImage.width / wDest), (dstY1 >= 0) ? 0 : int(-dstY1 * srcImage.height / hDest), srcImage.width, srcImage.height);
 
-       pixman_transform_t transform = Tizen::Graphics::_Pixman::GetTransform(srcImage.width, srcImage.height, dstImage.width, dstImage.height);
+                       pixman_transform_t transform = Tizen::Graphics::_Pixman::GetTransform(srcImage.width, srcImage.height, (xDest - 0.5) - dstX1, (yDest - 0.5) - dstY1, wDest, hDest);
 
-       pixman_region32_t clipRect, dstRect;
-       pixman_region32_init_rect (&clipRect, xDest, yDest, wDest, hDest);
-       pixman_region32_init_rect (&dstRect, 0, 0, dstImage.width, dstImage.height);
-       pixman_region32_intersect (&dstRect, &clipRect, &dstRect);
+                       return CompositePixmap(dstImageSub, srcImageSub, rop, filter, transform, PIXMAN_REPEAT_NONE);
+               }
+       default:
+               {
+                       pixman_transform_t transform = Tizen::Graphics::_Pixman::GetTransform(srcImage.width, srcImage.height, xDest - 0.5, yDest - 0.5, wDest, hDest);
 
-       return CompositePixmap(dstImage, srcImage, rop, filter, transform, PIXMAN_REPEAT_NONE, dstRect);
+                       return CompositePixmap(dstImage, srcImage, rop, filter, transform, PIXMAN_REPEAT_NONE);
+               }
+       }
 }
 
 bool RotatePixmap(Tizen::Graphics::_Util::Pixmap& dstImage, const Tizen::Graphics::_Util::Pixmap& srcImage, Tizen::Graphics::BitmapDrawingQuality drawingQuality, Tizen::Graphics::CompositeMode compositeMode, double xDest, double yDest, double degree, double xPivot, double yPivot)