mHasAlphaChannel(true),
mAlphaChannelUsed(true),
mData(pixBuf),
- mDataIsOwned(discardable)
+ mDiscardable(discardable)
{
}
void Bitmap::DiscardBuffer()
{
- if ( mDataIsOwned )
+ if ( mDiscardable )
{
DeletePixelBuffer();
}
Bitmap::~Bitmap()
{
DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
- DiscardBuffer();
+ DeletePixelBuffer();
}
/**
void DiscardBuffer();
/**
- * @return True if the buffer of pixel data is owned by this Bitmap itself,
- * or false if the buffer is owned by an external component.
- **/
- bool BufferIsOwned() const
+ * Check if the pixel buffer can be discarded
+ * @return true if the pixel buffer can be discarded
+ */
+ bool IsDiscardable() const
{
- return mDataIsOwned;
+ return mDiscardable;
}
/**
private:
- bool mDataIsOwned; ///< Should delete the buffer when discard buffer is called.
+ bool mDiscardable; ///< Should delete the buffer when discard buffer is called.
Bitmap(const Bitmap& other); ///< defined private to prevent use
Bitmap& operator = (const Bitmap& other); ///< defined private to prevent use
Pixel::Format pixelFormat,
unsigned int bufferWidth,
unsigned int bufferHeight)
-: BitmapPackedPixel(false, pixBuf)
+: BitmapPackedPixel(false, NULL/*pixBuf is externally owned*/),
+ mExternalData(pixBuf)
{
mImageWidth = width;
mImageHeight = height;
return NULL;
}
+ /**
+ * Get the pixel buffer
+ * @return The buffer. You can modify its contents.
+ */
+ virtual Dali::Integration::PixelBuffer* GetBuffer()
+ {
+ return mExternalData;
+ }
+
protected:
/**
* A reference counted object may only be deleted by calling Unreference()
virtual ~BitmapExternal();
private:
+
+ Dali::Integration::PixelBuffer* mExternalData; ///< Externally owned pixel data
+
+private:
BitmapExternal(); ///< defined private to prevent use
BitmapExternal(const BitmapExternal& other); ///< defined private to prevent use
BitmapExternal& operator = (const BitmapExternal& other); ///< defined private to prevent use
return ticket;
}
-ImageTicketPtr ResourceClient::AllocateBitmapImage ( unsigned int width,
- unsigned int height,
- unsigned int bufferWidth,
- unsigned int bufferHeight,
- Pixel::Format pixelformat )
-{
- Bitmap * const bitmap = Bitmap::New(Bitmap::BITMAP_2D_PACKED_PIXELS, true); ///< Not exception safe.
- Bitmap::PackedPixelsProfile * const packedBitmap = bitmap->GetPackedPixelsProfile();
+ImageTicketPtr ResourceClient::AllocateBitmapImage( unsigned int width,
+ unsigned int height,
+ unsigned int bufferWidth,
+ unsigned int bufferHeight,
+ Pixel::Format pixelformat )
+{
+ Bitmap* const bitmap = Bitmap::New( Bitmap::BITMAP_2D_PACKED_PIXELS, false/*buffer is available via public-api, therefore not discardable*/ );
+ Bitmap::PackedPixelsProfile* const packedBitmap = bitmap->GetPackedPixelsProfile();
DALI_ASSERT_DEBUG(packedBitmap);
packedBitmap->ReserveBuffer(pixelformat, width, height, bufferWidth, bufferHeight);