From 6e68cb7f99e5f2e4c9bf65eabe2382279da8b30e Mon Sep 17 00:00:00 2001 From: "hoonik.lee" Date: Thu, 2 May 2013 17:24:07 +0900 Subject: [PATCH] Modify DrawBitmap for Premultiplied image drawing Change-Id: I6308119bbb6f529286ea7f78f6e1e5c472a92fa2 Signed-off-by: hoonik.lee --- src/graphics/FGrp_Canvas.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/graphics/FGrp_Canvas.cpp b/src/graphics/FGrp_Canvas.cpp index 8cd4ca5..b0793e0 100644 --- a/src/graphics/FGrp_Canvas.cpp +++ b/src/graphics/FGrp_Canvas.cpp @@ -1320,7 +1320,7 @@ _Canvas::DrawBitmap(const _Util::Rectangle& rectD, const _Bitmap& bitmap const BufferInfo& dstBufferInfo = dstLock.GetBufferInfo(); { - if (!this->__useStableRenderer && srcBufferInfo.bitsPerPixel == 32 && GetCompositeMode() != COMPOSITE_MODE_SRC_OVER) + if (!this->__useStableRenderer && srcBufferInfo.bitsPerPixel == 32 && (GetCompositeMode() != COMPOSITE_MODE_SRC_OVER || bitmap.__isPremultiplied)) { _Util::Pixmap srcImage(srcBufferInfo.width, srcBufferInfo.height, srcBufferInfo.bitsPerPixel, srcBufferInfo.pPixels, srcBufferInfo.pitch); _ApplySrcBitmapAttrib(srcImage, bitmap, bitmap.__isOpaqueAllOver); @@ -1488,7 +1488,7 @@ _Canvas::DrawBitmap(const _Util::Point& pointD, 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); - if (srcBufferInfo.pixelFormat == PIXEL_FORMAT_RGB565 && srcImage.enableColorKey == 0 && dstBufferInfo.pixelFormat == PIXEL_FORMAT_ARGB8888 && !this->__isClipBoundsSet) + if (srcBufferInfo.pixelFormat == PIXEL_FORMAT_RGB565 && srcImage.enableColorKey == 0 && dstBufferInfo.pixelFormat == PIXEL_FORMAT_ARGB8888 && !this->__isClipBoundsSet && alphaConstant >= 255) { pixman_image_t* pPixmanSrc = pixman_image_create_bits(PIXMAN_r5g6b5, srcBufferInfo.width, srcBufferInfo.height, (uint32_t*)srcBufferInfo.pPixels, srcBufferInfo.pitch); pixman_image_t* pPixmanDst = pixman_image_create_bits(PIXMAN_a8r8g8b8, dstBufferInfo.width, dstBufferInfo.height, (uint32_t*)dstBufferInfo.pPixels, dstBufferInfo.pitch); @@ -1511,7 +1511,7 @@ _Canvas::DrawBitmap(const _Util::Point& pointD, const _Bitmap& bitmap) } } { - bool isPixmanSupported = (!this->__useStableRenderer && GetCompositeMode() != COMPOSITE_MODE_SRC_OVER); + bool isPixmanSupported = (!this->__useStableRenderer && (GetCompositeMode() != COMPOSITE_MODE_SRC_OVER || bitmap.__isPremultiplied)); if (isPixmanSupported) { @@ -1613,7 +1613,7 @@ _Canvas::DrawBitmap(const _Util::Rectangle& destRectD, const _Bitmap& sr const BufferInfo& dstBufferInfo = dstLock.GetBufferInfo(); { - if (!this->__useStableRenderer && srcBufferInfo.bitsPerPixel == 32 && GetCompositeMode() != COMPOSITE_MODE_SRC_OVER) + if (!this->__useStableRenderer && srcBufferInfo.bitsPerPixel == 32 && (GetCompositeMode() != COMPOSITE_MODE_SRC_OVER || srcBitmap.__isPremultiplied)) { _Util::Rectangle srcBounds = { @@ -1789,7 +1789,7 @@ _Canvas::DrawBitmapForNinePatchedBitmap(const Rectangle& destRect, const _Bitmap const BufferInfo& dstBufferInfo = dstLock.GetBufferInfo(); { - if (srcBufferInfo.bitsPerPixel == 32 && GetCompositeMode() != COMPOSITE_MODE_SRC_OVER) + if (srcBufferInfo.bitsPerPixel == 32 && (GetCompositeMode() != COMPOSITE_MODE_SRC_OVER || srcBitmap.__isPremultiplied)) { _Util::Rectangle outRect = { 0, 0, -1, -1 }; _Util::Rectangle dstRect = { destRect.x, destRect.y, destRect.width, destRect.height }; -- 2.7.4