}
}
{
- bool isPixmanSupported = (!this->__useStableRenderer) && (alphaConstant >= 255);
+ bool isPixmanSupported = (!this->__useStableRenderer);
if (isPixmanSupported)
{
if (isPixmanSupported)
{
- _Util::Pixmap srcImage(srcBufferInfo.width, srcBufferInfo.height, srcBufferInfo.bitsPerPixel, srcBufferInfo.pPixels, srcBufferInfo.pitch);
- _ApplySrcBitmapAttrib(srcImage, bitmap, bitmap.__isOpaqueAllOver);
+ _Util::Pixmap srcImage(srcBufferInfo.width, srcBufferInfo.height, srcBufferInfo.bitsPerPixel, srcBufferInfo.pPixels, srcBufferInfo.pitch);
+ _ApplySrcBitmapAttrib(srcImage, bitmap, bitmap.__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);
- _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 (alphaConstant < 255)
+ {
+ std::unique_ptr<_Util::Pixmap> modifiedSrcImage(srcImage.GetAlphaAttenuatedPixmap(alphaConstant));
+ if (modifiedSrcImage != null)
+ {
+ pass = _Pixman::CopyPixmap(dstImage, *modifiedSrcImage.get(), GetDrawingQuality(), GetCompositeMode(), pointD.x - clipRect.x, pointD.y - clipRect.y);
+ }
+ }
+
+ if (!pass)
+ {
pass = _Pixman::CopyPixmap(dstImage, srcImage, GetDrawingQuality(), GetCompositeMode(), pointD.x - clipRect.x, pointD.y - clipRect.y);
+ }
}
if (!pass)
}
result
-_Canvas::DrawBitmapForNinePatchedBitmap(const Rectangle& destRect, const _Bitmap& srcBitmap, const Rectangle& srcRect)
+_Canvas::DrawBitmapForNinePatchedBitmap(const Rectangle& destRect, const _Bitmap& srcBitmap, const Rectangle& srcRect, bool copyOnly)
{
SysTryReturnResult(NID_GRP, &srcBitmap && srcBitmap.IsValid(), E_INVALID_ARG, "The source bitmap is invalid.\n");
_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);
- pass = _Pixman::ScalePixmap(dstImage, srcImage, GetDrawingQuality(), GetCompositeMode());
+ if (copyOnly)
+ {
+ pass = _Pixman::ScalePixmapOpCopy(dstImage, srcImage, GetDrawingQuality());
+ }
+ else
+ {
+ pass = _Pixman::ScalePixmap(dstImage, srcImage, GetDrawingQuality(), GetCompositeMode());
+ }
}
if (!pass)
_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));
+ if (copyOnly)
+ {
+ pass = Tizen::Graphics::_Effect::ScaleImage(dstImage, destRect.x - clipRect.x, destRect.y - clipRect.y, destRect.width, destRect.height, srcImage, Tizen::Graphics::_Effect::ROP_COPY);
+ }
+ else
+ {
+ pass = Tizen::Graphics::_Effect::ScaleImage(dstImage, destRect.x - clipRect.x, destRect.y - clipRect.y, destRect.width, destRect.height, srcImage, _ConvertParam<_Effect::Rop>(this->__blendOption));
+ }
}
}
Rectangle destRect(iter->first.x, iter->first.y, iter->first.w, iter->first.h);
Rectangle sourRect(iter->second.x, iter->second.y, iter->second.w, iter->second.h);
- expandedCanvas.DrawBitmapForNinePatchedBitmap(destRect, bitmap, sourRect);
+ expandedCanvas.DrawBitmapForNinePatchedBitmap(destRect, bitmap, sourRect, true);
++iter;
}
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 DrawBitmapForNinePatchedBitmap(const Rectangle& destRect, const _Bitmap& srcBitmap, const Rectangle& 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);
result DrawNinePatchedBitmap(const Rectangle& rect, const _Bitmap& bitmap);
return false;
}
-bool CompositePixmap(Tizen::Graphics::_Util::Pixmap& dstImage, const Tizen::Graphics::_Util::Pixmap& srcImage, pixman_op_t rop, pixman_filter_t filter, pixman_transform_t transform, pixman_repeat_t repeatMethod)
+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)
{
Tizen::Graphics::_Util::AutoDeletor<pixman_image_t> pPixmanDst;
pPixmanSrc.Bind(pixman_image_create_bits(PIXMAN_r5g6b5, srcImage.width, srcImage.height, (uint32_t*)srcImage.pBitmap, srcImage.bytesPerLine));
break;
case 32:
- if (srcImage.isPremultiplied || rop == PIXMAN_OP_SRC)
+ if (srcImage.isPremultiplied || rop == PIXMAN_OP_COPY)
{
pPixmanSrc.Bind(pixman_image_create_bits(PIXMAN_a8r8g8b8, srcImage.width, srcImage.height, (uint32_t*)srcImage.pBitmap, srcImage.bytesPerLine));
}
pixman_image_set_filter(pPixmanSrc, filter, NULL, 0);
pixman_image_set_repeat(pPixmanSrc, repeatMethod);
- pixman_image_composite32(rop, pPixmanSrc, pPixmanMsk, pPixmanDst, 0, 0, 0, 0, 0, 0, dstImage.width, dstImage.height);
+ if (rop == PIXMAN_OP_COPY)
+ {
+ rop = PIXMAN_OP_SRC;
+ }
+
+ pixman_image_composite32(pixman_op_t(rop), pPixmanSrc, pPixmanMsk, pPixmanDst, 0, 0, 0, 0, 0, 0, dstImage.width, dstImage.height);
return true;
}
pPixmanSrc.Bind(pixman_image_create_bits(PIXMAN_r5g6b5, srcImage.width, srcImage.height, (uint32_t*)srcImage.pBitmap, srcImage.bytesPerLine));
break;
case 32:
- if(srcImage.isPremultiplied || rop == PIXMAN_OP_SRC)
+ if (srcImage.isPremultiplied || rop == PIXMAN_OP_COPY)
{
pPixmanSrc.Bind(pixman_image_create_bits(PIXMAN_a8r8g8b8, srcImage.width, srcImage.height, (uint32_t*)srcImage.pBitmap, srcImage.bytesPerLine));
}
if (pPixmanSrc)
{
+ if (rop == PIXMAN_OP_COPY)
+ {
+ rop = PIXMAN_OP_SRC;
+ }
+
pixman_image_set_repeat(pPixmanSrc, PIXMAN_REPEAT_NORMAL);
pixman_image_composite32(rop, pPixmanSrc, pPixmanMsk, pPixmanDst, 0, 0, 0, 0, xDest, yDest, srcImage.width, srcImage.height);
return CompositePixmap(dstImage, srcImage, rop, filter, transform, PIXMAN_REPEAT_NORMAL);
}
+bool ScalePixmapOpCopy(Tizen::Graphics::_Util::Pixmap& dstImage, const Tizen::Graphics::_Util::Pixmap& srcImage, Tizen::Graphics::BitmapDrawingQuality drawingQuality)
+{
+ if (dstImage.width <= 0 || dstImage.height <= 0)
+ {
+ return true;
+ }
+
+ pixman_filter_t filter = Tizen::Graphics::_Pixman::GetFilter(drawingQuality);
+ pixman_transform_t transform = Tizen::Graphics::_Pixman::GetTransform(srcImage.width, srcImage.height, dstImage.width, dstImage.height);
+
+ return CompositePixmap(dstImage, srcImage, PIXMAN_OP_COPY, filter, transform, PIXMAN_REPEAT_NORMAL);
+}
+
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, double wDest, double hDest)
{
if (dstImage.width <= 0 || dstImage.height <= 0)
#include "FGrpBitmapCommon.h"
#include "util/FGrp_UtilPixmap.h"
+#define PIXMAN_OP_COPY pixman_op_t(PIXMAN_OP_CLEAR - 1)
namespace Tizen { namespace Graphics
{
ScalePixmap(Tizen::Graphics::_Util::Pixmap& dstImage, const Tizen::Graphics::_Util::Pixmap& srcImage, Tizen::Graphics::BitmapDrawingQuality drawingQuality, Tizen::Graphics::CompositeMode compositeMode = COMPOSITE_MODE_SRC_OVER);
bool
+ScalePixmapOpCopy(Tizen::Graphics::_Util::Pixmap& dstImage, const Tizen::Graphics::_Util::Pixmap& srcImage, Tizen::Graphics::BitmapDrawingQuality drawingQuality);
+
+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, double wDest, double hDest);
bool
DestPixel alpha = ((*p) & 0xFF000000) >> 8;
alpha *= attenuation;
- *p++ = (alpha & 0xFF000000) | ((*p) & 0x00FFFFFF);
+ *p = (alpha & 0xFF000000) | ((*p) & 0x00FFFFFF);
+
+ ++p;
}
p += padding;