Modify DrawBitmap and NinePatchedBitmap
authorhoonik.lee <hoonik.lee@samsung.com>
Tue, 9 Apr 2013 07:31:56 +0000 (16:31 +0900)
committerhoonik.lee <hoonik.lee@samsung.com>
Tue, 9 Apr 2013 07:31:56 +0000 (16:31 +0900)
Change-Id: Iae1f415c6c93e95f9ae80dcba7a3ff6b18bf5967
Signed-off-by: hoonik.lee <hoonik.lee@samsung.com>
src/graphics/FGrp_Canvas.cpp
src/graphics/FGrp_Canvas.h
src/graphics/FGrp_CanvasImpl.cpp
src/graphics/util/FGrp_UtilPixmap.cpp

index 9838aff..0f50cf4 100755 (executable)
@@ -1358,7 +1358,7 @@ _Canvas::DrawBitmap(const _Util::Rectangle<double>& rectD, const _Bitmap& bitmap
 
                }
 
-               if(pass)
+               if (pass)
                {
                        return E_SUCCESS;
                }
@@ -1564,16 +1564,16 @@ _Canvas::DrawBitmap(const _Util::Point<double>& pointD, const _Bitmap& bitmap)
 }
 
 result
-_Canvas::DrawBitmap(const Rectangle& destRect, const _Bitmap& srcBitmap, const Rectangle& srcRect)
+_Canvas::DrawBitmap(const _Util::Rectangle<double>& destRectD, const _Bitmap& srcBitmap, const _Util::Rectangle<double>& srcRectD)
 {
        SysTryReturnResult(NID_GRP, &srcBitmap && srcBitmap.IsValid(), E_INVALID_ARG, "The source bitmap is invalid.\n");
 
-       if (srcRect.width == 0 || srcRect.height == 0)
+       if (srcRectD.w == 0 || srcRectD.h == 0)
        {
                return E_SUCCESS;
        }
 
-       if (destRect.width == 0 || destRect.height == 0)
+       if (destRectD.w == 0 || destRectD.h == 0)
        {
                return E_SUCCESS;
        }
@@ -1584,7 +1584,22 @@ _Canvas::DrawBitmap(const Rectangle& destRect, const _Bitmap& srcBitmap, const R
 
        this->__GetClipBounds(clipRect);
 
-       if (alphaConstant >= 255)
+       _Util::Rectangle<int> destRect =
+       {
+               _DoubleToIntForPos(destRectD.x),
+               _DoubleToIntForPos(destRectD.y),
+               _DoubleToIntForSize(destRectD.w),
+               _DoubleToIntForSize(destRectD.h)
+       };
+
+       _Util::Rectangle<int> srcRect =
+       {
+               _DoubleToIntForPos(srcRectD.x),
+               _DoubleToIntForPos(srcRectD.y),
+               _DoubleToIntForSize(srcRectD.w),
+               _DoubleToIntForSize(srcRectD.h)
+       };
+
        {
                bool pass = false;
 
@@ -1600,61 +1615,60 @@ _Canvas::DrawBitmap(const Rectangle& destRect, const _Bitmap& srcBitmap, const R
                {
                        if (!this->__useStableRenderer && srcBufferInfo.bitsPerPixel == 32)
                        {
-                               _Util::Rectangle<int> outRect = { 0, 0, -1, -1 };
-                               _Util::Rectangle<int> dstRect = { destRect.x, destRect.y, destRect.width, destRect.height };
-                               _Util::Rectangle<int> tgtRect = { clipRect.x, clipRect.y, clipRect.width, clipRect.height };
-
-                               _Util::IntersectRect(outRect, tgtRect, dstRect);
-
-                               // assert(destRect.width > 0 && destRect.height > 0);
-
-                               _Util::Bounds<int> outBounds = { outRect.x, outRect.y, outRect.x + outRect.w, outRect.y + outRect.h };
-                               _Util::Bounds<int> dstBounds = { dstRect.x, dstRect.y, dstRect.x + dstRect.w, dstRect.y + dstRect.h };
-                               _Util::Bounds<int> srcBounds =
+                               _Util::Rectangle<int> srcBounds =
                                {
-                                       srcRect.x + (outBounds.x1 - dstBounds.x1) * srcRect.width / (dstBounds.x2 - dstBounds.x1),
-                                       srcRect.y + (outBounds.y1 - dstBounds.y1) * srcRect.height / (dstBounds.y2 - dstBounds.y1),
-                                       (srcRect.x + srcRect.width) + (outBounds.x2 - dstBounds.x2) * srcRect.width / (dstBounds.x2 - dstBounds.x1),
-                                       (srcRect.y + srcRect.height) + (outBounds.y2 - dstBounds.y2) * srcRect.height / (dstBounds.y2 - dstBounds.y1),
+                                       int(Math::Floor(srcRect.x)),
+                                       int(Math::Floor(srcRect.y)),
+                                       int(Math::Ceiling(srcRect.x + srcRect.w) - Math::Floor(srcRect.x)),
+                                       int(Math::Ceiling(srcRect.y + srcRect.h) - Math::Floor(srcRect.y))
                                };
 
-                               srcBounds.x1 = (srcBounds.x1 >= srcRect.x) ? srcBounds.x1 : srcRect.x;
-                               srcBounds.y1 = (srcBounds.y1 >= srcRect.y) ? srcBounds.y1 : srcRect.y;
-                               srcBounds.x2 = (srcBounds.x2 <= (srcRect.x + srcRect.width)) ? srcBounds.x2 : (srcRect.x + srcRect.width);
-                               srcBounds.y2 = (srcBounds.y2 <= (srcRect.y + srcRect.height)) ? srcBounds.y2 : (srcRect.y + srcRect.height);
-
                                _Util::Pixmap srcImageUnclipped(srcBufferInfo.width, srcBufferInfo.height, srcBufferInfo.bitsPerPixel, srcBufferInfo.pPixels, srcBufferInfo.pitch);
-                               _Util::Pixmap srcImage = srcImageUnclipped.GetSubBitmap(srcBounds.x1, srcBounds.y1, srcBounds.x2 - srcBounds.x1, srcBounds.y2 - srcBounds.y1);
+                               _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);
-                               _Util::Pixmap dstImage = dstImageUnclipped.GetSubBitmap(outRect.x, outRect.y, outRect.w, outRect.h);
+                               _Util::Pixmap dstImage = dstImageUnclipped.GetSubBitmap(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
 
-                               pass = _Pixman::ScalePixmap(dstImage, srcImage, GetDrawingQuality(), GetCompositeMode());
+                               if  (alphaConstant < 255)
+                               {
+                                       std::unique_ptr<_Util::Pixmap> modifiedSrcImage(srcImage.GetAlphaAttenuatedPixmap(alphaConstant));
+
+                                       if (modifiedSrcImage != null)
+                                       {
+                                               pass = _Pixman::ScalePixmap(dstImage, *modifiedSrcImage.get(), GetDrawingQuality(), GetCompositeMode(), destRectD.x - clipRect.x, destRectD.y - clipRect.y, destRectD.w, destRectD.h);
+                                       }
+                               }
+
+                               if (!pass)
+                               {
+                                       pass = _Pixman::ScalePixmap(dstImage, srcImage, GetDrawingQuality(), GetCompositeMode(), destRectD.x - clipRect.x, destRectD.y - clipRect.y, destRectD.w, destRectD.h);
+                               }
                        }
 
                        if (!pass)
                        {
                                unsigned char* pPixels = (unsigned char*) srcBufferInfo.pPixels + srcRect.y * srcBufferInfo.pitch + srcRect.x * (srcBufferInfo.bitsPerPixel / 8);
 
-                               _Util::Pixmap srcImage(srcRect.width, srcRect.height, srcBufferInfo.bitsPerPixel, (void*) pPixels, srcBufferInfo.pitch);
+                               _Util::Pixmap srcImage(srcRect.w, srcRect.h, srcBufferInfo.bitsPerPixel, (void*) pPixels, srcBufferInfo.pitch);
                                _ApplySrcBitmapAttrib(srcImage, srcBitmap, srcBitmap.__isOpaqueAllOver);
 
                                _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 = Tizen::Graphics::_Effect::ScaleImage(dstImage, destRect.x - clipRect.x, destRect.y - clipRect.y, destRect.width, destRect.height, srcImage, _ConvertParam<_Effect::Rop>(this->__blendOption));
+                               pass = Tizen::Graphics::_Effect::ScaleImage(dstImage, destRect.x - clipRect.x, destRect.y - clipRect.y, destRect.w, destRect.h, srcImage, _ConvertParam<_Effect::Rop>(this->__blendOption));
                        }
 
                }
 
-               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(destRect.width, destRect.height, srcBitmap.GetBitsPerPixel());
+               _Util::Pixmap tmpImage(destRect.w, destRect.h, srcBitmap.GetBitsPerPixel());
 
                // copies the source bitmap to the scaled bitmap
                {
@@ -1707,10 +1721,10 @@ _Canvas::DrawBitmap(const Rectangle& destRect, const _Bitmap& srcBitmap, const R
                                {
                                        unsigned char* pPixels = (unsigned char*) srcBufferInfo.pPixels + srcRect.y * srcBufferInfo.pitch + srcRect.x * (srcBufferInfo.bitsPerPixel / 8);
 
-                                       _Util::Pixmap srcImage(srcRect.width, srcRect.height, srcBufferInfo.bitsPerPixel, (void*) pPixels, srcBufferInfo.pitch);
+                                       _Util::Pixmap srcImage(srcRect.w, srcRect.h, srcBufferInfo.bitsPerPixel, (void*) pPixels, srcBufferInfo.pitch);
                                        _ApplySrcBitmapAttrib(srcImage, srcBitmap, srcBitmap.__isOpaqueAllOver);
 
-                                       pass = Tizen::Graphics::_Effect::ScaleImage(tmpImage, 0, 0, destRect.width, destRect.height, srcImage, Tizen::Graphics::_Effect::ROP_COPY);
+                                       pass = Tizen::Graphics::_Effect::ScaleImage(tmpImage, 0, 0, destRect.w, destRect.h, srcImage, Tizen::Graphics::_Effect::ROP_COPY);
                                }
                        }
 
@@ -1762,10 +1776,9 @@ _Canvas::DrawBitmapForNinePatchedBitmap(const Rectangle& destRect, const _Bitmap
 
        this->__GetClipBounds(clipRect);
 
-       if (alphaConstant >= 255)
-       {
-               bool pass = false;
+       bool pass = false;
 
+       {
                _Util::LockManager srcLock(srcBitmap);
                _Util::LockManager dstLock(*this);
 
@@ -1814,7 +1827,20 @@ _Canvas::DrawBitmapForNinePatchedBitmap(const Rectangle& destRect, const _Bitmap
                                }
                                else
                                {
-                                       pass = _Pixman::ScalePixmap(dstImage, srcImage, GetDrawingQuality(), GetCompositeMode());
+                                       if (alphaConstant < 255)
+                                       {
+                                               std::unique_ptr<_Util::Pixmap> modifiedSrcImage(srcImage.GetAlphaAttenuatedPixmap(alphaConstant));
+
+                                               if (modifiedSrcImage != null)
+                                               {
+                                                       pass = _Pixman::ScalePixmap(dstImage, *modifiedSrcImage.get(), GetDrawingQuality(), GetCompositeMode());
+                                               }
+                                       }
+
+                                       if (!pass)
+                                       {
+                                               pass = _Pixman::ScalePixmap(dstImage, srcImage, GetDrawingQuality(), GetCompositeMode());
+                                       }
                                }
                        }
 
@@ -1840,11 +1866,9 @@ _Canvas::DrawBitmapForNinePatchedBitmap(const Rectangle& destRect, const _Bitmap
 
                }
 
-               SysTryReturnResult(NID_GRP, pass, E_INVALID_ARG, "The source bitmap is invalid.\n");
-
-               return E_SUCCESS;
        }
-       else
+
+       if (!pass)
        {
                _Util::Pixmap tmpImage(destRect.width, destRect.height, srcBitmap.GetBitsPerPixel());
 
@@ -1888,7 +1912,7 @@ _Canvas::DrawBitmapForNinePatchedBitmap(const Rectangle& destRect, const _Bitmap
                                }
                        }
 
-                       bool pass = false;
+                       bool scaled = false;
 
                        {
                                _Util::LockManager srcLock(srcBitmap);
@@ -1902,35 +1926,31 @@ _Canvas::DrawBitmapForNinePatchedBitmap(const Rectangle& destRect, const _Bitmap
                                        _Util::Pixmap srcImage(srcRect.width, srcRect.height, srcBufferInfo.bitsPerPixel, (void*) pPixels, srcBufferInfo.pitch);
                                        _ApplySrcBitmapAttrib(srcImage, srcBitmap, srcBitmap.__isOpaqueAllOver);
 
-                                       pass = Tizen::Graphics::_Effect::ScaleImage(tmpImage, 0, 0, destRect.width, destRect.height, srcImage, Tizen::Graphics::_Effect::ROP_COPY);
+                                       scaled = Tizen::Graphics::_Effect::ScaleImage(tmpImage, 0, 0, destRect.width, destRect.height, srcImage, Tizen::Graphics::_Effect::ROP_COPY);
                                }
                        }
 
-                       SysTryReturnResult(NID_GRP, pass, E_INVALID_ARG, "The source bitmap is invalid.\n");
+                       SysTryReturnResult(NID_GRP, scaled, E_INVALID_ARG, "The source bitmap is invalid.\n");
                }
 
                {
-                       bool pass = false;
-
-                       {
-                               _Util::LockManager dstLock(*this);
-                               SysTryReturnResult(NID_GRP, dstLock.IsValid(), E_OPERATION_FAILED, "The canvas cannot be locked.\n");
+                       _Util::LockManager dstLock(*this);
+                       SysTryReturnResult(NID_GRP, dstLock.IsValid(), E_OPERATION_FAILED, "The canvas cannot be locked.\n");
 
-                               const BufferInfo& dstBufferInfo = dstLock.GetBufferInfo();
+                       const BufferInfo& dstBufferInfo = dstLock.GetBufferInfo();
 
-                               {
-                                       _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);
+                       {
+                               _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 = Tizen::Graphics::_Effect::DrawImageWithAlpha(dstImage, destRect.x - clipRect.x, destRect.y - clipRect.y, tmpImage, alphaConstant);
-                               }
+                               pass = Tizen::Graphics::_Effect::DrawImageWithAlpha(dstImage, destRect.x - clipRect.x, destRect.y - clipRect.y, tmpImage, alphaConstant);
                        }
-
-                       SysTryReturnResult(NID_GRP, pass, E_INVALID_ARG, "The source bitmap is invalid.\n");
                }
-
-               return E_SUCCESS;
        }
+
+       SysTryReturnResult(NID_GRP, pass, E_INVALID_ARG, "The source bitmap is invalid.\n");
+
+       return E_SUCCESS;
 }
 
 result
@@ -2177,7 +2197,7 @@ _Canvas::DrawNinePatchedBitmap(const Rectangle& rect, const _Bitmap& bitmap)
                        // not <- PADDING * 2>
                        Tizen::Graphics::Rectangle srcRect(PADDING, PADDING, expandedBitmap.GetWidth() - PADDING, expandedBitmap.GetHeight() - PADDING);
 
-                       return this->DrawBitmap(rect, expandedBitmap, srcRect);
+                       return this->DrawBitmap(_Util::Convert<Rectangle, _Util::Rectangle<double> >(rect), expandedBitmap, _Util::Convert<Rectangle, _Util::Rectangle<double> >(srcRect));
                }
 
 #else // old spec.
index a4928e6..b94c628 100644 (file)
@@ -154,7 +154,7 @@ public:
 
        result DrawBitmap(const _Util::Point<double>& point, const _Bitmap& bitmap);
        result DrawBitmap(const _Util::Rectangle<double>& rect, const _Bitmap& bitmap);
-       result DrawBitmap(const Rectangle& destRect, const _Bitmap& srcBitmap, const Rectangle& srcRect);
+       result DrawBitmap(const _Util::Rectangle<double>& destRect, const _Bitmap& srcBitmap, const _Util::Rectangle<double>& srcRect);
        result DrawBitmapForNinePatchedBitmap(const Rectangle& destRect, const _Bitmap& srcBitmap, const Rectangle& srcRect, bool copyOnly = false);
        result DrawBitmap(const Point& point, const _Bitmap& bitmap, FlipDirection dir);
        result DrawBitmap(const _Util::Point<double>& point, const _Bitmap& bitmap, const _Util::Point<double>& pivot, double degree);
index afcae87..3fcef9a 100755 (executable)
@@ -1157,70 +1157,7 @@ _CanvasImpl::DrawBitmap(const Rectangle& vcDestRect, const _BitmapImpl& srcBitma
 {
        SysTryReturnResult(NID_GRP, INSTANCE_IS_VALID, E_OPERATION_FAILED, "This instance is not constructed yet.");
 
-       SysTryReturnResult(NID_GRP, BITMAP_IS_VALID(srcBitmap), E_INVALID_ARG, "The source bitmap is invalid.");
-
-       SysTryReturnResult(NID_GRP, (&vcSrcRect) && (&vcDestRect), E_INVALID_ARG, "The given rectangle is invalid.");
-
-       SysTryReturnResult(NID_GRP, (vcSrcRect.width >= 0) && (vcSrcRect.height >= 0), E_OUT_OF_RANGE, "The given source rectangle(width:%d,height:%d) is out of range.", vcSrcRect.width,  vcSrcRect.height);
-       SysTryReturnResult(NID_GRP, (vcDestRect.width >= 0) && (vcDestRect.height >= 0), E_OUT_OF_RANGE, "The given destination rectangle(width:%d,height:%d) is out of range.", vcDestRect.width, vcDestRect.height);
-
-       if (vcSrcRect.width == 0 || vcSrcRect.height == 0)
-       {
-               return E_SUCCESS;
-       }
-
-       if (vcDestRect.width == 0 || vcDestRect.height == 0)
-       {
-               return E_SUCCESS;
-       }
-
-       if ((vcSrcRect.x < 0) || (vcSrcRect.y < 0) || (vcSrcRect.x + vcSrcRect.width > srcBitmap.GetWidth()) || (vcSrcRect.y + vcSrcRect.height > srcBitmap.GetHeight()))
-       {
-               SysTryReturnResult(NID_GRP, 0, E_OUT_OF_RANGE, "The specified region of source bitmap is out of range.");
-       }
-
-       // check if srcRect is in bitmap's area.
-       result r = _Util::Validate(vcSrcRect, Rectangle(0, 0, srcBitmap.GetWidth(), srcBitmap.GetHeight()));
-
-       SysTryReturnResult(NID_GRP, !IsFailed(r), r, "Propagating.");
-
-       // check if destRect is in this canvas.
-       Rectangle rtCanvas = _GetBoundsRel(*this);
-
-       if (rtCanvas.IsEmpty())
-       {
-               return E_SUCCESS;
-       }
-
-       r = _Util::Validate(vcDestRect, rtCanvas);
-
-       SysTryReturnResult(NID_GRP, !IsFailed(r), r, "Propagating.");
-
-       EXTRACT_BITMAPEX(pBitmapEx, srcBitmap);
-
-       if (_ResUtil::NeedToConvertCoord())
-       {
-               Tizen::Graphics::Dimension virSize;
-               Tizen::Graphics::Dimension phySize;
-               bool lazyScaling = Tizen::Graphics::_IsLazyScalingBitmap(srcBitmap, virSize, phySize);
-
-               Rectangle pcDestRect = _ResUtil::ConvertToPhyCoord(vcDestRect);
-
-               if (lazyScaling)
-               {
-                       return this->_pNativeCanvas->DrawBitmap(pcDestRect, *pBitmapEx, vcSrcRect);
-               }
-               else
-               {
-                       Rectangle pcSrcRect = _ResUtil::ConvertToPhyCoord(vcSrcRect);
-
-                       return this->_pNativeCanvas->DrawBitmap(pcDestRect, *pBitmapEx, pcSrcRect);
-               }
-       }
-       else
-       {
-               return this->_pNativeCanvas->DrawBitmap(vcDestRect, *pBitmapEx, vcSrcRect);
-       }
+       return this->DrawBitmap(FloatRectangle(float(vcDestRect.x), float(vcDestRect.y), float(vcDestRect.width), float(vcDestRect.height)), srcBitmap, FloatRectangle(float(vcSrcRect.x), float(vcSrcRect.y), float(vcSrcRect.width), float(vcSrcRect.height)));
 }
 
 result
@@ -1277,29 +1214,29 @@ _CanvasImpl::DrawBitmap(const FloatRectangle& vcDestRectF, const _BitmapImpl& sr
 
                FloatRectangle pcDestRectF = _ResUtil::ConvertToPhyCoord(vcDestRectF);
 
-               Rectangle pcDestRect(_FloatToIntForPos(pcDestRectF.x), _FloatToIntForPos(pcDestRectF.y), _FloatToIntForSize(pcDestRectF.width), _FloatToIntForSize(pcDestRectF.height));
+               _Util::Rectangle<double> pcDestRectD = _Util::Convert<FloatRectangle, _Util::Rectangle<double> >(pcDestRectF);
 
                if (lazyScaling)
                {
-                       Rectangle vcSrcRect(_FloatToIntForPos(vcSrcRectF.x), _FloatToIntForPos(vcSrcRectF.y), _FloatToIntForSize(vcSrcRectF.width), _FloatToIntForSize(vcSrcRectF.height));
+                       _Util::Rectangle<double> vcSrcRectD = _Util::Convert<FloatRectangle, _Util::Rectangle<double> >(vcSrcRectF);
 
-                       return this->_pNativeCanvas->DrawBitmap(pcDestRect, *pBitmapEx, vcSrcRect);
+                       return this->_pNativeCanvas->DrawBitmap(pcDestRectD, *pBitmapEx, vcSrcRectD);
                }
                else
                {
                        FloatRectangle pcSrcRectF = _ResUtil::ConvertToPhyCoord(vcSrcRectF);
 
-                       Rectangle pcSrcRect(_FloatToIntForPos(pcSrcRectF.x), _FloatToIntForPos(pcSrcRectF.y), _FloatToIntForSize(pcSrcRectF.width), _FloatToIntForSize(pcSrcRectF.height));
+                       _Util::Rectangle<double> pcSrcRectD = _Util::Convert<FloatRectangle, _Util::Rectangle<double> >(pcSrcRectF);
 
-                       return this->_pNativeCanvas->DrawBitmap(pcDestRect, *pBitmapEx, pcSrcRect);
+                       return this->_pNativeCanvas->DrawBitmap(pcDestRectD, *pBitmapEx, pcSrcRectD);
                }
        }
        else
        {
-               Rectangle vcSrcRect(_FloatToIntForPos(vcSrcRectF.x), _FloatToIntForPos(vcSrcRectF.y), _FloatToIntForSize(vcSrcRectF.width), _FloatToIntForSize(vcSrcRectF.height));
-               Rectangle vcDestRect(_FloatToIntForPos(vcDestRectF.x), _FloatToIntForPos(vcDestRectF.y), _FloatToIntForSize(vcDestRectF.width), _FloatToIntForSize(vcDestRectF.height));
+               _Util::Rectangle<double> vcSrcRectD = _Util::Convert<FloatRectangle, _Util::Rectangle<double> >(vcSrcRectF);
+               _Util::Rectangle<double> vcDestRectD = _Util::Convert<FloatRectangle, _Util::Rectangle<double> >(vcDestRectF);
 
-               return this->_pNativeCanvas->DrawBitmap(vcDestRect, *pBitmapEx, vcSrcRect);
+               return this->_pNativeCanvas->DrawBitmap(vcDestRectD, *pBitmapEx, vcSrcRectD);
        }
 }
 
index 37d0f38..ae2057d 100755 (executable)
@@ -349,7 +349,7 @@ _CreateAlphaAttenuatedBuffer(const _Util::Pixmap& srcImage, int alphaConstant)
        {
                if (alphaConstant <= 0)
                {
-                       memset(pDestBuffer, 0, srcImage.bytesPerLine * srcImage.height);
+                       memset(pDestBuffer, 0, srcImage.width * srcImage.height * sizeof(DestPixel));
                        return destBuffer.release();
                }