From 310c7768b4c13d505f56c0ab2f1dc8986f4ebb7b Mon Sep 17 00:00:00 2001 From: Paul Wisbey Date: Thu, 23 Jul 2015 18:14:19 +0100 Subject: [PATCH] Keep track of Bitmap data ownership Change-Id: I812047970a845bd3436beb568f428d04d58b1a5f --- adaptors/common/adaptor-impl.cpp | 2 +- automated-tests/src/dali-adaptor-internal/image-loaders.cpp | 4 ++-- .../src/dali-adaptor-internal/utc-Dali-ImageOperations.cpp | 2 +- platform-abstractions/portable/image-operations.cpp | 4 ++-- platform-abstractions/tizen/image-loaders/image-loader.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/adaptors/common/adaptor-impl.cpp b/adaptors/common/adaptor-impl.cpp index 9feac44..90342ae 100644 --- a/adaptors/common/adaptor-impl.cpp +++ b/adaptors/common/adaptor-impl.cpp @@ -107,7 +107,7 @@ void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration ) ResourcePolicy::DataRetention dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA; if( configuration == Dali::Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS ) { - dataRetentionPolicy = ResourcePolicy::DALI_RETAINS_MESH_DATA; + dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA; } // Note, Tizen does not use DALI_RETAINS_ALL_DATA, as it can reload images from // files automatically. diff --git a/automated-tests/src/dali-adaptor-internal/image-loaders.cpp b/automated-tests/src/dali-adaptor-internal/image-loaders.cpp index 093a33c..0c0efca 100644 --- a/automated-tests/src/dali-adaptor-internal/image-loaders.cpp +++ b/automated-tests/src/dali-adaptor-internal/image-loaders.cpp @@ -111,7 +111,7 @@ void TestImageLoading( const ImageDetails& image, const LoadFunctions& functions fseek( fp, 0, 0 ); // Create a bitmap object and store a pointer to that object so it is destroyed at the end. - Dali::Integration::Bitmap * bitmap = Dali::Integration::Bitmap::New( Dali::Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN ); + Dali::Integration::Bitmap * bitmap = Dali::Integration::Bitmap::New( Dali::Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN ); Dali::Integration::BitmapPtr bitmapPtr( bitmap ); @@ -139,7 +139,7 @@ void DumpImageBufferToTempFile( std::string filename, std::string targetFilename FILE* fp = fopen( filename.c_str() , "rb" ); AutoCloseFile autoClose( fp ); - Dali::Integration::Bitmap* bitmap = Dali::Integration::Bitmap::New( Dali::Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::RETAIN ); + Dali::Integration::Bitmap* bitmap = Dali::Integration::Bitmap::New( Dali::Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN ); Dali::Integration::BitmapPtr bitmapPtr( bitmap ); const Dali::TizenPlatform::ImageLoader::Input input( fp ); diff --git a/automated-tests/src/dali-adaptor-internal/utc-Dali-ImageOperations.cpp b/automated-tests/src/dali-adaptor-internal/utc-Dali-ImageOperations.cpp index ee5cea9..37d1a9e 100644 --- a/automated-tests/src/dali-adaptor-internal/utc-Dali-ImageOperations.cpp +++ b/automated-tests/src/dali-adaptor-internal/utc-Dali-ImageOperations.cpp @@ -358,7 +358,7 @@ void TestDownscaledBitmapHasRightDimensionsAndFormat( FittingMode::Type fittingMode( FittingMode::SHRINK_TO_FIT ); SamplingMode::Type samplingMode( SamplingMode::BOX ); - Integration::BitmapPtr sourceBitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD ); + Integration::BitmapPtr sourceBitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD ); sourceBitmap->GetPackedPixelsProfile()->ReserveBuffer( format, sourceDimension, sourceDimension, sourceDimension, sourceDimension ); Integration::BitmapPtr downScaled = DownscaleBitmap( *sourceBitmap, desired, fittingMode, samplingMode ); diff --git a/platform-abstractions/portable/image-operations.cpp b/platform-abstractions/portable/image-operations.cpp index cb91949..6a95969 100644 --- a/platform-abstractions/portable/image-operations.cpp +++ b/platform-abstractions/portable/image-operations.cpp @@ -312,7 +312,7 @@ BitmapPtr MakeEmptyBitmap( Pixel::Format pixelFormat, unsigned int width, unsign DALI_ASSERT_DEBUG( Pixel::GetBytesPerPixel(pixelFormat) && "Compressed formats not supported." ); // Allocate a pixel buffer to hold the image passed in: - Integration::BitmapPtr newBitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD ); + Integration::BitmapPtr newBitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD ); newBitmap->GetPackedPixelsProfile()->ReserveBuffer( pixelFormat, width, height, width, height ); return newBitmap; } @@ -458,7 +458,7 @@ BitmapPtr CropForScaleToFill( BitmapPtr bitmap, ImageDimensions desiredDimension { const unsigned newWidth = inputWidth - 2 * columnsToTrim; const unsigned newHeight = inputHeight - 2 * scanlinesToTrim; - BitmapPtr croppedBitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::DISCARD ); + BitmapPtr croppedBitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD ); Integration::Bitmap::PackedPixelsProfile * packedView = croppedBitmap->GetPackedPixelsProfile(); DALI_ASSERT_DEBUG( packedView ); const Pixel::Format pixelFormat = bitmap->GetPixelFormat(); diff --git a/platform-abstractions/tizen/image-loaders/image-loader.cpp b/platform-abstractions/tizen/image-loaders/image-loader.cpp index de95bc9..a87f31f 100644 --- a/platform-abstractions/tizen/image-loaders/image-loader.cpp +++ b/platform-abstractions/tizen/image-loaders/image-loader.cpp @@ -268,7 +268,7 @@ bool ConvertStreamToBitmap( const ResourceType& resourceType, std::string path, header, profile ) ) { - bitmap = Bitmap::New( profile, ResourcePolicy::DISCARD ); + bitmap = Bitmap::New( profile, ResourcePolicy::OWNED_DISCARD ); DALI_LOG_SET_OBJECT_STRING( bitmap, path ); const BitmapResourceType& resType = static_cast( resourceType ); -- 2.7.4