From: subhransu mohanty Date: Wed, 9 Jan 2019 04:29:44 +0000 (+0900) Subject: lottie/vector: add depth() and const data() api to VBitmap class. X-Git-Tag: submit/tizen/20190116.045417~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1ed84cbc12a83b878a88ab6b71ef943521a80baa;p=platform%2Fcore%2Fuifw%2Flottie-player.git lottie/vector: add depth() and const data() api to VBitmap class. Change-Id: I22f16b7c9e9b38c3c115d6b16f093bfbf492afb1 --- diff --git a/src/vector/vbitmap.cpp b/src/vector/vbitmap.cpp index 6fdbbd4..25c7919 100644 --- a/src/vector/vbitmap.cpp +++ b/src/vector/vbitmap.cpp @@ -28,6 +28,7 @@ struct VBitmap::Impl { uint mHeight{0}; uint mStride{0}; uint mBytes{0}; + uint mDepth{0}; VBitmap::Format mFormat{VBitmap::Format::Invalid}; bool mOwnData; bool mRoData; @@ -38,8 +39,8 @@ struct VBitmap::Impl { mOwnData(true), mRoData(false) { - uint depth = Impl::depth(format); - uint stride = ((width * depth + 31) >> 5) << 2; // bytes per scanline (must be multiple of 4) + mDepth = depth(format); + uint stride = ((width * mDepth + 31) >> 5) << 2; // bytes per scanline (must be multiple of 4) mWidth = width; mHeight = height; @@ -64,6 +65,7 @@ struct VBitmap::Impl { mStride = bytesPerLine; mBytes = mStride * mHeight; mData = data; + mDepth = depth(format); } ~Impl() @@ -133,11 +135,21 @@ uint VBitmap::height() const return mImpl ? mImpl->height() : 0; } +uint VBitmap::depth() const +{ + return mImpl ? mImpl->mDepth : 0; +} + uchar *VBitmap::data() { return mImpl ? mImpl->data() : nullptr; } +uchar *VBitmap::data() const +{ + return mImpl ? mImpl->data() : nullptr; +} + bool VBitmap::valid() const { return mImpl ? true : false; diff --git a/src/vector/vbitmap.h b/src/vector/vbitmap.h index 8b162c2..f99b8f2 100644 --- a/src/vector/vbitmap.h +++ b/src/vector/vbitmap.h @@ -39,9 +39,11 @@ public: uint stride() const; uint width() const; uint height() const; + uint depth() const; VBitmap::Format format() const; bool valid() const; uchar * data(); + uchar * data() const; void fill(uint pixel); private: