From: subhransu mohanty Date: Mon, 3 Jun 2019 07:17:50 +0000 (+0900) Subject: raster/drawing: updated drawbitmap api with const_alpha support X-Git-Tag: submit/tizen/20190619.051039~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2aadcee66fcdf87c30e92ab547fe57346deaf6ce;p=platform%2Fcore%2Fuifw%2Flottie-player.git raster/drawing: updated drawbitmap api with const_alpha support --- diff --git a/src/vector/vpainter.cpp b/src/vector/vpainter.cpp index 71a57bb..09cadc2 100644 --- a/src/vector/vpainter.cpp +++ b/src/vector/vpainter.cpp @@ -27,7 +27,7 @@ public: void drawRle(const VPoint &pos, const VRle &rle); void drawRle(const VRle &rle, const VRle &clip); void setCompositionMode(VPainter::CompositionMode mode) { mSpanData.mCompositionMode = mode;} - void drawBitmapUntransform(const VRect &target, const VBitmap &bitmap, const VRect &source); + void drawBitmapUntransform(const VRect &target, const VBitmap &bitmap, const VRect &source, uint8_t const_alpha); public: VRasterBuffer mBuffer; VSpanData mSpanData; @@ -89,9 +89,9 @@ static void fillRect(const VRect &r, VSpanData *data) void VPainterImpl::drawBitmapUntransform(const VRect &target, const VBitmap &bitmap, - const VRect &source) + const VRect &source, uint8_t const_alpha) { - mSpanData.initTexture(&bitmap, 255, VBitmapData::Plain, source); + mSpanData.initTexture(&bitmap, const_alpha, VBitmapData::Plain, source); if (!mSpanData.mUnclippedBlendFunc) return; mSpanData.dx = -target.x(); @@ -161,15 +161,15 @@ VRect VPainter::clipBoundingRect() const return mImpl->mSpanData.clipRect(); } -void VPainter::drawBitmap(const VPoint &point, const VBitmap &bitmap, const VRect &source) +void VPainter::drawBitmap(const VPoint &point, const VBitmap &bitmap, const VRect &source, uint8_t const_alpha) { if (!bitmap.valid()) return; drawBitmap(VRect(point.x(), point.y(), bitmap.width(), bitmap.height()), - bitmap, source); + bitmap, source, const_alpha); } -void VPainter::drawBitmap(const VRect &target, const VBitmap &bitmap, const VRect &source) +void VPainter::drawBitmap(const VRect &target, const VBitmap &bitmap, const VRect &source, uint8_t const_alpha) { if (!bitmap.valid()) return; @@ -177,25 +177,25 @@ void VPainter::drawBitmap(const VRect &target, const VBitmap &bitmap, const VRe setBrush(VBrush()); if (target.size() == source.size()) { - mImpl->drawBitmapUntransform(target, bitmap, source); + mImpl->drawBitmapUntransform(target, bitmap, source, const_alpha); } else { // @TODO scaling } } -void VPainter::drawBitmap(const VPoint &point, const VBitmap &bitmap) +void VPainter::drawBitmap(const VPoint &point, const VBitmap &bitmap, uint8_t const_alpha) { if (!bitmap.valid()) return; drawBitmap(VRect(point.x(), point.y(), bitmap.width(), bitmap.height()), - bitmap, VRect(0, 0, bitmap.width(), bitmap.height())); + bitmap, VRect(0, 0, bitmap.width(), bitmap.height()), const_alpha); } -void VPainter::drawBitmap(const VRect &rect, const VBitmap &bitmap) +void VPainter::drawBitmap(const VRect &rect, const VBitmap &bitmap, uint8_t const_alpha) { if (!bitmap.valid()) return; - drawBitmap(rect, bitmap, VRect(0, 0, bitmap.width(), bitmap.height())); + drawBitmap(rect, bitmap, VRect(0, 0, bitmap.width(), bitmap.height()), const_alpha); } V_END_NAMESPACE diff --git a/src/vector/vpainter.h b/src/vector/vpainter.h index 9a2d60a..2d52337 100644 --- a/src/vector/vpainter.h +++ b/src/vector/vpainter.h @@ -47,10 +47,10 @@ public: void drawRle(const VRle &rle, const VRle &clip); VRect clipBoundingRect() const; - void drawBitmap(const VPoint &point, const VBitmap &bitmap, const VRect &source); - void drawBitmap(const VRect &target, const VBitmap &bitmap, const VRect &source); - void drawBitmap(const VPoint &point, const VBitmap &bitmap); - void drawBitmap(const VRect &rect, const VBitmap &bitmap); + void drawBitmap(const VPoint &point, const VBitmap &bitmap, const VRect &source, uint8_t const_alpha = 255); + void drawBitmap(const VRect &target, const VBitmap &bitmap, const VRect &source, uint8_t const_alpha = 255); + void drawBitmap(const VPoint &point, const VBitmap &bitmap, uint8_t const_alpha = 255); + void drawBitmap(const VRect &rect, const VBitmap &bitmap, uint8_t const_alpha = 255); private: VPainterImpl *mImpl; };