Add IsAlphaPreMultiplied() for checking pixel-buffer is premultiplied 27/204327/5
authorSunghyun kim <scholb.kim@samsung.com>
Tue, 23 Apr 2019 06:15:48 +0000 (15:15 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Mon, 10 Jun 2019 04:28:41 +0000 (04:28 +0000)
Change-Id: If0b22622a05eaef386a916df3fdb0026496387fb

dali/devel-api/adaptor-framework/pixel-buffer.cpp
dali/devel-api/adaptor-framework/pixel-buffer.h
dali/internal/imaging/common/pixel-buffer-impl.cpp
dali/internal/imaging/common/pixel-buffer-impl.h

index 8ba24a0..94af7f8 100755 (executable)
@@ -136,6 +136,11 @@ bool PixelBuffer::Rotate( Degree angle )
   return GetImplementation(*this).Rotate( angle );
 }
 
+bool PixelBuffer::IsAlphaPreMultiplied() const
+{
+  return GetImplementation(*this).IsAlphaPreMultiplied();
+}
+
 } // namespace Devel
 
 } // namespace Dali
index 449bc02..2a9add4 100755 (executable)
@@ -242,6 +242,12 @@ public:
    */
   bool Rotate( Degree angle );
 
+  /**
+   * @brief Returns pixel-buffer is premultiplied or not.
+   * @return true if alpha is pre-multiplied.
+   */
+  bool IsAlphaPreMultiplied() const;
+
 public:
 
   /**
index 85c5c8a..7490bf4 100755 (executable)
@@ -52,7 +52,8 @@ PixelBuffer::PixelBuffer( unsigned char* buffer,
   mBufferSize( bufferSize ),
   mWidth( width ),
   mHeight( height ),
-  mPixelFormat( pixelFormat )
+  mPixelFormat( pixelFormat ),
+  mPreMultiplied( false )
 {
 }
 
@@ -466,6 +467,12 @@ void PixelBuffer::MultiplyColorByAlpha()
       pixel += bytesPerPixel;
     }
   }
+  mPreMultiplied = true;
+}
+
+bool PixelBuffer::IsAlphaPreMultiplied() const
+{
+  return mPreMultiplied;
 }
 
 }// namespace Adaptor
index d912022..b0a0bdc 100755 (executable)
@@ -222,6 +222,11 @@ public:
    */
   bool Rotate( Degree angle );
 
+  /**
+   * @copydoc Devel::PixelBuffer::IsAlphaPreMultiplied()
+   */
+  bool IsAlphaPreMultiplied() const;
+
 private:
   /*
    * Undefined copy constructor.
@@ -283,6 +288,7 @@ private:
   unsigned int                    mWidth;            ///< Buffer width in pixels
   unsigned int                    mHeight;           ///< Buffer height in pixels
   Pixel::Format                   mPixelFormat;      ///< Pixel format
+  bool                            mPreMultiplied; ///< PreMultiplied
 };
 
 } // namespace Adaptor