2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 #include <dali/internal/event/images/bitmap-compressed.h>
21 #include <dali/internal/common/core-impl.h>
22 #include <dali/integration-api/debug.h>
25 #include <dali/internal/common/core-impl.h>
26 #include <dali/integration-api/debug.h>
33 using namespace Dali::Pixel;
35 BitmapCompressed::BitmapCompressed( const bool bitmapOwnsBuffer ) : Bitmap(bitmapOwnsBuffer), mBufferSize(0)
38 BitmapCompressed::~BitmapCompressed()
40 DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
43 void BitmapCompressed::Initialize( Pixel::Format pixelFormat,
44 const unsigned int width,
45 const unsigned int height,
46 const size_t bufferSize )
48 Dali::Integration::Bitmap::Initialize( pixelFormat, width, height );
49 mBufferSize = bufferSize;
50 mAlphaChannelUsed = false; // Default to not using Alpha as we cannot scan the pixels to look for transparent pixels. A follow-up work-item and patch will add an "assume alpha present" flag to ImageAttributes.
53 Dali::Integration::PixelBuffer* BitmapCompressed::ReserveBufferOfSize( Pixel::Format pixelFormat,
54 const unsigned int width,
55 const unsigned int height,
56 const size_t bufferSize )
58 // Sanity check that a not-outrageous amount of data is being passed in (indicating a client error):
59 DALI_ASSERT_DEBUG(bufferSize < (1U << 27U) && "That is far too much compressed data."); // 128MB of compressed data == unreasonable.
60 // delete existing buffer
63 Initialize(pixelFormat, width, height, bufferSize);
65 mData = new Dali::Integration::PixelBuffer[bufferSize];
70 } //namespace Integration