-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
// CLASS HEADER
#include <dali/integration-api/bitmap.h>
// INTERNAL INCLUDES
#include <dali/integration-api/debug.h>
+#include <dali/integration-api/platform-abstraction.h>
+#include <dali/internal/event/common/thread-local-storage.h>
#include <dali/internal/event/images/bitmap-packed-pixel.h>
#include <dali/internal/event/images/bitmap-compressed.h>
#include <dali/internal/event/images/bitmap-external.h>
#include <dali/integration-api/gl-abstraction.h>
+#include <dali/integration-api/gl-defines.h>
namespace Dali
{
}
}
-Bitmap* Bitmap::New(const Profile profile = BITMAP_2D_PACKED_PIXELS, const bool managePixelBuffer = true)
+Bitmap* Bitmap::New( const Profile profile = BITMAP_2D_PACKED_PIXELS,
+ ResourcePolicy::Discardable discardable = ResourcePolicy::DISCARD )
{
DALI_ASSERT_DEBUG(profile == BITMAP_2D_PACKED_PIXELS || profile == BITMAP_COMPRESSED);
* scanlines past the bottom of the image in the buffer if requested.*/
case BITMAP_2D_PACKED_PIXELS:
{
- Bitmap * const bitmap = new Dali::Internal::BitmapPackedPixel(managePixelBuffer);
+ Bitmap * const bitmap = new Dali::Internal::BitmapPackedPixel( discardable );
return bitmap;
}
/** The data for the bitmap is buffered in an opaque form.*/
case BITMAP_COMPRESSED:
{
- return new Dali::Internal::BitmapCompressed(managePixelBuffer);
+ return new Dali::Internal::BitmapCompressed( discardable );
}
}
return 0;
}
-Bitmap::Bitmap( bool discardable, Dali::Integration::PixelBuffer* pixBuf)
+
+Bitmap::Bitmap( ResourcePolicy::Discardable discardable, Dali::Integration::PixelBuffer* pixBuf)
: mImageWidth(0),
mImageHeight(0),
mPixelFormat(Pixel::RGBA8888),
mHasAlphaChannel(true),
mAlphaChannelUsed(true),
mData(pixBuf),
- mDataIsOwned(discardable)
+ mDiscardable(discardable)
{
}
void Bitmap::DiscardBuffer()
{
- if ( mDataIsOwned )
+ if( mDiscardable == ResourcePolicy::DISCARD )
{
DeletePixelBuffer();
}
Bitmap::~Bitmap()
{
DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
- DiscardBuffer();
+ if( mDiscardable == ResourcePolicy::DISCARD )
+ {
+ DeletePixelBuffer();
+ }
}
/**
{
return;
}
- DALI_LOG_RESOURCE("[DELBUF] Deleting pixel buffer for Bitmap %p at address %p.\n", this, mData);
delete [] mData;
mData = NULL;
}
} //namespace Integration
} //namespace Dali
-