Modify DrawBitmap() to adjust floating point axis
authorhoonik.lee <hoonik.lee@samsung.com>
Wed, 15 May 2013 08:11:33 +0000 (17:11 +0900)
committerhoonik.lee <hoonik.lee@samsung.com>
Wed, 15 May 2013 08:11:33 +0000 (17:11 +0900)
Change-Id: I88dcd97eea347911e33f3799192ff571068c719b
Signed-off-by: hoonik.lee <hoonik.lee@samsung.com>
src/graphics/FGrp_Canvas.cpp
src/graphics/FGrp_CanvasImpl.cpp
src/graphics/FGrp_CanvasPixman.cpp

index e6e49e2..f85f0e8 100755 (executable)
@@ -1615,16 +1615,8 @@ _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(srcBounds.x, srcBounds.y, srcBounds.w, srcBounds.h);
+                               _Util::Pixmap srcImage = srcImageUnclipped.GetSubBitmap(srcRect.x, srcRect.y, srcRect.w, srcRect.h);
                                _ApplySrcBitmapAttrib(srcImage, srcBitmap, srcBitmap.__isOpaqueAllOver);
 
                                _Util::Pixmap dstImageUnclipped(dstBufferInfo.width, dstBufferInfo.height, dstBufferInfo.bitsPerPixel, dstBufferInfo.pPixels, dstBufferInfo.pitch);
index 3eab72c..920f268 100755 (executable)
@@ -1066,6 +1066,11 @@ _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);
 
@@ -1187,6 +1192,11 @@ _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 cbb6427..b1fa3ba 100644 (file)
@@ -439,7 +439,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), pixman_double_to_fixed(-yDest));
+       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);
 }
@@ -503,7 +503,7 @@ 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, yDest, wDest, hDest);
+       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);