lottie/vector: add depth() and const data() api to VBitmap class. 98/197198/1
authorsubhransu mohanty <sub.mohanty@samsung.com>
Wed, 9 Jan 2019 04:29:44 +0000 (13:29 +0900)
committersubhransu mohanty <sub.mohanty@samsung.com>
Wed, 9 Jan 2019 04:31:36 +0000 (13:31 +0900)
Change-Id: I22f16b7c9e9b38c3c115d6b16f093bfbf492afb1

src/vector/vbitmap.cpp
src/vector/vbitmap.h

index 6fdbbd4..25c7919 100644 (file)
@@ -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;
index 8b162c2..f99b8f2 100644 (file)
@@ -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: