Revert "Modify DrawBitmap for floating-point decision problem"
authorhoonik.lee <hoonik.lee@samsung.com>
Wed, 15 May 2013 07:29:49 +0000 (16:29 +0900)
committerGerrit Code Review <gerrit2@kim11>
Wed, 15 May 2013 07:29:49 +0000 (16:29 +0900)
This reverts commit 1df0573d46cafa730c5904d8096da68a73219499

src/graphics/FGrp_Canvas.cpp
src/graphics/FGrp_CanvasImpl.cpp
src/graphics/FGrp_CanvasPixman.cpp

index f85f0e8..e6e49e2 100644 (file)
@@ -1615,8 +1615,16 @@ _Canvas::DrawBitmap(const _Util::Rectangle<double>& destRectD, const _Bitmap& sr
                {
                        if (!this->__useStableRenderer && srcBufferInfo.bitsPerPixel == 32 && (GetCompositeMode() != COMPOSITE_MODE_SRC_OVER || srcBitmap.__isPremultiplied))
                        {
+                               _Util::Rectangle<int> srcBounds =
+                               {
+                                       int(Math::Floor(srcRectD.x)),
+                                       int(Math::Floor(srcRectD.y)),
+                                       int(Math::Ceiling(srcRectD.x + srcRectD.w) - Math::Floor(srcRectD.x)),
+                                       int(Math::Ceiling(srcRectD.y + srcRectD.h) - Math::Floor(srcRectD.y))
+                               };
+
                                _Util::Pixmap srcImageUnclipped(srcBufferInfo.width, srcBufferInfo.height, srcBufferInfo.bitsPerPixel, srcBufferInfo.pPixels, srcBufferInfo.pitch);
-                               _Util::Pixmap srcImage = srcImageUnclipped.GetSubBitmap(srcRect.x, srcRect.y, srcRect.w, srcRect.h);
+                               _Util::Pixmap srcImage = srcImageUnclipped.GetSubBitmap(srcBounds.x, srcBounds.y, srcBounds.w, srcBounds.h);
                                _ApplySrcBitmapAttrib(srcImage, srcBitmap, srcBitmap.__isOpaqueAllOver);
 
                                _Util::Pixmap dstImageUnclipped(dstBufferInfo.width, dstBufferInfo.height, dstBufferInfo.bitsPerPixel, dstBufferInfo.pPixels, dstBufferInfo.pitch);
index 3b0e428..61dbb85 100644 (file)
@@ -1066,11 +1066,6 @@ _CanvasImpl::DrawBitmap(const FloatRectangle& vcRectF, const _BitmapImpl& bitmap
                return this->DrawBitmap(FloatPoint(vcRectF.x, vcRectF.y), bitmap);
        }
 
-       if (_FloatToIntForSize(vcRectF.width) == bitmap.GetWidth() && _FloatToIntForSize(vcRectF.height) == bitmap.GetHeight())
-       {
-               return this->DrawBitmap(FloatPoint(vcRectF.x, vcRectF.y), bitmap);
-       }
-
        // check if bimap can be drew in canvas area.
        FloatRectangle rtCanvasF = _GetBoundsRelF(*this);
 
@@ -1192,11 +1187,6 @@ _CanvasImpl::DrawBitmap(const FloatRectangle& vcDestRectF, const _BitmapImpl& sr
                SysTryReturnResult(NID_GRP, 0, E_OUT_OF_RANGE, "The specified region of source bitmap is out of range.");
        }
 
-       if (vcSrcRectF.width == srcBitmap.GetWidthF() && vcSrcRectF.height == srcBitmap.GetHeightF())
-       {
-               return this->DrawBitmap(vcDestRectF, srcBitmap);
-       }
-
        // check if srcRect is in bitmap's area.
        result r = _Util::Validate(vcSrcRectF, FloatRectangle(0, 0, srcBitmap.GetWidthF(), srcBitmap.GetHeightF()));
 
index 980abb6..0bce78e 100644 (file)
@@ -373,7 +373,7 @@ bool CopyPixmap(Tizen::Graphics::_Util::Pixmap& dstImage, const Tizen::Graphics:
                {
                        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));
+                       pixman_transform_translate(&transform, NULL, pixman_double_to_fixed(-xDest), pixman_double_to_fixed(-yDest));
 
                        return CompositePixmap(dstImage, srcImage, rop, filter, transform, PIXMAN_REPEAT_NONE);
                }
@@ -436,7 +436,7 @@ bool ScalePixmap(Tizen::Graphics::_Util::Pixmap& dstImage, const Tizen::Graphics
                }
        default:
                {
-                       pixman_transform_t transform = Tizen::Graphics::_Pixman::GetTransform(srcImage.width, srcImage.height, xDest-0.5, yDest-0.5, wDest, hDest);
+                       pixman_transform_t transform = Tizen::Graphics::_Pixman::GetTransform(srcImage.width, srcImage.height, xDest, yDest, wDest, hDest);
 
                        return CompositePixmap(dstImage, srcImage, rop, filter, transform, PIXMAN_REPEAT_NONE);
                }