Rename BitmapImage as BufferImage 09/35709/7
authorXiangyin Ma <x1.ma@samsung.com>
Mon, 23 Feb 2015 16:00:47 +0000 (16:00 +0000)
committerXiangyin Ma <x1.ma@samsung.com>
Wed, 25 Feb 2015 13:31:44 +0000 (13:31 +0000)
Change-Id: I5ea9d81cb7581103b723eae31ad64b660179688c

45 files changed:
automated-tests/src/dali/CMakeLists.txt
automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.cpp
automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.h
automated-tests/src/dali/utc-Dali-Actor.cpp
automated-tests/src/dali/utc-Dali-Atlas.cpp
automated-tests/src/dali/utc-Dali-BitmapImage.cpp [deleted file]
automated-tests/src/dali/utc-Dali-BufferImage.cpp [new file with mode: 0644]
automated-tests/src/dali/utc-Dali-CameraActor.cpp
automated-tests/src/dali/utc-Dali-Context.cpp
automated-tests/src/dali/utc-Dali-HitTestAlgorithm.cpp
automated-tests/src/dali/utc-Dali-ImageActor.cpp
automated-tests/src/dali/utc-Dali-Layer.cpp
automated-tests/src/dali/utc-Dali-MeshActor.cpp
automated-tests/src/dali/utc-Dali-RenderTask.cpp
automated-tests/src/dali/utc-Dali-RenderableActor.cpp
automated-tests/src/dali/utc-Dali-Scripting.cpp
automated-tests/src/dali/utc-Dali-ShaderEffect.cpp
dali/internal/event/actors/image-actor-impl.cpp
dali/internal/event/images/atlas-impl.cpp
dali/internal/event/images/atlas-impl.h
dali/internal/event/images/bitmap-image-impl.cpp [deleted file]
dali/internal/event/images/bitmap-image-impl.h [deleted file]
dali/internal/event/images/buffer-image-impl.cpp [new file with mode: 0644]
dali/internal/event/images/buffer-image-impl.h [new file with mode: 0644]
dali/internal/event/images/nine-patch-image-impl.cpp
dali/internal/event/images/nine-patch-image-impl.h
dali/internal/file.list
dali/internal/render/common/texture-cache-dispatcher.h
dali/internal/render/gl-resources/compressed-bitmap-texture.h
dali/internal/update/resources/resource-manager.h
dali/public-api/dali-core.h
dali/public-api/file.list
dali/public-api/images/atlas.cpp
dali/public-api/images/atlas.h
dali/public-api/images/bitmap-image.cpp [deleted file]
dali/public-api/images/bitmap-image.h [deleted file]
dali/public-api/images/buffer-image.cpp [new file with mode: 0644]
dali/public-api/images/buffer-image.h [new file with mode: 0644]
dali/public-api/images/glyph-image.cpp
dali/public-api/images/image.h
dali/public-api/images/nine-patch-image.cpp
dali/public-api/images/nine-patch-image.h
dali/public-api/images/pixel.h
dali/public-api/scripting/scripting.cpp
dali/public-api/scripting/scripting.h

index fda8729fb6e92461fced9b8dd2f9a28df3b5ee74..e4c4990640b162df9f77a10410619cd63d1a3561 100644 (file)
@@ -15,7 +15,7 @@ SET(TC_SOURCES
         utc-Dali-Any.cpp
         utc-Dali-Atlas.cpp
         utc-Dali-BaseHandle.cpp
-        utc-Dali-BitmapImage.cpp
+        utc-Dali-BufferImage.cpp
         utc-Dali-CameraActor.cpp
         utc-Dali-Character.cpp
         utc-Dali-Constraint.cpp
index 2e2f201356f0a4c099976b8cc4f15ddb049f67cd..5fed45cf417bcd465ef5db59507981731e7b131e 100644 (file)
@@ -323,9 +323,9 @@ void ConstraintAppliedCheck::CheckSignalNotReceived()
   }
 }
 
-BitmapImage CreateBitmapImage()
+BufferImage CreateBufferImage()
 {
-  BitmapImage image = BitmapImage::New(4,4,Pixel::RGBA8888);
+  BufferImage image = BufferImage::New(4,4,Pixel::RGBA8888);
 
   PixelBuffer* pixbuf = image.GetBuffer();
 
index 13db421579caa63f19c05da96769e1ab04c78464..33cca5e51e623316e1ce89ddf7b71d6865002d85 100644 (file)
@@ -395,7 +395,7 @@ struct DefaultFunctionCoverage
 };
 
 
-// Helper to Create bitmap image
-BitmapImage CreateBitmapImage();
+// Helper to Create buffer image
+BufferImage CreateBufferImage();
 
 #endif // __DALI_TEST_SUITE_UTILS_H__
index b8ed2bac1fa155d7f058e32383d7a8921dbe120e..43c929cffdd4baf64ab59df070dd75dfa14f4a7d 100644 (file)
@@ -2804,9 +2804,9 @@ int UtcDaliActorSetDrawModeOverlayRender(void)
   ids.push_back( 10 );  // third rendered actor
   app.GetGlAbstraction().SetNextTextureIds( ids );
 
-  BitmapImage imageA = BitmapImage::New(16, 16);
-  BitmapImage imageB = BitmapImage::New(16, 16);
-  BitmapImage imageC = BitmapImage::New(16, 16);
+  BufferImage imageA = BufferImage::New(16, 16);
+  BufferImage imageB = BufferImage::New(16, 16);
+  BufferImage imageC = BufferImage::New(16, 16);
   ImageActor a = ImageActor::New( imageA );
   ImageActor b = ImageActor::New( imageB );
   ImageActor c = ImageActor::New( imageC );
@@ -2861,8 +2861,8 @@ int UtcDaliActorSetDrawModeOverlayHitTest(void)
   TestApplication app;
   tet_infoline(" UtcDaliActorSetDrawModeOverlayHitTest");
 
-  BitmapImage imageA = BitmapImage::New(16, 16);
-  BitmapImage imageB = BitmapImage::New(16, 16);
+  BufferImage imageA = BufferImage::New(16, 16);
+  BufferImage imageB = BufferImage::New(16, 16);
   ImageActor a = ImageActor::New( imageA );
   ImageActor b = ImageActor::New( imageB );
 
index e10032fd9c04272f6f5aa9e5683b4b2f1910d569..5bfeb632df82fe93f6bffeeaaa69cea1cefc66fd 100644 (file)
@@ -61,7 +61,7 @@ int UtcDaliAtlasUpload01(void)
 
   // Using correct pixel format
   PixelBuffer* buffer = new PixelBuffer[16 * 16];
-  BitmapImage image = BitmapImage::New( buffer, 16, 16, Pixel::RGBA8888 );
+  BufferImage image = BufferImage::New( buffer, 16, 16, Pixel::RGBA8888 );
 
   DALI_TEST_CHECK( atlas.Upload( image, 0, 0 ) );
 
@@ -78,7 +78,7 @@ int UtcDaliAtlasUpload02(void)
 
   // Using INCORRECT pixel format
   PixelBuffer* buffer = new PixelBuffer[16 * 16];
-  BitmapImage image = BitmapImage::New( buffer, 16, 16, Pixel::A8 );
+  BufferImage image = BufferImage::New( buffer, 16, 16, Pixel::A8 );
 
   DALI_TEST_CHECK( !atlas.Upload( image, 0, 0 ) );
 
@@ -95,7 +95,7 @@ int UtcDaliAtlasUpload03(void)
 
   // Using image too big for atlas
   PixelBuffer* buffer = new PixelBuffer[16 * 16];
-  BitmapImage image = BitmapImage::New( buffer, 16, 16, Pixel::RGBA8888 );
+  BufferImage image = BufferImage::New( buffer, 16, 16, Pixel::RGBA8888 );
 
   DALI_TEST_CHECK( !atlas.Upload( image, 0, 0 ) );
 
@@ -112,7 +112,7 @@ int UtcDaliAtlasUpload04(void)
 
   // Using valid offsets
   PixelBuffer* buffer = new PixelBuffer[16 * 16];
-  BitmapImage image = BitmapImage::New( buffer, 16, 16, Pixel::RGBA8888 );
+  BufferImage image = BufferImage::New( buffer, 16, 16, Pixel::RGBA8888 );
 
   DALI_TEST_CHECK( atlas.Upload( image,  0,  0 ) );
   DALI_TEST_CHECK( atlas.Upload( image, 16,  0 ) );
@@ -132,7 +132,7 @@ int UtcDaliAtlasUpload05(void)
 
   // Using invalid offsets
   PixelBuffer* buffer = new PixelBuffer[16 * 16];
-  BitmapImage image = BitmapImage::New( buffer, 16, 16, Pixel::RGBA8888 );
+  BufferImage image = BufferImage::New( buffer, 16, 16, Pixel::RGBA8888 );
 
   DALI_TEST_CHECK( !atlas.Upload( image,  0, 17 ) );
   DALI_TEST_CHECK( !atlas.Upload( image, 17,  0 ) );
diff --git a/automated-tests/src/dali/utc-Dali-BitmapImage.cpp b/automated-tests/src/dali/utc-Dali-BitmapImage.cpp
deleted file mode 100644 (file)
index b9af021..0000000
+++ /dev/null
@@ -1,515 +0,0 @@
-/*
- * 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.
- *
- */
-
-#include <iostream>
-#include <algorithm>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
-
-using std::max;
-using namespace Dali;
-
-void utc_dali_bitmap_image_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void utc_dali_bitmap_image_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-int UtcDaliBitmapImageNew01(void)
-{
-  TestApplication application;
-
-  tet_infoline("UtcDaliBitmapImageNew01 - BitmapImage::New(unsigned int, unsigned int, Pixel::Format)");
-
-  // invoke default handle constructor
-  BitmapImage image;
-
-  // initialise handle
-  image = BitmapImage::New(16, 16);
-  application.SendNotification();
-  application.Render(16);
-  application.Render(16);
-  application.SendNotification();
-
-  DALI_TEST_CHECK( image.GetWidth() == 16);
-  END_TEST;
-}
-
-int UtcDaliBitmapImageNew02(void)
-{
-  TestApplication application;
-
-  tet_infoline("UtcDaliBitmapImageNew02 - BitmapImage::New(PixelBuffer*, unsigned int, unsigned int, Pixel::Format, unsigned int)");
-
-  PixelBuffer* buffer = new PixelBuffer[16 * 16];
-  BitmapImage image = BitmapImage::New(buffer, 16, 16, Pixel::A8);
-  application.SendNotification();
-  application.Render(16);
-  application.Render(16);
-  application.SendNotification();
-
-  DALI_TEST_CHECK( image.GetWidth() == 16);
-
-  delete [] buffer;
-  END_TEST;
-}
-
-int UtcDaliBitmapImageNewWithPolicy01(void)
-{
-  TestApplication application;
-
-  tet_infoline("UtcDaliBitmapImageNewWithPolicy01 - BitmapImage::New(unsigned int, unsigned int, Pixel::Format, LoadPolicy, ReleasePolicy)");
-
-  // Force texture id's
-  std::vector<GLuint> ids;
-  ids.push_back( 23 );
-  application.GetGlAbstraction().SetNextTextureIds( ids );
-
-  // invoke default handle constructor
-  BitmapImage image;
-
-  // initialise handle
-  image = BitmapImage::New(16, 16, Pixel::A8, Image::UNUSED);
-  application.SendNotification();
-  application.Render(16);
-  application.Render(16);
-  application.SendNotification();
-
-  DALI_TEST_CHECK( image.GetWidth() == 16);
-  ImageActor actor = ImageActor::New(image);
-  Stage::GetCurrent().Add(actor);
-
-  application.SendNotification();
-  application.Render(16);
-  // testing ReleasePolicy::Unused
-  // fake loading image
-  application.Render(16);
-  application.SendNotification();
-
-  DALI_TEST_CHECK ( !application.GetGlAbstraction().CheckTextureDeleted(23) );
-
-  // discard texture when actor comes off stage
-  Stage::GetCurrent().Remove(actor);
-  application.Render(16);
-  application.SendNotification();
-  application.Render(16);
-  application.SendNotification();
-  DALI_TEST_CHECK ( application.GetGlAbstraction().CheckTextureDeleted(23) );
-  END_TEST;
-}
-
-int UtcDaliBitmapImageNewWithPolicy02(void)
-{
-  TestApplication application;
-
-  tet_infoline("UtcDaliBitmapImageNewWithPolicy02 - BitmapImage::New(PixelBuffer*, unsigned int, unsigned int, Pixel::Format, unsigned int, ReleasePolicy)");
-
-  // Force texture id's
-  std::vector<GLuint> ids;
-  ids.push_back( 23 );
-  application.GetGlAbstraction().SetNextTextureIds( ids );
-
-  PixelBuffer* buffer = new PixelBuffer[16 * 16];
-  BitmapImage image = BitmapImage::New(buffer, 16, 16, Pixel::A8, 16, Image::UNUSED);
-  application.SendNotification();
-  application.Render(16);
-  application.Render(16);
-  application.SendNotification();
-
-  DALI_TEST_CHECK( image.GetWidth() == 16);
-  ImageActor actor = ImageActor::New(image);
-  Stage::GetCurrent().Add(actor);
-
-  application.SendNotification();
-  application.Render(16);
-  // testing ReleasePolicy::Unused
-  // fake loading image
-  application.Render(16);
-  application.SendNotification();
-
-  DALI_TEST_CHECK ( !application.GetGlAbstraction().CheckTextureDeleted(23) );
-
-  // discard texture when actor comes off stage
-  Stage::GetCurrent().Remove(actor);
-  application.Render(16);
-  application.SendNotification();
-  application.Render(16);
-  application.SendNotification();
-  DALI_TEST_CHECK ( application.GetGlAbstraction().CheckTextureDeleted(23) );
-  END_TEST;
-}
-
-int UtcDaliBitmapImageDownCast(void)
-{
-  TestApplication application;
-  tet_infoline("Testing Dali::BitmapImage::DownCast()");
-
-  BitmapImage bitmap = BitmapImage::New(1, 1, Dali::Pixel::BGRA8888);
-  ImageActor imageActor = ImageActor::New(bitmap);
-  application.SendNotification();
-  application.Render(16);
-  application.Render(16);
-  application.SendNotification();
-
-  Image image = imageActor.GetImage();
-  BitmapImage bitmapImage = BitmapImage::DownCast( image );
-
-  DALI_TEST_CHECK(bitmapImage);
-  END_TEST;
-}
-
-int UtcDaliBitmapImageDownCast2(void)
-{
-  TestApplication application;
-  tet_infoline("Testing Dali::BitmapImage::DownCast()");
-
-  Image image = ResourceImage::New("IncorrectImageName");
-  ImageActor imageActor = ImageActor::New(image);
-  application.SendNotification();
-  application.Render(16);
-  application.Render(16);
-  application.SendNotification();
-
-  Image image1 = imageActor.GetImage();
-
-  BitmapImage bitmapImage = BitmapImage::DownCast( image1 );
-  DALI_TEST_CHECK(!bitmapImage);
-
-  Actor unInitialzedActor;
-  bitmapImage = BitmapImage::DownCast( unInitialzedActor );
-  DALI_TEST_CHECK(!bitmapImage);
-  END_TEST;
-}
-
-int UtcDaliBitmapImageWHITE(void)
-{
-  TestApplication application;
-
-  tet_infoline("UtcDaliBitmapImageWHITE - BitmapImage::WHITE()");
-
-  BitmapImage image = BitmapImage::WHITE();               // creates a 1x1 RGBA white pixel
-  application.SendNotification();
-  application.Render(16);
-  application.Render(16);
-  application.SendNotification();
-
-  PixelBuffer* buffer = image.GetBuffer();
-
-  DALI_TEST_CHECK( image.GetWidth() == 1 &&               // 1 pixel wide
-                   buffer != NULL &&                      // valid buffer
-                   *buffer == 0xff);                       // r component is 255
-  END_TEST;
-}
-
-int UtcDaliBitmapImageGetBuffer(void)
-{
-  TestApplication application;
-
-  tet_infoline("UtcDaliBitmapImageGetBuffer");
-
-  BitmapImage image = BitmapImage::WHITE();               // creates a 1x1 RGBA white pixel
-
-  PixelBuffer* buffer = image.GetBuffer();
-  application.SendNotification();
-  application.Render();
-  application.Render();
-  application.SendNotification();
-
-  DALI_TEST_CHECK( image.GetWidth() == 1 &&               // 1 pixel wide
-                   buffer != NULL &&                      // valid buffer
-                   *((unsigned int*)buffer) == 0xffffffff); // all component are 255
-  END_TEST;
-}
-
-int UtcDaliBitmapImageGetBufferSize(void)
-{
-  TestApplication application;
-
-  tet_infoline("UtcDaliBitmapImageGetBufferSize");
-
-  BitmapImage image = BitmapImage::WHITE();               // creates a 1x1 RGBA white pixel
-  application.SendNotification();
-  application.Render();
-  application.Render();
-  application.SendNotification();
-
-  PixelBuffer* buffer = image.GetBuffer();
-  unsigned int bufferSize = image.GetBufferSize();
-  unsigned int pixelSize = Pixel::GetBytesPerPixel(image.GetPixelFormat());
-
-  DALI_TEST_CHECK( image.GetWidth() == 1 &&               // 1 pixel wide
-                   buffer != NULL &&                      // valid buffer
-                   bufferSize == pixelSize);              // r component is 255
-  END_TEST;
-}
-
-int UtcDaliBitmapImageGetBufferStride(void)
-{
-  TestApplication application;
-
-  tet_infoline("UtcDaliBitmapImageGetBufferStride");
-
-  BitmapImage image = BitmapImage::WHITE();               // creates a 1x1 RGBA white pixel
-  application.SendNotification();
-  application.Render();
-  application.Render();
-  application.SendNotification();
-
-  unsigned int pixelSize = Pixel::GetBytesPerPixel(image.GetPixelFormat());
-  unsigned int bufferStride = image.GetBufferStride();
-  DALI_TEST_CHECK( bufferStride == pixelSize );
-  DALI_TEST_CHECK( !image.IsDataExternal() );
-
-  PixelBuffer* buffer = new PixelBuffer[20 * 16];
-  image = BitmapImage::New(buffer, 16, 16, Pixel::A8, 20);
-  application.SendNotification();
-  application.Render(16);
-  application.Render(16);
-  application.SendNotification();
-
-  bufferStride = image.GetBufferStride();
-
-  DALI_TEST_CHECK( bufferStride == 20);
-  DALI_TEST_CHECK( image.IsDataExternal() );
-
-  delete [] buffer;
-  END_TEST;
-}
-
-int UtcDaliBitmapImageGetPixelFormat(void)
-{
-  TestApplication application;
-
-  tet_infoline("UtcDaliBitmapImageGetPixelFormat");
-
-  // Set pixel format to a non-default
-  BitmapImage image = BitmapImage::New( 16, 16, Pixel::A8 );
-  application.SendNotification();
-  application.Render(16);
-  application.Render(16);
-  application.SendNotification();
-
-  DALI_TEST_CHECK( image.GetPixelFormat() == Pixel::A8 );
-  END_TEST;
-}
-
-
-int UtcDaliBitmapImageIsDataExternal(void)
-{
-  TestApplication application;
-
-  tet_infoline("UtcDaliBitmapImageIsDataExternal - BitmapImage::IsDataExternal()");
-
-  PixelBuffer* buffer = new PixelBuffer[16 * 16];
-  BitmapImage image = BitmapImage::New(buffer, 16, 16, Pixel::A8);
-  application.SendNotification();
-  application.Render();
-  application.Render();
-  application.SendNotification();
-
-  DALI_TEST_CHECK( image.IsDataExternal() );
-  END_TEST;
-}
-
-namespace
-{
-
-static bool SignalReceived;
-static void ImageUploaded(Image image)
-{
-  tet_infoline("Received image uploaded signal");
-  SignalReceived = true;
-}
-}
-
-int UtcDaliBitmapImageUpdate01(void)
-{
-  TestApplication application;
-
-  tet_infoline("UtcDaliBitmapImageUpdate01 - single empty rect");
-
-  PixelBuffer* buffer = new PixelBuffer[16 * 16];
-
-  BitmapImage image = BitmapImage::New(buffer, 16, 16, Pixel::A8);
-  ImageActor actor = ImageActor::New(image);
-  Stage::GetCurrent().Add(actor);
-  actor.SetVisible(true);
-
-  SignalReceived = false;
-  image.UploadedSignal().Connect( ImageUploaded );
-
-  std::vector<GLuint> ids;
-  ids.push_back(200);
-  ids.push_back(201);
-  ids.push_back(202);
-  application.GetGlAbstraction().SetNextTextureIds(ids);
-
-  // Allow actor to be staged and rendered
-  application.SendNotification();
-  application.Render(0);
-  application.Render(16);
-  application.SendNotification();
-  application.Render(16);
-  application.SendNotification();
-
-  DALI_TEST_CHECK( image.IsDataExternal() );
-  application.GetGlAbstraction().EnableTextureCallTrace(true);
-
-  image.Update();//(RectArea()); // notify Core that the image has been updated
-  application.SendNotification();
-  application.Render(16);
-  application.Render(16);
-  application.SendNotification();
-  application.Render(16);
-  application.SendNotification();
-
-  const TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
-  DALI_TEST_EQUALS( callStack.TestMethodAndParams(0, "TexSubImage2D", "0, 0, 16, 16"), true, TEST_LOCATION);
-
-  DALI_TEST_CHECK( SignalReceived == true );
-  SignalReceived = false;
-  END_TEST;
-}
-
-int UtcDaliBitmapImageUpdate02(void)
-{
-  TestApplication application;
-
-  tet_infoline("UtcDaliBitmapImageUpdate02 - Multiple rects");
-
-  PixelBuffer* buffer = new PixelBuffer[16 * 16];
-  BitmapImage image = BitmapImage::New(buffer, 16, 16, Pixel::A8);
-  ImageActor actor = ImageActor::New(image);
-  Stage::GetCurrent().Add(actor);
-  actor.SetVisible(true);
-
-  SignalReceived = false;
-  image.UploadedSignal().Connect( ImageUploaded );
-
-  std::vector<GLuint> ids;
-  ids.push_back(200);
-  ids.push_back(201);
-  ids.push_back(202);
-  application.GetGlAbstraction().SetNextTextureIds(ids);
-
-  application.SendNotification();
-  application.Render(0);
-  application.Render(16);
-  application.SendNotification();
-  application.Render(16);
-  application.SendNotification();
-
-  DALI_TEST_CHECK( image.IsDataExternal() );
-  application.GetGlAbstraction().EnableTextureCallTrace(true);
-
-  image.Update(RectArea(9,9,5,5));              // notify Core that the image has been updated
-
-  application.SendNotification();
-  application.Render(16);
-  application.Render(16);
-  application.SendNotification();
-  application.Render(16);
-  application.SendNotification();
-
-  const TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
-  DALI_TEST_EQUALS( callStack.TestMethodAndParams(0, "TexSubImage2D", "9, 9, 5, 1"), true, TEST_LOCATION);
-  DALI_TEST_EQUALS( callStack.TestMethodAndParams(1, "TexSubImage2D", "9, 10, 5, 1"), true, TEST_LOCATION);
-  DALI_TEST_EQUALS( callStack.TestMethodAndParams(2, "TexSubImage2D", "9, 11, 5, 1"), true, TEST_LOCATION);
-  DALI_TEST_EQUALS( callStack.TestMethodAndParams(3, "TexSubImage2D", "9, 12, 5, 1"), true, TEST_LOCATION);
-  DALI_TEST_EQUALS( callStack.TestMethodAndParams(4, "TexSubImage2D", "9, 13, 5, 1"), true, TEST_LOCATION);
-
-  DALI_TEST_CHECK( SignalReceived == true );
-  SignalReceived = false;
-  END_TEST;
-}
-
-int UtcDaliBitmapImageUploadedSignal01(void)
-{
-  TestApplication application;
-
-  tet_infoline("UtcDaliBitmapImageUploadedSignal - Test that Uploaded signal is sent when image is staged");
-
-  PixelBuffer* buffer = new PixelBuffer[16 * 16];
-  BitmapImage image = BitmapImage::New(buffer, 16, 16, Pixel::A8);
-  SignalReceived = false;
-  image.UploadedSignal().Connect( ImageUploaded );
-
-  application.SendNotification();
-  application.Render(16);
-  application.Render(16);
-  application.SendNotification();
-
-  Dali::ImageActor imageActor = ImageActor::New(image);
-  Stage::GetCurrent().Add(imageActor);
-  application.SendNotification();
-  application.Render(16);
-  application.SendNotification();
-  application.Render(16);
-  application.SendNotification();
-  application.Render(16);
-  application.SendNotification();
-
-  DALI_TEST_CHECK( SignalReceived == true );
-  END_TEST;
-}
-
-int UtcDaliBitmapImageUploadedSignal02(void)
-{
-  TestApplication application;
-
-  tet_infoline("UtcDaliBitmapImageUploadedSignal - Test that Uploaded signal is sent after Update");
-
-  PixelBuffer* buffer = new PixelBuffer[16 * 16];
-  BitmapImage image = BitmapImage::New(buffer, 16, 16, Pixel::A8);
-  SignalReceived = false;
-  //ScopedConnection connection =
-  image.UploadedSignal().Connect( ImageUploaded );
-
-  application.SendNotification();
-  application.Render(16);
-  application.Render(16);
-  application.SendNotification();
-
-  Dali::ImageActor imageActor = ImageActor::New(image);
-  Stage::GetCurrent().Add(imageActor);
-  application.SendNotification();
-  application.Render(16);
-  application.SendNotification();
-  application.Render(16);
-  application.SendNotification();
-  application.Render(16);
-  application.SendNotification();
-  DALI_TEST_CHECK( SignalReceived == true );
-  SignalReceived = false;
-
-  image.Update(RectArea());              // notify Core that the whole image has been updated
-  application.SendNotification();
-  application.Render(16);
-  application.SendNotification();
-  application.Render(16);
-  application.SendNotification();
-  application.Render(16);
-  application.SendNotification();
-  DALI_TEST_CHECK( SignalReceived == true );
-  END_TEST;
-}
diff --git a/automated-tests/src/dali/utc-Dali-BufferImage.cpp b/automated-tests/src/dali/utc-Dali-BufferImage.cpp
new file mode 100644 (file)
index 0000000..bd3a05c
--- /dev/null
@@ -0,0 +1,515 @@
+/*
+ * 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.
+ *
+ */
+
+#include <iostream>
+#include <algorithm>
+
+#include <stdlib.h>
+#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
+
+using std::max;
+using namespace Dali;
+
+void utc_dali_buffer_image_startup(void)
+{
+  test_return_value = TET_UNDEF;
+}
+
+void utc_dali_buffer_image_cleanup(void)
+{
+  test_return_value = TET_PASS;
+}
+
+int UtcDaliBufferImageNew01(void)
+{
+  TestApplication application;
+
+  tet_infoline("UtcDaliBufferImageNew01 - BufferImage::New(unsigned int, unsigned int, Pixel::Format)");
+
+  // invoke default handle constructor
+  BufferImage image;
+
+  // initialise handle
+  image = BufferImage::New(16, 16);
+  application.SendNotification();
+  application.Render(16);
+  application.Render(16);
+  application.SendNotification();
+
+  DALI_TEST_CHECK( image.GetWidth() == 16);
+  END_TEST;
+}
+
+int UtcDaliBufferImageNew02(void)
+{
+  TestApplication application;
+
+  tet_infoline("UtcDaliBufferImageNew02 - BufferImage::New(PixelBuffer*, unsigned int, unsigned int, Pixel::Format, unsigned int)");
+
+  PixelBuffer* buffer = new PixelBuffer[16 * 16];
+  BufferImage image = BufferImage::New(buffer, 16, 16, Pixel::A8);
+  application.SendNotification();
+  application.Render(16);
+  application.Render(16);
+  application.SendNotification();
+
+  DALI_TEST_CHECK( image.GetWidth() == 16);
+
+  delete [] buffer;
+  END_TEST;
+}
+
+int UtcDaliBufferImageNewWithPolicy01(void)
+{
+  TestApplication application;
+
+  tet_infoline("UtcDaliBufferImageNewWithPolicy01 - BufferImage::New(unsigned int, unsigned int, Pixel::Format, LoadPolicy, ReleasePolicy)");
+
+  // Force texture id's
+  std::vector<GLuint> ids;
+  ids.push_back( 23 );
+  application.GetGlAbstraction().SetNextTextureIds( ids );
+
+  // invoke default handle constructor
+  BufferImage image;
+
+  // initialise handle
+  image = BufferImage::New(16, 16, Pixel::A8, Image::UNUSED);
+  application.SendNotification();
+  application.Render(16);
+  application.Render(16);
+  application.SendNotification();
+
+  DALI_TEST_CHECK( image.GetWidth() == 16);
+  ImageActor actor = ImageActor::New(image);
+  Stage::GetCurrent().Add(actor);
+
+  application.SendNotification();
+  application.Render(16);
+  // testing ReleasePolicy::Unused
+  // fake loading image
+  application.Render(16);
+  application.SendNotification();
+
+  DALI_TEST_CHECK ( !application.GetGlAbstraction().CheckTextureDeleted(23) );
+
+  // discard texture when actor comes off stage
+  Stage::GetCurrent().Remove(actor);
+  application.Render(16);
+  application.SendNotification();
+  application.Render(16);
+  application.SendNotification();
+  DALI_TEST_CHECK ( application.GetGlAbstraction().CheckTextureDeleted(23) );
+  END_TEST;
+}
+
+int UtcDaliBufferImageNewWithPolicy02(void)
+{
+  TestApplication application;
+
+  tet_infoline("UtcDaliBufferImageNewWithPolicy02 - BufferImage::New(PixelBuffer*, unsigned int, unsigned int, Pixel::Format, unsigned int, ReleasePolicy)");
+
+  // Force texture id's
+  std::vector<GLuint> ids;
+  ids.push_back( 23 );
+  application.GetGlAbstraction().SetNextTextureIds( ids );
+
+  PixelBuffer* buffer = new PixelBuffer[16 * 16];
+  BufferImage image = BufferImage::New(buffer, 16, 16, Pixel::A8, 16, Image::UNUSED);
+  application.SendNotification();
+  application.Render(16);
+  application.Render(16);
+  application.SendNotification();
+
+  DALI_TEST_CHECK( image.GetWidth() == 16);
+  ImageActor actor = ImageActor::New(image);
+  Stage::GetCurrent().Add(actor);
+
+  application.SendNotification();
+  application.Render(16);
+  // testing ReleasePolicy::Unused
+  // fake loading image
+  application.Render(16);
+  application.SendNotification();
+
+  DALI_TEST_CHECK ( !application.GetGlAbstraction().CheckTextureDeleted(23) );
+
+  // discard texture when actor comes off stage
+  Stage::GetCurrent().Remove(actor);
+  application.Render(16);
+  application.SendNotification();
+  application.Render(16);
+  application.SendNotification();
+  DALI_TEST_CHECK ( application.GetGlAbstraction().CheckTextureDeleted(23) );
+  END_TEST;
+}
+
+int UtcDaliBufferImageDownCast(void)
+{
+  TestApplication application;
+  tet_infoline("Testing Dali::BufferImage::DownCast()");
+
+  BufferImage bitmap = BufferImage::New(1, 1, Dali::Pixel::BGRA8888);
+  ImageActor imageActor = ImageActor::New(bitmap);
+  application.SendNotification();
+  application.Render(16);
+  application.Render(16);
+  application.SendNotification();
+
+  Image image = imageActor.GetImage();
+  BufferImage bufferImage = BufferImage::DownCast( image );
+
+  DALI_TEST_CHECK(bufferImage);
+  END_TEST;
+}
+
+int UtcDaliBufferImageDownCast2(void)
+{
+  TestApplication application;
+  tet_infoline("Testing Dali::BufferImage::DownCast()");
+
+  Image image = ResourceImage::New("IncorrectImageName");
+  ImageActor imageActor = ImageActor::New(image);
+  application.SendNotification();
+  application.Render(16);
+  application.Render(16);
+  application.SendNotification();
+
+  Image image1 = imageActor.GetImage();
+
+  BufferImage bufferImage = BufferImage::DownCast( image1 );
+  DALI_TEST_CHECK(!bufferImage);
+
+  Actor unInitialzedActor;
+  bufferImage = BufferImage::DownCast( unInitialzedActor );
+  DALI_TEST_CHECK(!bufferImage);
+  END_TEST;
+}
+
+int UtcDaliBufferImageWHITE(void)
+{
+  TestApplication application;
+
+  tet_infoline("UtcDaliBufferImageWHITE - BufferImage::WHITE()");
+
+  BufferImage image = BufferImage::WHITE();               // creates a 1x1 RGBA white pixel
+  application.SendNotification();
+  application.Render(16);
+  application.Render(16);
+  application.SendNotification();
+
+  PixelBuffer* buffer = image.GetBuffer();
+
+  DALI_TEST_CHECK( image.GetWidth() == 1 &&               // 1 pixel wide
+                   buffer != NULL &&                      // valid buffer
+                   *buffer == 0xff);                       // r component is 255
+  END_TEST;
+}
+
+int UtcDaliBufferImageGetBuffer(void)
+{
+  TestApplication application;
+
+  tet_infoline("UtcDaliBufferImageGetBuffer");
+
+  BufferImage image = BufferImage::WHITE();               // creates a 1x1 RGBA white pixel
+
+  PixelBuffer* buffer = image.GetBuffer();
+  application.SendNotification();
+  application.Render();
+  application.Render();
+  application.SendNotification();
+
+  DALI_TEST_CHECK( image.GetWidth() == 1 &&               // 1 pixel wide
+                   buffer != NULL &&                      // valid buffer
+                   *((unsigned int*)buffer) == 0xffffffff); // all component are 255
+  END_TEST;
+}
+
+int UtcDaliBufferImageGetBufferSize(void)
+{
+  TestApplication application;
+
+  tet_infoline("UtcDaliBufferImageGetBufferSize");
+
+  BufferImage image = BufferImage::WHITE();               // creates a 1x1 RGBA white pixel
+  application.SendNotification();
+  application.Render();
+  application.Render();
+  application.SendNotification();
+
+  PixelBuffer* buffer = image.GetBuffer();
+  unsigned int bufferSize = image.GetBufferSize();
+  unsigned int pixelSize = Pixel::GetBytesPerPixel(image.GetPixelFormat());
+
+  DALI_TEST_CHECK( image.GetWidth() == 1 &&               // 1 pixel wide
+                   buffer != NULL &&                      // valid buffer
+                   bufferSize == pixelSize);              // r component is 255
+  END_TEST;
+}
+
+int UtcDaliBufferImageGetBufferStride(void)
+{
+  TestApplication application;
+
+  tet_infoline("UtcDaliBufferImageGetBufferStride");
+
+  BufferImage image = BufferImage::WHITE();               // creates a 1x1 RGBA white pixel
+  application.SendNotification();
+  application.Render();
+  application.Render();
+  application.SendNotification();
+
+  unsigned int pixelSize = Pixel::GetBytesPerPixel(image.GetPixelFormat());
+  unsigned int bufferStride = image.GetBufferStride();
+  DALI_TEST_CHECK( bufferStride == pixelSize );
+  DALI_TEST_CHECK( !image.IsDataExternal() );
+
+  PixelBuffer* buffer = new PixelBuffer[20 * 16];
+  image = BufferImage::New(buffer, 16, 16, Pixel::A8, 20);
+  application.SendNotification();
+  application.Render(16);
+  application.Render(16);
+  application.SendNotification();
+
+  bufferStride = image.GetBufferStride();
+
+  DALI_TEST_CHECK( bufferStride == 20);
+  DALI_TEST_CHECK( image.IsDataExternal() );
+
+  delete [] buffer;
+  END_TEST;
+}
+
+int UtcDaliBufferImageGetPixelFormat(void)
+{
+  TestApplication application;
+
+  tet_infoline("UtcDaliBufferImageGetPixelFormat");
+
+  // Set pixel format to a non-default
+  BufferImage image = BufferImage::New( 16, 16, Pixel::A8 );
+  application.SendNotification();
+  application.Render(16);
+  application.Render(16);
+  application.SendNotification();
+
+  DALI_TEST_CHECK( image.GetPixelFormat() == Pixel::A8 );
+  END_TEST;
+}
+
+
+int UtcDaliBufferImageIsDataExternal(void)
+{
+  TestApplication application;
+
+  tet_infoline("UtcDaliBufferImageIsDataExternal - BufferImage::IsDataExternal()");
+
+  PixelBuffer* buffer = new PixelBuffer[16 * 16];
+  BufferImage image = BufferImage::New(buffer, 16, 16, Pixel::A8);
+  application.SendNotification();
+  application.Render();
+  application.Render();
+  application.SendNotification();
+
+  DALI_TEST_CHECK( image.IsDataExternal() );
+  END_TEST;
+}
+
+namespace
+{
+
+static bool SignalReceived;
+static void ImageUploaded(Image image)
+{
+  tet_infoline("Received image uploaded signal");
+  SignalReceived = true;
+}
+}
+
+int UtcDaliBufferImageUpdate01(void)
+{
+  TestApplication application;
+
+  tet_infoline("UtcDaliBufferImageUpdate01 - single empty rect");
+
+  PixelBuffer* buffer = new PixelBuffer[16 * 16];
+
+  BufferImage image = BufferImage::New(buffer, 16, 16, Pixel::A8);
+  ImageActor actor = ImageActor::New(image);
+  Stage::GetCurrent().Add(actor);
+  actor.SetVisible(true);
+
+  SignalReceived = false;
+  image.UploadedSignal().Connect( ImageUploaded );
+
+  std::vector<GLuint> ids;
+  ids.push_back(200);
+  ids.push_back(201);
+  ids.push_back(202);
+  application.GetGlAbstraction().SetNextTextureIds(ids);
+
+  // Allow actor to be staged and rendered
+  application.SendNotification();
+  application.Render(0);
+  application.Render(16);
+  application.SendNotification();
+  application.Render(16);
+  application.SendNotification();
+
+  DALI_TEST_CHECK( image.IsDataExternal() );
+  application.GetGlAbstraction().EnableTextureCallTrace(true);
+
+  image.Update();//(RectArea()); // notify Core that the image has been updated
+  application.SendNotification();
+  application.Render(16);
+  application.Render(16);
+  application.SendNotification();
+  application.Render(16);
+  application.SendNotification();
+
+  const TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
+  DALI_TEST_EQUALS( callStack.TestMethodAndParams(0, "TexSubImage2D", "0, 0, 16, 16"), true, TEST_LOCATION);
+
+  DALI_TEST_CHECK( SignalReceived == true );
+  SignalReceived = false;
+  END_TEST;
+}
+
+int UtcDaliBufferImageUpdate02(void)
+{
+  TestApplication application;
+
+  tet_infoline("UtcDaliBufferImageUpdate02 - Multiple rects");
+
+  PixelBuffer* buffer = new PixelBuffer[16 * 16];
+  BufferImage image = BufferImage::New(buffer, 16, 16, Pixel::A8);
+  ImageActor actor = ImageActor::New(image);
+  Stage::GetCurrent().Add(actor);
+  actor.SetVisible(true);
+
+  SignalReceived = false;
+  image.UploadedSignal().Connect( ImageUploaded );
+
+  std::vector<GLuint> ids;
+  ids.push_back(200);
+  ids.push_back(201);
+  ids.push_back(202);
+  application.GetGlAbstraction().SetNextTextureIds(ids);
+
+  application.SendNotification();
+  application.Render(0);
+  application.Render(16);
+  application.SendNotification();
+  application.Render(16);
+  application.SendNotification();
+
+  DALI_TEST_CHECK( image.IsDataExternal() );
+  application.GetGlAbstraction().EnableTextureCallTrace(true);
+
+  image.Update(RectArea(9,9,5,5));              // notify Core that the image has been updated
+
+  application.SendNotification();
+  application.Render(16);
+  application.Render(16);
+  application.SendNotification();
+  application.Render(16);
+  application.SendNotification();
+
+  const TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
+  DALI_TEST_EQUALS( callStack.TestMethodAndParams(0, "TexSubImage2D", "9, 9, 5, 1"), true, TEST_LOCATION);
+  DALI_TEST_EQUALS( callStack.TestMethodAndParams(1, "TexSubImage2D", "9, 10, 5, 1"), true, TEST_LOCATION);
+  DALI_TEST_EQUALS( callStack.TestMethodAndParams(2, "TexSubImage2D", "9, 11, 5, 1"), true, TEST_LOCATION);
+  DALI_TEST_EQUALS( callStack.TestMethodAndParams(3, "TexSubImage2D", "9, 12, 5, 1"), true, TEST_LOCATION);
+  DALI_TEST_EQUALS( callStack.TestMethodAndParams(4, "TexSubImage2D", "9, 13, 5, 1"), true, TEST_LOCATION);
+
+  DALI_TEST_CHECK( SignalReceived == true );
+  SignalReceived = false;
+  END_TEST;
+}
+
+int UtcDaliBufferImageUploadedSignal01(void)
+{
+  TestApplication application;
+
+  tet_infoline("UtcDaliBufferImageUploadedSignal - Test that Uploaded signal is sent when image is staged");
+
+  PixelBuffer* buffer = new PixelBuffer[16 * 16];
+  BufferImage image = BufferImage::New(buffer, 16, 16, Pixel::A8);
+  SignalReceived = false;
+  image.UploadedSignal().Connect( ImageUploaded );
+
+  application.SendNotification();
+  application.Render(16);
+  application.Render(16);
+  application.SendNotification();
+
+  Dali::ImageActor imageActor = ImageActor::New(image);
+  Stage::GetCurrent().Add(imageActor);
+  application.SendNotification();
+  application.Render(16);
+  application.SendNotification();
+  application.Render(16);
+  application.SendNotification();
+  application.Render(16);
+  application.SendNotification();
+
+  DALI_TEST_CHECK( SignalReceived == true );
+  END_TEST;
+}
+
+int UtcDaliBufferImageUploadedSignal02(void)
+{
+  TestApplication application;
+
+  tet_infoline("UtcDaliBufferImageUploadedSignal - Test that Uploaded signal is sent after Update");
+
+  PixelBuffer* buffer = new PixelBuffer[16 * 16];
+  BufferImage image = BufferImage::New(buffer, 16, 16, Pixel::A8);
+  SignalReceived = false;
+  //ScopedConnection connection =
+  image.UploadedSignal().Connect( ImageUploaded );
+
+  application.SendNotification();
+  application.Render(16);
+  application.Render(16);
+  application.SendNotification();
+
+  Dali::ImageActor imageActor = ImageActor::New(image);
+  Stage::GetCurrent().Add(imageActor);
+  application.SendNotification();
+  application.Render(16);
+  application.SendNotification();
+  application.Render(16);
+  application.SendNotification();
+  application.Render(16);
+  application.SendNotification();
+  DALI_TEST_CHECK( SignalReceived == true );
+  SignalReceived = false;
+
+  image.Update(RectArea());              // notify Core that the whole image has been updated
+  application.SendNotification();
+  application.Render(16);
+  application.SendNotification();
+  application.Render(16);
+  application.SendNotification();
+  application.Render(16);
+  application.SendNotification();
+  DALI_TEST_CHECK( SignalReceived == true );
+  END_TEST;
+}
index 2d57e4827e50931b73e8c256eeda425b4fad030a..5ee9ee0013765aa0c8952ee4a16291d3214fc7cd 100644 (file)
@@ -511,7 +511,7 @@ int UtcDaliCameraActorModelView(void)
   TestApplication application;
   tet_infoline("Testing Dali::CameraActor Test view application");
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   ImageActor actor = ImageActor::New( image );
   actor.SetSize( 100.0f, 100.0f );
@@ -734,7 +734,7 @@ int UtcDaliCameraActorReadProjectionMatrix(void)
   application.Render(0);
   application.Render();
   application.SendNotification();
-  Image image = CreateBitmapImage();
+  Image image = CreateBufferImage();
   ImageActor imageActor = ImageActor::New( image );
   imageActor.SetSize(100.0f, 100.0f);
   Stage::GetCurrent().Add(imageActor);
index db5059e71eb3a4815799fe89f51d85af4b9702fe..042a86477c1cb27e3267cee397d43cb768d33d96 100644 (file)
@@ -45,9 +45,9 @@ enum TestAttribType
 };
 
 // Create bitmap image
-static BitmapImage CreateBitmapImage()
+static BufferImage CreateBufferImage()
 {
-  BitmapImage image = BitmapImage::New(4,4,Pixel::RGBA8888);
+  BufferImage image = BufferImage::New(4,4,Pixel::RGBA8888);
 
   return image;
 }
@@ -90,7 +90,7 @@ static LightActor CreateLight()
 
 static ImageActor CreateImageActor()
 {
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
   ImageActor actor = ImageActor::New( image );
   actor.SetSize( 100.0f, 100.0f );
   actor.SetName("Test ImageActor");
index c37a905b875d95d653515b4a1527d3a2470b536e..0e0461fa916a8377ba69fff616ad72012440ad2d 100644 (file)
@@ -378,7 +378,7 @@ int UtcDaliHitTestAlgorithmStencil(void)
   stage.Add( layer );
 
   // Create a stencil and add that to the layer
-  Actor stencil = ImageActor::New(Dali::BitmapImage::WHITE() );
+  Actor stencil = ImageActor::New(Dali::BufferImage::WHITE() );
   stencil.SetAnchorPoint( AnchorPoint::TOP_LEFT );
   stencil.SetParentOrigin( ParentOrigin::TOP_LEFT );
   stencil.SetSize( 50.0f, 50.0f );
index e9331e2b2464d07d99e6e0a03a02575a24ecc669..bbffcd1ca0d736da2521514e0155522e92e3e8b5 100644 (file)
@@ -149,7 +149,7 @@ int UtcDaliImageActorPixelArea(void)
   TestApplication application;
   tet_infoline("Positive test for Dali::ImageActor::UtcDaliImageActorPixelArea");
 
-  BitmapImage img = BitmapImage::New( 10, 10 );
+  BufferImage img = BufferImage::New( 10, 10 );
   ImageActor actor = ImageActor::New( img );
 
   DALI_TEST_CHECK( actor.IsPixelAreaSet() == false );
@@ -179,7 +179,7 @@ int UtcDaliImageActorSetSize01(void)
 {
   TestApplication application;
 
-  BitmapImage img = BitmapImage::New( 1,1 );
+  BufferImage img = BufferImage::New( 1,1 );
   ImageActor actor = ImageActor::New( img );
 
   ShaderEffect effect = ShaderEffect::New( " ", " ", " ", " ", ShaderEffect::HINT_GRID );
@@ -207,7 +207,7 @@ int UtcDaliImageActorGetCurrentSize01(void)
   tet_infoline("Positive test for Dali::ImageActor::GetCurrentSize");
 
   Vector2 initialImageSize(100, 50);
-  BitmapImage image = BitmapImage::New( initialImageSize.width, initialImageSize.height );
+  BufferImage image = BufferImage::New( initialImageSize.width, initialImageSize.height );
   ImageActor actor = ImageActor::New( image );
   Stage::GetCurrent().Add(actor);
 
@@ -654,7 +654,7 @@ int UtcDaliImageActorDefaultProperties(void)
   TestApplication application;
   tet_infoline("Testing Dali::ImageActor DefaultProperties");
 
-  BitmapImage img = BitmapImage::New( 10, 10 );
+  BufferImage img = BufferImage::New( 10, 10 );
   ImageActor actor = ImageActor::New( img );
 
   std::vector<Property::Index> indices;
@@ -694,7 +694,7 @@ int UtcDaliImageActorUseImageAlpha01(void)
 
   tet_infoline("Testing Dali::RenderableActor::SetUseImageAlpha()");
 
-  BitmapImage image = BitmapImage::New( 100, 50 );
+  BufferImage image = BufferImage::New( 100, 50 );
   ImageActor actor = ImageActor::New( image );
   actor.SetBlendMode( BlendingMode::ON );
   actor.SetSize(100, 50);
@@ -716,7 +716,7 @@ int UtcDaliImageActorUseImageAlpha02(void)
 
   tet_infoline("Testing Dali::RenderableActor::SetUseImageAlpha()");
 
-  BitmapImage image = BitmapImage::New( 100, 50 );
+  BufferImage image = BufferImage::New( 100, 50 );
   ImageActor actor = ImageActor::New( image );
   actor.SetBlendMode( BlendingMode::OFF );
   actor.SetSize(100, 50);
@@ -738,7 +738,7 @@ int UtcDaliImageActorUseImageAlpha03(void)
 
   tet_infoline("Testing Dali::RenderableActor::SetUseImageAlpha()");
 
-  BitmapImage image = BitmapImage::New( 100, 50 );
+  BufferImage image = BufferImage::New( 100, 50 );
   ImageActor actor = ImageActor::New( image );
   actor.SetBlendMode( BlendingMode::AUTO );
   actor.SetColor(Vector4(1.0, 1.0, 1.0, 0.5));
@@ -794,7 +794,7 @@ int UtcDaliImageActorUseImageAlpha05(void)
 
   tet_infoline("Testing Dali::RenderableActor::SetUseImageAlpha()");
 
-  BitmapImage image = BitmapImage::New( 100, 50, Pixel::RGB888 );
+  BufferImage image = BufferImage::New( 100, 50, Pixel::RGB888 );
   ImageActor actor = ImageActor::New( image );
   actor.SetBlendMode( BlendingMode::AUTO );
   actor.SetColor(Vector4(1.0, 1.0, 1.0, 1.0));
@@ -815,7 +815,7 @@ int UtcDaliImageActorClearPixelArea(void)
 {
   TestApplication application;
 
-  BitmapImage img = BitmapImage::New( 10, 10 );
+  BufferImage img = BufferImage::New( 10, 10 );
   ImageActor actor = ImageActor::New( img );
 
   DALI_TEST_CHECK( actor.IsPixelAreaSet() == false );
@@ -1124,7 +1124,7 @@ int UtcDaliImageActorGetNaturalSize(void)
   TestApplication application;
 
   // Standard image
-  BitmapImage img = BitmapImage::New( 10, 10 );
+  BufferImage img = BufferImage::New( 10, 10 );
   ImageActor actor = ImageActor::New( img );
 
   DALI_TEST_CHECK( actor.GetNaturalSize().GetVectorXY() == Vector2( 10, 10 ) );
index 82ca14078d3950b0d4cefd83c617952a154d7542..a80a16d9f2542a38f6d274045e0331a2f7f71af7 100644 (file)
@@ -260,7 +260,7 @@ int UtcDaliLayerSetSortFunction(void)
 {
   tet_infoline("Testing Dali::Layer::SetSortFunction()");
   TestApplication application;
-  BitmapImage img = BitmapImage::New( 1,1 );
+  BufferImage img = BufferImage::New( 1,1 );
   // create two transparent actors so there is something to sort
   ImageActor actor = ImageActor::New( img );
   ImageActor actor2 = ImageActor::New( img );
index eb72b1b12e4fc4b8e821e89cc4794bcc707a2b21..9583484816889b1c6550fab674dae7e0dd76c9e1 100644 (file)
@@ -712,7 +712,7 @@ int UtcDaliMeshActorBlend04(void)
   tet_infoline("Testing Dali::MeshActor::Blend04()");
 
   Material material = ConstructMaterial(1.0f, 1.0f);
-  BitmapImage image = BitmapImage::New( 100, 50, Pixel::RGBA8888 );
+  BufferImage image = BufferImage::New( 100, 50, Pixel::RGBA8888 );
   material.SetDiffuseTexture( image );
   application.SendNotification();
   application.Render(0);
@@ -730,7 +730,7 @@ int UtcDaliMeshActorBlend05(void)
   tet_infoline("Testing Dali::MeshActor::Blend05()");
 
   Material material = ConstructMaterial(1.0f, 1.0f);
-  BitmapImage image = BitmapImage::New( 100, 50, Pixel::RGBA8888 );
+  BufferImage image = BufferImage::New( 100, 50, Pixel::RGBA8888 );
   material.SetDiffuseTexture( image );
   application.SendNotification();
   application.Render(0);
@@ -749,7 +749,7 @@ int UtcDaliMeshActorBlend06(void)
   tet_infoline("Testing Dali::MeshActor::Blend()");
 
   Material material = ConstructMaterial(1.0f, 1.0f);
-  BitmapImage image = BitmapImage::New( 100, 50, Pixel::RGB888 );
+  BufferImage image = BufferImage::New( 100, 50, Pixel::RGB888 );
   material.SetDiffuseTexture( image );
   application.SendNotification();
   application.Render(0);
@@ -793,7 +793,7 @@ int UtcDaliMeshActorBlend08(void)
   tet_infoline("Testing Dali::MeshActor::Blend08()");
 
   Material material = ConstructMaterial(1.0f, 1.0f);
-  BitmapImage image = BitmapImage::New( 100, 50, Pixel::RGBA8888 );
+  BufferImage image = BufferImage::New( 100, 50, Pixel::RGBA8888 );
   material.SetDiffuseTexture( image );
   application.SendNotification();
   application.Render(0);
@@ -810,7 +810,7 @@ int UtcDaliMeshActorBlend09(void)
   tet_infoline("Testing Dali::MeshActor::Blend08()");
 
   Material material = ConstructMaterial(0.5f, 1.0f);
-  BitmapImage image = BitmapImage::New( 100, 50, Pixel::RGB888 );
+  BufferImage image = BufferImage::New( 100, 50, Pixel::RGB888 );
   material.SetDiffuseTexture( image );
   application.SendNotification();
   application.Render(0);
@@ -837,7 +837,7 @@ int UtcDaliMeshActorBoneUpdate01(void)
   branch.SetPosition(Vector3(10.0f, 100.0f, 0.0f));
   branch.SetRotation(Quaternion(M_PI*0.2f, Vector3::YAXIS));
 
-  Actor twig = ImageActor::New(CreateBitmapImage());
+  Actor twig = ImageActor::New(CreateBufferImage());
   twig.SetName("twig");
   branch.SetPosition(Vector3(20.0f, 30.0f, 40.0f));
 
index 43f1918804d2ba5afc78f020a2b524d2974de13a..506386de9440919077daaaa913d5673d4ce8d9d5 100644 (file)
@@ -341,7 +341,7 @@ int UtcDaliRenderTaskSetSourceActor(void)
   ids.push_back( 7 );
   application.GetGlAbstraction().SetNextTextureIds( ids );
 
-  BitmapImage img = BitmapImage::New( 1,1 );
+  BufferImage img = BufferImage::New( 1,1 );
   ImageActor newActor = ImageActor::New( img );
   newActor.SetSize(1,1);
   stage.Add( newActor );
@@ -404,7 +404,7 @@ int UtcDaliRenderTaskSetSourceActorOffStage(void)
   ids.push_back( expectedTextureId );
   application.GetGlAbstraction().SetNextTextureIds( ids );
 
-  BitmapImage img = BitmapImage::New( 1,1 );
+  BufferImage img = BufferImage::New( 1,1 );
   ImageActor newActor = ImageActor::New( img );
   newActor.SetSize(1,1);
   task.SetSourceActor( newActor );
@@ -465,7 +465,7 @@ int UtcDaliRenderTaskSetSourceActorEmpty(void)
   ids.push_back( expectedTextureId );
   application.GetGlAbstraction().SetNextTextureIds( ids );
 
-  BitmapImage img = BitmapImage::New( 1,1 );
+  BufferImage img = BufferImage::New( 1,1 );
   ImageActor newActor = ImageActor::New( img );
   newActor.SetSize(1,1);
   stage.Add( newActor );
@@ -538,7 +538,7 @@ int UtcDaliRenderTaskSetExclusive(void)
   ids.push_back( 10 ); // 10 = actor3
   application.GetGlAbstraction().SetNextTextureIds( ids );
 
-  BitmapImage img1 = BitmapImage::New( 1,1 );
+  BufferImage img1 = BufferImage::New( 1,1 );
   ImageActor actor1 = ImageActor::New( img1 );
   actor1.SetSize(1,1);
   Stage::GetCurrent().Add( actor1 );
@@ -556,7 +556,7 @@ int UtcDaliRenderTaskSetExclusive(void)
     DALI_TEST_EQUALS( boundTextures[0], 8u/*unique to actor1*/, TEST_LOCATION );
   }
 
-  BitmapImage img2 = BitmapImage::New( 1,1 );
+  BufferImage img2 = BufferImage::New( 1,1 );
   ImageActor actor2 = ImageActor::New( img2 );
   actor2.SetSize(1,1);
 
@@ -580,7 +580,7 @@ int UtcDaliRenderTaskSetExclusive(void)
     DALI_TEST_EQUALS( boundTextures[1], 8u/*unique to actor1*/, TEST_LOCATION );
   }
 
-  BitmapImage img3 = BitmapImage::New( 1,1 );
+  BufferImage img3 = BufferImage::New( 1,1 );
   ImageActor actor3 = ImageActor::New( img3 );
   actor3.SetSize(1,1);
 
@@ -1130,7 +1130,7 @@ int UtcDaliRenderTaskSignalFinished(void)
 
   Stage::GetCurrent().Add( offscreenCameraActor );
 
-  BitmapImage image = BitmapImage::New( 10, 10 );
+  BufferImage image = BufferImage::New( 10, 10 );
   ImageActor rootActor = ImageActor::New( image );
   rootActor.SetSize( 10, 10 );
   Stage::GetCurrent().Add( rootActor );
index 63830e80910c6f16b55c81abd4831569faf908cd..b8c0412a519f655da441f43ba55e55ffee02d4e9 100644 (file)
@@ -114,7 +114,7 @@ int UtcDaliRenderableActorSetSortModifier(void)
   //Verify through layer SetSortFunction
   gIsActor1SortModifierCorrect = false;
   gIsActor2SortModifierCorrect = false;
-  BitmapImage img = BitmapImage::New( 1,1 );
+  BufferImage img = BufferImage::New( 1,1 );
   // create two transparent actors so there is something to sort
   ImageActor actor1 = ImageActor::New( img );
   ImageActor actor2 = ImageActor::New( img );
@@ -183,7 +183,7 @@ int UtcDaliRenderableActorSetCullFace(void)
 
   tet_infoline("Testing Dali::RenderableActor::SetCullFace()");
 
-  BitmapImage img = BitmapImage::New( 1,1 );
+  BufferImage img = BufferImage::New( 1,1 );
   ImageActor actor = ImageActor::New( img );
   ImageActor actor2 = ImageActor::New( img );
 
@@ -321,7 +321,7 @@ int UtcDaliRenderableActorSetGetBlendFunc(void)
 
   tet_infoline("Testing Dali::RenderableActor::UtcDaliRenderableActorSetGetBlendFunc()");
 
-  BitmapImage img = BitmapImage::New( 1,1 );
+  BufferImage img = BufferImage::New( 1,1 );
   ImageActor actor = ImageActor::New( img );
   Stage::GetCurrent().Add( actor );
   application.SendNotification();
@@ -398,7 +398,7 @@ int UtcDaliRenderableActorSetGetBlendEquation(void)
 
   tet_infoline("Testing Dali::RenderableActor::SetBlendEquation()");
 
-  BitmapImage img = BitmapImage::New( 1,1 );
+  BufferImage img = BufferImage::New( 1,1 );
   ImageActor actor = ImageActor::New( img );
   Stage::GetCurrent().Add( actor );
   application.SendNotification();
@@ -447,7 +447,7 @@ int UtcDaliRenderableActorSetGetBlendColor(void)
 
   tet_infoline("Testing Dali::RenderableActor::SetBlendColor()");
 
-  BitmapImage img = BitmapImage::New( 1,1 );
+  BufferImage img = BufferImage::New( 1,1 );
   ImageActor actor = ImageActor::New( img );
   Stage::GetCurrent().Add( actor );
   application.SendNotification();
@@ -474,7 +474,7 @@ int UtcDaliRenderableActorSetGetAlpha(void)
 
   tet_infoline("Testing Dali::RenderableActor::SetGetAlpha()");
 
-  BitmapImage img = BitmapImage::New( 1,1 );
+  BufferImage img = BufferImage::New( 1,1 );
   ImageActor actor = ImageActor::New( img );
   Stage::GetCurrent().Add( actor );
   application.SendNotification();
@@ -557,7 +557,7 @@ int UtcDaliRenderableActorSetFilterMode(void)
 
   tet_infoline("Testing Dali::RenderableActor::SetFilterMode()");
 
-  BitmapImage img = BitmapImage::New( 1,1 );
+  BufferImage img = BufferImage::New( 1,1 );
   ImageActor actor = ImageActor::New( img );
 
   actor.SetSize(100.0f, 100.0f);
@@ -737,7 +737,7 @@ int UtcDaliRenderableActorSetFilterMode(void)
 int UtcDaliRenderableActorSetShaderEffect(void)
 {
   TestApplication application;
-  BitmapImage img = BitmapImage::New( 1,1 );
+  BufferImage img = BufferImage::New( 1,1 );
   ImageActor actor = ImageActor::New( img );
   Stage::GetCurrent().Add( actor );
 
@@ -826,7 +826,7 @@ int UtcDaliSetShaderEffectRecursively(void)
    *       actor3 textactor
    * imageactor
    */
-  BitmapImage img = BitmapImage::New( 1,1 );
+  BufferImage img = BufferImage::New( 1,1 );
   ImageActor actor1 = ImageActor::New( img );
   Actor actor2 = Actor::New();
   actor1.Add( actor2 );
index 870fc968be67d4ec48f0b2e497af29fedae75c7f..82adffed0bf5d38031a036f9b4ea3282a0b27358 100644 (file)
@@ -91,9 +91,9 @@ ResourceImage NewResourceImage( const Property::Value& map )
 }
 
 /// Helper method to create ResourceImage using property
-BitmapImage NewBitmapImage( const Property::Value& map )
+BufferImage NewBufferImage( const Property::Value& map )
 {
-  BitmapImage image = BitmapImage::DownCast( NewImage( map ) );
+  BufferImage image = BufferImage::DownCast( NewImage( map ) );
   return image;
 }
 
@@ -516,12 +516,12 @@ int UtcDaliScriptingNewImage(void)
     Image image = NewImage( map );
     DALI_TEST_CHECK( FrameBufferImage::DownCast( image ) );
   }
-  // type BitMapImage
-   map[ "type" ] = "BitmapImage";
+  // type BufferImage
+   map[ "type" ] = "BufferImage";
    {
      Image image = NewImage( map );
-     DALI_TEST_CHECK( BitmapImage::DownCast( image ) );
-     DALI_TEST_CHECK((BitmapImage::DownCast( image )).GetPixelFormat()== Pixel::RGBA8888);
+     DALI_TEST_CHECK( BufferImage::DownCast( image ) );
+     DALI_TEST_CHECK((BufferImage::DownCast( image )).GetPixelFormat()== Pixel::RGBA8888);
    }
 
    // pixel-format
@@ -555,19 +555,19 @@ int UtcDaliScriptingNewImage(void)
          { "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC", Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC },
          { "COMPRESSED_RGB8_ETC1", Pixel::COMPRESSED_RGB8_ETC1 },
          { "COMPRESSED_RGB_PVRTC_4BPPV1", Pixel::COMPRESSED_RGB_PVRTC_4BPPV1 },*/
-         // BitmapImage doesnot support compressed format
+         // BufferImage doesnot support compressed format
      };
 
-     TestEnumStrings< Pixel::Format, BitmapImage >( map, values, ( sizeof( values ) / sizeof ( values[0] ) ), &BitmapImage::GetPixelFormat, &NewBitmapImage );
+     TestEnumStrings< Pixel::Format, BufferImage >( map, values, ( sizeof( values ) / sizeof ( values[0] ) ), &BufferImage::GetPixelFormat, &NewBufferImage );
    }
 
   // type Image
-  map[ "type" ] = "Image";
+  map[ "type" ] = "ResourceImage";
   {
     Image image = NewImage( map );
     DALI_TEST_CHECK( ResourceImage::DownCast( image ) );
     DALI_TEST_CHECK( !FrameBufferImage::DownCast( image ) );
-    DALI_TEST_CHECK( !BitmapImage::DownCast( image ) );
+    DALI_TEST_CHECK( !BufferImage::DownCast( image ) );
   }
   END_TEST;
 }
@@ -988,14 +988,14 @@ int UtcDaliScriptingCreatePropertyMapImage(void)
     DALI_TEST_EQUALS( value.GetValue( "height" ).Get< int >(), 400, TEST_LOCATION );
   }
 
-  // BitmapImage
+  // BufferImage
   {
-    Image image = BitmapImage::New( 200, 300, Pixel::A8 );
+    Image image = BufferImage::New( 200, 300, Pixel::A8 );
     Property::Map map;
     CreatePropertyMap( image, map );
     Property::Value value( map );
     DALI_TEST_CHECK( value.HasKey( "type" ) );
-    DALI_TEST_EQUALS( value.GetValue( "type" ).Get< std::string >(), "BitmapImage", TEST_LOCATION );
+    DALI_TEST_EQUALS( value.GetValue( "type" ).Get< std::string >(), "BufferImage", TEST_LOCATION );
     DALI_TEST_CHECK( value.HasKey( "pixel-format") );
     DALI_TEST_EQUALS( value.GetValue( "pixel-format" ).Get< std::string >(), "A8", TEST_LOCATION );
   }
index d82897a343cfb71685374998d11f9dce315e58ae..a340d56a688dd23e0640045bf05fa677fcaf5352 100644 (file)
@@ -193,7 +193,7 @@ int UtcDaliShaderEffectMethodNew04(void)
                                                        fragmentShaderPrefix, FragmentSourceUsingExtensions,
                                                        GEOMETRY_TYPE_IMAGE, ShaderEffect::HINT_NONE );
 
-    BitmapImage image = CreateBitmapImage();
+    BufferImage image = CreateBufferImage();
     ImageActor actor = ImageActor::New( image );
     actor.SetSize( 100.0f, 100.0f );
     actor.SetName("TestImageFilenameActor");
@@ -325,7 +325,7 @@ int UtcDaliShaderEffectMethodSetUniformFloat(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uFloat", 1.0f );
 
@@ -351,7 +351,7 @@ int UtcDaliShaderEffectMethodSetUniformVector2(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uVec2", Vector2( 2.0f, 3.0f ) );
 
@@ -377,7 +377,7 @@ int UtcDaliShaderEffectMethodSetUniformVector3(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uVec3", Vector3( 4.0f, 5.0f, 6.0f ) );
 
@@ -403,7 +403,7 @@ int UtcDaliShaderEffectMethodSetUniformVector4(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uVec4", Vector4( 7.0f, 8.0f, 9.0f, 10.0f ) );
 
@@ -429,7 +429,7 @@ int UtcDaliShaderEffectMethodSetUniformMatrix(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uModelView", Matrix::IDENTITY );
 
@@ -455,7 +455,7 @@ int UtcDaliShaderEffectMethodSetUniformMatrix3(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   Matrix3 matIdentity(1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f);
   effect.SetUniform( "uMatrix3", matIdentity );
@@ -480,7 +480,7 @@ int UtcDaliShaderEffectMethodSetUniformViewport(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   ImageActor actor = ImageActor::New( image );
   actor.SetSize( 100.0f, 100.0f );
@@ -525,7 +525,7 @@ int UtcDaliShaderEffectMethodSetEffectImage(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetEffectImage(image);
 
@@ -554,7 +554,7 @@ int UtcDaliShaderEffectMethodSetEffectImageAndDelete(void)
 
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
 
-  BitmapImage effectImage = CreateBitmapImage();
+  BufferImage effectImage = CreateBufferImage();
   effect.SetEffectImage(effectImage);
 
   ImageActor actor = ImageActor::New();
@@ -622,7 +622,7 @@ int UtcDaliShaderEffectMethodApplyConstraint(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uVec3", Vector3( 1.0f, 2.0f, 3.0f ) );
 
@@ -668,7 +668,7 @@ int UtcDaliShaderEffectMethodApplyConstraintFromActor(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uVec3", Vector3( 50.0f, 25.0f, 0.0f ) );
 
@@ -708,7 +708,7 @@ int UtcDaliShaderEffectMethodApplyConstraintFromActor2(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uVec3", Vector3( 50.0f, 25.0f, 0.0f ) );
 
@@ -750,7 +750,7 @@ int UtcDaliShaderEffectMethodApplyConstraintCallback(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uVec3", Vector3( 1.0f, 2.0f, 3.0f ) );
 
@@ -822,7 +822,7 @@ int UtcDaliShaderEffectMethodRemoveConstraints(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uVec3", Vector3( 1.0f, 2.0f, 3.0f ) );
 
@@ -868,7 +868,7 @@ int UtcDaliShaderEffectMethodRemoveConstraints2(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
 
   effect.SetUniform( "uVec3", Vector3( 1.0f, 2.0f, 3.0f ) );
 
@@ -941,7 +941,7 @@ int UtcDaliShaderEffectMethodCreateExtension2(void)
     ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
     DALI_TEST_CHECK( effect );
 
-    BitmapImage image = CreateBitmapImage();
+    BufferImage image = CreateBufferImage();
 
     effect.SetUniform( "uFloat", 1.0f );
 
@@ -1020,7 +1020,7 @@ int UtcDaliShaderBinaries(void)
   ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
   DALI_TEST_CHECK( effect );
 
-  BitmapImage image = CreateBitmapImage();
+  BufferImage image = CreateBufferImage();
   ImageActor actor = ImageActor::New( image );
   actor.SetSize( 100.0f, 100.0f );
   actor.SetName("TestImageFilenameActor");
@@ -1105,7 +1105,7 @@ int UtcDaliShaderEffectFromProperties01(void)
   TestPlatformAbstraction& platform = application.GetPlatform();
   platform.SetResourceLoaded(request->GetId(), request->GetType()->id, resourcePtr);
 
-  BitmapImage image(CreateBitmapImage());
+  BufferImage image(CreateBufferImage());
   ImageActor actor = ImageActor::New( image );
   actor.SetSize( 100.0f, 100.0f );
   actor.SetName("TestImageFilenameActor");
index 550596f04fbb82034b1375a7d305d03e013a20d2..7ca5741ca387aae6989da4916139294415899fb8 100644 (file)
@@ -125,7 +125,7 @@ void ImageActor::SetImage( ImagePtr& image )
     NinePatchImage* ninePatchImage = NinePatchImage::DownCast( image.Get() );
     if( ninePatchImage )
     {
-      newImage = ninePatchImage->CreateCroppedBitmapImage();
+      newImage = ninePatchImage->CreateCroppedBufferImage();
       SetStyle( Dali::ImageActor::STYLE_NINE_PATCH );
       SetNinePatchBorder( ninePatchImage->GetStretchBorders(), true );
     }
index f0a7af17548b3c349898aa69f1e4a738f576a75e..573c600ffaaa256f1f8ea8ddd74f9551dd703412 100644 (file)
@@ -21,7 +21,7 @@
 // INTERNAL INCLUDES
 #include <dali/public-api/object/type-registry.h>
 #include <dali/internal/event/common/thread-local-storage.h>
-#include <dali/internal/event/images/bitmap-image-impl.h>
+#include <dali/internal/event/images/buffer-image-impl.h>
 #include <dali/internal/event/resources/resource-client.h>
 #include <dali/integration-api/bitmap.h>
 
@@ -43,7 +43,7 @@ Atlas* Atlas::New( std::size_t width,
   return new Atlas( width, height, pixelFormat );
 }
 
-bool Atlas::Upload( const BitmapImage& bitmapImage,
+bool Atlas::Upload( const BufferImage& bufferImage,
                     std::size_t xOffset,
                     std::size_t yOffset )
 {
@@ -51,10 +51,10 @@ bool Atlas::Upload( const BitmapImage& bitmapImage,
 
   AllocateAtlas();
 
-  if( IsWithin(bitmapImage, xOffset, yOffset) )
+  if( IsWithin(bufferImage, xOffset, yOffset) )
   {
     ResourceId destId = GetResourceId();
-    ResourceId srcId = bitmapImage.GetResourceId();
+    ResourceId srcId = bufferImage.GetResourceId();
 
     if( destId && srcId )
     {
@@ -105,20 +105,20 @@ void Atlas::Disconnect()
   }
 }
 
-bool Atlas::IsWithin( const BitmapImage& bitmapImage,
+bool Atlas::IsWithin( const BufferImage& bufferImage,
                       std::size_t xOffset,
                       std::size_t yOffset )
 {
   bool within(false);
 
-  if( mPixelFormat != bitmapImage.GetPixelFormat() )
+  if( mPixelFormat != bufferImage.GetPixelFormat() )
   {
-    DALI_LOG_ERROR( "Pixel format %d does not match Atlas format %d\n", bitmapImage.GetPixelFormat(), mPixelFormat );
+    DALI_LOG_ERROR( "Pixel format %d does not match Atlas format %d\n", bufferImage.GetPixelFormat(), mPixelFormat );
   }
   else
   {
-    const unsigned int width  = bitmapImage.GetWidth();
-    const unsigned int height = bitmapImage.GetHeight();
+    const unsigned int width  = bufferImage.GetWidth();
+    const unsigned int height = bufferImage.GetHeight();
 
     if( xOffset < mWidth  &&
         yOffset < mHeight &&
index 6dddead5aab23437e05388971cd574c166a5b2e9..056c8ccc6c5d5c01f6807dbf452330e038061ed0 100644 (file)
@@ -56,15 +56,15 @@ public:
                      Pixel::Format pixelFormat = Pixel::RGBA8888 );
 
   /**
-   * @brief Upload a bitmap to the atlas.
+   * @brief Upload a buffer image to the atlas.
    *
    * @pre The bitmap pixel format must match the Atlas format.
-   * @param [in] bitmap The bitmap to upload.
+   * @param [in] bufferImage The buffer image to upload.
    * @param [in] xOffset Specifies an offset in the x direction within the atlas.
    * @param [in] yOffset Specifies an offset in the y direction within the atlas.
    * @return True if the bitmap fits within the atlas at the specified offset.
    */
-  bool Upload( const BitmapImage& bitmap,
+  bool Upload( const BufferImage& bufferImage,
                std::size_t xOffset,
                std::size_t yOffset );
 
@@ -104,7 +104,7 @@ private:
    * Helper for Upload methods
    * @return True if the bitmap fits within the atlas at the specified offset
    */
-  bool IsWithin( const BitmapImage& bitmapImage,
+  bool IsWithin( const BufferImage& bufferImage,
                  std::size_t xOffset,
                  std::size_t yOffset );
 
diff --git a/dali/internal/event/images/bitmap-image-impl.cpp b/dali/internal/event/images/bitmap-image-impl.cpp
deleted file mode 100644 (file)
index 8299d9f..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * 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/internal/event/images/bitmap-image-impl.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/object/type-registry.h>
-#include <dali/integration-api/bitmap.h>
-#include <dali/internal/event/images/bitmap-external.h>
-#include <dali/internal/event/common/thread-local-storage.h>
-#include <dali/internal/event/resources/resource-client.h>
-#include <dali/internal/update/manager/update-manager.h>
-#include <dali/internal/event/images/image-factory.h>
-
-namespace Dali
-{
-namespace Internal
-{
-
-namespace
-{
-TypeRegistration mType( typeid( Dali::BitmapImage ), typeid( Dali::Image ), NULL );
-} // unnamed namespace
-
-BitmapImagePtr BitmapImage::New( unsigned int width, unsigned int height, Pixel::Format pixelformat, ReleasePolicy releasePol )
-{
-  BitmapImagePtr internal = new BitmapImage( width, height, pixelformat, releasePol );
-  internal->Initialize();
-  return internal;
-}
-
-BitmapImagePtr BitmapImage::New( PixelBuffer* pixBuf, unsigned int width, unsigned int height, Pixel::Format pixelformat, unsigned int stride, ReleasePolicy releasePol )
-{
-  BitmapImagePtr internal = new BitmapImage( pixBuf, width, height, pixelformat, stride, releasePol );
-  internal->Initialize();
-  return internal;
-}
-
-BitmapImage::BitmapImage(unsigned int width, unsigned int height, Pixel::Format pixelformat, ReleasePolicy releasePol)
-: Image(releasePol),
-  mIsDataExternal(false)
-{
-  ThreadLocalStorage& tls = ThreadLocalStorage::Get();
-  mResourceClient = &tls.GetResourceClient();
-  mWidth  = width;
-  mHeight = height;
-
-  const ImageTicketPtr& t = mResourceClient->AllocateBitmapImage(width, height, width, height, pixelformat);
-  mTicket = t.Get();
-
-  mTicket->AddObserver(*this);
-}
-
-BitmapImage::BitmapImage(PixelBuffer* pixBuf, unsigned int width, unsigned int height, Pixel::Format pixelformat, unsigned int stride, ReleasePolicy releasePol)
-: Image(releasePol),
-  mIsDataExternal(true)
-{
-  ThreadLocalStorage& tls = ThreadLocalStorage::Get();
-  mResourceClient = &tls.GetResourceClient();
-  mWidth  = width;
-  mHeight = height;
-  Integration::Bitmap* bitmap = new BitmapExternal(pixBuf, width, height, pixelformat, stride);
-  const ImageTicketPtr& t = mResourceClient->AddBitmapImage(bitmap);
-  mTicket = t.Get();
-
-  mTicket->AddObserver(*this);
-}
-
-BitmapImage::~BitmapImage()
-{
-}
-
-void BitmapImage::Update( RectArea& updateArea )
-{
-  if (mTicket)
-  {
-    // TODO:
-    // If updateArea is empty or same as image size, then pass on.
-    // If updateArea is larger than image size, throw exception
-    // Otherwise, copy updateArea window of pixelBuffer into newly
-    // allocated buffer and pass that to resource client. (it will
-    // tramp through to BitmapTexture eventually!)
-    mResourceClient->UpdateBitmapArea( mTicket, updateArea );
-  }
-  else if (mIsDataExternal && mBitmapCached)
-  {
-    // previously freed up resource memory, dali was informed about external BitmapImage put back on screen
-    Integration::Bitmap* bitmap = mBitmapCached.Get();
-    mTicket.Reset((mResourceClient->AddBitmapImage(bitmap)).Get());
-
-    mTicket->AddObserver(*this);
-  }
-}
-
-bool BitmapImage::IsDataExternal() const
-{
-  return mIsDataExternal;
-}
-
-PixelBuffer* BitmapImage::GetBuffer()
-{
-  PixelBuffer* buffer = NULL;
-
-  Integration::Bitmap* const bitmap = GetBitmap();
-
-  if(bitmap)
-  {
-    buffer = bitmap->GetBuffer();
-  }
-  return buffer;
-}
-
-unsigned int BitmapImage::GetBufferSize() const
-{
-  unsigned int bufferSize = 0;
-
-  Integration::Bitmap* const bitmap = GetBitmap();
-
-  if(bitmap)
-  {
-    bufferSize = bitmap->GetBufferSize();
-  }
-  return bufferSize;
-}
-
-unsigned int BitmapImage::GetBufferStride() const
-{
-  unsigned int bufferStride = 0;
-
-  Integration::Bitmap* const bitmap = GetBitmap();
-
-  if(bitmap)
-  {
-    Integration::Bitmap::PackedPixelsProfile* packedBitmap = bitmap->GetPackedPixelsProfile();
-    DALI_ASSERT_DEBUG(packedBitmap);
-    bufferStride = packedBitmap->GetBufferStride();
-  }
-
-  return bufferStride;
-}
-
-Pixel::Format BitmapImage::GetPixelFormat() const
-{
-  Pixel::Format format( Pixel::RGBA8888 );
-
-  Integration::Bitmap* const bitmap = GetBitmap();
-
-  if( bitmap )
-  {
-    format = bitmap->GetPixelFormat();
-  }
-
-  return format;
-}
-
-void BitmapImage::Connect()
-{
-  ++mConnectionCount;
-
-  // application owns bitmap buffer, don't do anything. BufferUpdated() has to be called manually.
-  if (mIsDataExternal)
-  {
-    return;
-  }
-
-  if (mConnectionCount == 1)
-  {
-    if (!mTicket && mBitmapCached)
-    {
-      const ImageTicketPtr& t = mResourceClient->AddBitmapImage(mBitmapCached.Get());
-      mTicket = t.Get();
-      mTicket->AddObserver(*this);
-    }
-  }
-}
-
-void BitmapImage::Disconnect()
-{
-  if (!mTicket)
-  {
-    return;
-  }
-
-  --mConnectionCount;
-
-  if (mConnectionCount == 0 && mReleasePolicy == Dali::Image::UNUSED)
-  {
-    mBitmapCached = mResourceClient->GetBitmap(mTicket);
-    // release image memory when it's not visible anymore (decrease ref. count of texture)
-    mTicket->RemoveObserver(*this);
-    mTicket.Reset();
-  }
-}
-
-Integration::Bitmap * BitmapImage::GetBitmap() const
-{
-  Integration::Bitmap* bitmap = NULL;
-
-  if (mTicket)
-  {
-    bitmap = mResourceClient->GetBitmap(mTicket);
-  }
-  else
-  {
-    // off screen and freeing memory was requested
-    bitmap = mBitmapCached.Get();
-  }
-
-  DALI_ASSERT_DEBUG(bitmap);
-
-  return bitmap;
-}
-
-} // namespace Internal
-
-} // namespace Dali
diff --git a/dali/internal/event/images/bitmap-image-impl.h b/dali/internal/event/images/bitmap-image-impl.h
deleted file mode 100644 (file)
index 41cba92..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-#ifndef __DALI_INTERNAL_BITMAP_IMAGE_H__
-#define __DALI_INTERNAL_BITMAP_IMAGE_H__
-
-/*
- * 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/object/ref-object.h>
-#include <dali/internal/event/images/image-impl.h>
-#include <dali/public-api/images/image.h>
-#include <dali/public-api/images/bitmap-image.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-class BitmapImage;
-typedef IntrusivePtr<BitmapImage> BitmapImagePtr;
-
-class ResourceClient;
-class ResourceManager;
-
-/**
- * BitmapImage represents an image resource that can be added to actors etc.
- * Its pixel buffer data is provided by the application developer.
- * Pixel buffer memory allocation can be handled by dali or application.
- */
-class BitmapImage : public Image
-{
-public:
-  /**
-   * Create a new BitmapImage.
-   * Also a pixel buffer for image data is allocated.
-   * Dali has ownership of the buffer.
-   * For better performance and portability use power of two dimensions.
-   * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
-   * @param [in] width       image width in pixels
-   * @param [in] height      image height in pixels
-   * @param [in] pixelformat the pixel format (rgba 32 bit by default)
-   * @param [in] releasePol  optionally relase memory when image is not visible on screen (default: keep image data until Image object is alive).
-   */
-  static BitmapImagePtr New( unsigned int width,
-                             unsigned int height,
-                             Pixel::Format pixelformat,
-                             ReleasePolicy releasePol = IMAGE_RELEASE_POLICY_DEFAULT );
-
-  /**
-   * Create a new BitmapImage, which uses external data source.
-   * Pixel buffer has to be allocated by application.
-   * Application holds ownership of the buffer.
-   * For better performance and portability use power of two dimensions.
-   * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
-   * @note  in case releasePol is "OffStage", application has to call Image::BufferUpdated() whenever image is re-added to the stage
-   * @param [in] pixBuf      pixel buffer. has to be allocated by application.
-   * @param [in] width       image width in pixels
-   * @param [in] height      image height in pixels
-   * @param [in] pixelformat the pixel format (rgba 32 bit by default)
-   * @param [in] stride      the internal stride of the pixelbuffer in pixels
-   * @param [in] releasePol  optionally relase memory when image is not visible on screen (default: keep image data until Image object is alive).
-   */
-  static BitmapImagePtr New( PixelBuffer* pixBuf,
-                             unsigned int width,
-                             unsigned int height,
-                             Pixel::Format pixelformat,
-                             unsigned int stride,
-                             ReleasePolicy releasePol = IMAGE_RELEASE_POLICY_DEFAULT );
-
-  /**
-   * Create a new BitmapImage.
-   * Also a pixel buffer for image data is allocated.
-   * Dali has ownership of the buffer.
-   * For better performance use power of two dimensions.
-   * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
-   * @param [in] width image width in pixels
-   * @param [in] height image height in pixels
-   * @param [in] pixelformat the pixel format (rgba 32 bit by default)
-   * @param [in] releasePol optionally release memory when image is not visible on screen (default: keep image data until Image object is alive).
-   */
-  BitmapImage(unsigned int width,
-              unsigned int height,
-              Pixel::Format pixelformat,
-              ReleasePolicy releasePol = IMAGE_RELEASE_POLICY_DEFAULT);
-
-  /**
-   * Create a new BitmapImage, which uses external data source.
-   * Pixel buffer has to be allocated by application.
-   * Application holds ownership of the buffer.
-   * For better performance and portability use power of two dimensions.
-   * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
-   * @note  in case releasePol is "OffStage", application has to call Image::BufferUpdated() whenever image is re-added to the stage
-   * @param [in] pixBuf      pixel buffer. has to be allocated by application.
-   * @param [in] width       image width in pixels
-   * @param [in] height      image height in pixels
-   * @param [in] pixelformat the pixel format (rgba 32 bit by default)
-   * @param [in] stride      the internal stride of the pixelbuffer in pixels
-   * @param [in] releasePol  optionally relase memory when image is not visible on screen (default: keep image data until Image object is alive).
-   */
-  BitmapImage(PixelBuffer* pixBuf,
-              unsigned int width,
-              unsigned int height,
-              Pixel::Format pixelformat,
-              unsigned int stride,
-              ReleasePolicy releasePol = IMAGE_RELEASE_POLICY_DEFAULT);
-
-protected:
-  /**
-   * A reference counted object may only be deleted by calling Unreference()
-   */
-  virtual ~BitmapImage();
-
-public:
-  /**
-   * Notify Dali that the contents of the buffer have changed.
-   * @param [in] updateArea area that has changed in buffer. An empty rect means the whole buffer has changed.
-   */
-  void Update (RectArea& updateArea);
-
-  /**
-   * @copydoc Dali::BitmapImage::IsDataExternal
-   */
-  bool IsDataExternal() const;
-
-  /**
-   * Returns the pixel buffer of the Image.
-   * The application developer can write to the buffer.
-   * Upload the modified contents with BufferUpdated.
-   * @return the pixel buffer
-   */
-  PixelBuffer* GetBuffer();
-
-  /**
-   * Returns buffer size in bytes.
-   * @return the buffer size in bytes
-   */
-  unsigned int GetBufferSize() const;
-
-  /**
-   * Returns buffer stride (in bytes).
-   * @return the buffer stride
-   */
-  unsigned int GetBufferStride() const;
-
-  /**
-   * Get the pixel format
-   * @return The pixel format
-   */
-  Pixel::Format GetPixelFormat() const;
-
-protected: // From Resource
-  /**
-   * @copydoc Dali::Internal::Image::Connect
-   */
-  virtual void Connect();
-
-  /**
-   * @copydoc Dali::Internal::Image::Disconnect
-   */
-  virtual void Disconnect();
-
-  /**
-   * Get the bitmap from local cache or ticket.
-   **/
-  Integration::Bitmap * GetBitmap() const;
-
-private:
-  bool mIsDataExternal; ///< whether application holds ownership of pixel buffer or not
-
-  ResourceClient*            mResourceClient;
-
-protected:
-  Integration::BitmapPtr     mBitmapCached;
-};
-
-} // namespace Internal
-
-/**
- * Helper methods for public API.
- */
-inline Internal::BitmapImage& GetImplementation(Dali::BitmapImage& image)
-{
-  DALI_ASSERT_ALWAYS( image && "BitmapImage handle is empty" );
-
-  BaseObject& handle = image.GetBaseObject();
-
-  return static_cast<Internal::BitmapImage&>(handle);
-}
-
-inline const Internal::BitmapImage& GetImplementation(const Dali::BitmapImage& image)
-{
-  DALI_ASSERT_ALWAYS( image && "BitmapImage handle is empty" );
-
-  const BaseObject& handle = image.GetBaseObject();
-
-  return static_cast<const Internal::BitmapImage&>(handle);
-}
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_BITMAP_IMAGE_H__
diff --git a/dali/internal/event/images/buffer-image-impl.cpp b/dali/internal/event/images/buffer-image-impl.cpp
new file mode 100644 (file)
index 0000000..e87f0a1
--- /dev/null
@@ -0,0 +1,231 @@
+/*
+ * 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/internal/event/images/buffer-image-impl.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/object/type-registry.h>
+#include <dali/integration-api/bitmap.h>
+#include <dali/internal/event/images/bitmap-external.h>
+#include <dali/internal/event/common/thread-local-storage.h>
+#include <dali/internal/event/resources/resource-client.h>
+#include <dali/internal/update/manager/update-manager.h>
+#include <dali/internal/event/images/image-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+
+namespace
+{
+TypeRegistration mType( typeid( Dali::BufferImage ), typeid( Dali::Image ), NULL );
+} // unnamed namespace
+
+BufferImagePtr BufferImage::New( unsigned int width, unsigned int height, Pixel::Format pixelformat, ReleasePolicy releasePol )
+{
+  BufferImagePtr internal = new BufferImage( width, height, pixelformat, releasePol );
+  internal->Initialize();
+  return internal;
+}
+
+BufferImagePtr BufferImage::New( PixelBuffer* pixBuf, unsigned int width, unsigned int height, Pixel::Format pixelformat, unsigned int stride, ReleasePolicy releasePol )
+{
+  BufferImagePtr internal = new BufferImage( pixBuf, width, height, pixelformat, stride, releasePol );
+  internal->Initialize();
+  return internal;
+}
+
+BufferImage::BufferImage(unsigned int width, unsigned int height, Pixel::Format pixelformat, ReleasePolicy releasePol)
+: Image(releasePol),
+  mIsDataExternal(false)
+{
+  ThreadLocalStorage& tls = ThreadLocalStorage::Get();
+  mResourceClient = &tls.GetResourceClient();
+  mWidth  = width;
+  mHeight = height;
+
+  const ImageTicketPtr& t = mResourceClient->AllocateBitmapImage(width, height, width, height, pixelformat);
+  mTicket = t.Get();
+
+  mTicket->AddObserver(*this);
+}
+
+BufferImage::BufferImage(PixelBuffer* pixBuf, unsigned int width, unsigned int height, Pixel::Format pixelformat, unsigned int stride, ReleasePolicy releasePol)
+: Image(releasePol),
+  mIsDataExternal(true)
+{
+  ThreadLocalStorage& tls = ThreadLocalStorage::Get();
+  mResourceClient = &tls.GetResourceClient();
+  mWidth  = width;
+  mHeight = height;
+  Integration::Bitmap* bitmap = new BitmapExternal(pixBuf, width, height, pixelformat, stride);
+  const ImageTicketPtr& t = mResourceClient->AddBitmapImage(bitmap);
+  mTicket = t.Get();
+
+  mTicket->AddObserver(*this);
+}
+
+BufferImage::~BufferImage()
+{
+}
+
+void BufferImage::Update( RectArea& updateArea )
+{
+  if (mTicket)
+  {
+    // TODO:
+    // If updateArea is empty or same as image size, then pass on.
+    // If updateArea is larger than image size, throw exception
+    // Otherwise, copy updateArea window of pixelBuffer into newly
+    // allocated buffer and pass that to resource client. (it will
+    // tramp through to BitmapTexture eventually!)
+    mResourceClient->UpdateBitmapArea( mTicket, updateArea );
+  }
+  else if (mIsDataExternal && mBitmapCached)
+  {
+    // previously freed up resource memory, dali was informed about external BufferImage put back on screen
+    Integration::Bitmap* bitmap = mBitmapCached.Get();
+    mTicket.Reset((mResourceClient->AddBitmapImage(bitmap)).Get());
+
+    mTicket->AddObserver(*this);
+  }
+}
+
+bool BufferImage::IsDataExternal() const
+{
+  return mIsDataExternal;
+}
+
+PixelBuffer* BufferImage::GetBuffer()
+{
+  PixelBuffer* buffer = NULL;
+
+  Integration::Bitmap* const bitmap = GetBitmap();
+
+  if(bitmap)
+  {
+    buffer = bitmap->GetBuffer();
+  }
+  return buffer;
+}
+
+unsigned int BufferImage::GetBufferSize() const
+{
+  unsigned int bufferSize = 0;
+
+  Integration::Bitmap* const bitmap = GetBitmap();
+
+  if(bitmap)
+  {
+    bufferSize = bitmap->GetBufferSize();
+  }
+  return bufferSize;
+}
+
+unsigned int BufferImage::GetBufferStride() const
+{
+  unsigned int bufferStride = 0;
+
+  Integration::Bitmap* const bitmap = GetBitmap();
+
+  if(bitmap)
+  {
+    Integration::Bitmap::PackedPixelsProfile* packedBitmap = bitmap->GetPackedPixelsProfile();
+    DALI_ASSERT_DEBUG(packedBitmap);
+    bufferStride = packedBitmap->GetBufferStride();
+  }
+
+  return bufferStride;
+}
+
+Pixel::Format BufferImage::GetPixelFormat() const
+{
+  Pixel::Format format( Pixel::RGBA8888 );
+
+  Integration::Bitmap* const bitmap = GetBitmap();
+
+  if( bitmap )
+  {
+    format = bitmap->GetPixelFormat();
+  }
+
+  return format;
+}
+
+void BufferImage::Connect()
+{
+  ++mConnectionCount;
+
+  // application owns bitmap buffer, don't do anything. Update() has to be called manually.
+  if (mIsDataExternal)
+  {
+    return;
+  }
+
+  if (mConnectionCount == 1)
+  {
+    if (!mTicket && mBitmapCached)
+    {
+      const ImageTicketPtr& t = mResourceClient->AddBitmapImage(mBitmapCached.Get());
+      mTicket = t.Get();
+      mTicket->AddObserver(*this);
+    }
+  }
+}
+
+void BufferImage::Disconnect()
+{
+  if (!mTicket)
+  {
+    return;
+  }
+
+  --mConnectionCount;
+
+  if (mConnectionCount == 0 && mReleasePolicy == Dali::Image::UNUSED)
+  {
+    mBitmapCached = mResourceClient->GetBitmap(mTicket);
+    // release image memory when it's not visible anymore (decrease ref. count of texture)
+    mTicket->RemoveObserver(*this);
+    mTicket.Reset();
+  }
+}
+
+Integration::Bitmap * BufferImage::GetBitmap() const
+{
+  Integration::Bitmap* bitmap = NULL;
+
+  if (mTicket)
+  {
+    bitmap = mResourceClient->GetBitmap(mTicket);
+  }
+  else
+  {
+    // off screen and freeing memory was requested
+    bitmap = mBitmapCached.Get();
+  }
+
+  DALI_ASSERT_DEBUG(bitmap);
+
+  return bitmap;
+}
+
+} // namespace Internal
+
+} // namespace Dali
diff --git a/dali/internal/event/images/buffer-image-impl.h b/dali/internal/event/images/buffer-image-impl.h
new file mode 100644 (file)
index 0000000..a8d7294
--- /dev/null
@@ -0,0 +1,215 @@
+#ifndef __DALI_INTERNAL_BUFFER_IMAGE_H__
+#define __DALI_INTERNAL_BUFFER_IMAGE_H__
+
+/*
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/object/ref-object.h>
+#include <dali/internal/event/images/image-impl.h>
+#include <dali/public-api/images/image.h>
+#include <dali/public-api/images/buffer-image.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+class BufferImage;
+typedef IntrusivePtr<BufferImage> BufferImagePtr;
+
+class ResourceClient;
+class ResourceManager;
+
+/**
+ * BufferImage represents an image resource that can be added to actors etc.
+ * Its pixel buffer data is provided by the application developer.
+ * Pixel buffer memory allocation can be handled by dali or application.
+ */
+class BufferImage : public Image
+{
+public:
+  /**
+   * Create a new BufferImage.
+   * Also a pixel buffer for image data is allocated.
+   * Dali has ownership of the buffer.
+   * For better performance and portability use power of two dimensions.
+   * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
+   * @param [in] width       image width in pixels
+   * @param [in] height      image height in pixels
+   * @param [in] pixelformat the pixel format (rgba 32 bit by default)
+   * @param [in] releasePol  optionally relase memory when image is not visible on screen (default: keep image data until Image object is alive).
+   */
+  static BufferImagePtr New( unsigned int width,
+                             unsigned int height,
+                             Pixel::Format pixelformat,
+                             ReleasePolicy releasePol = IMAGE_RELEASE_POLICY_DEFAULT );
+
+  /**
+   * Create a new BufferImage, which uses external data source.
+   * Pixel buffer has to be allocated by application.
+   * Application holds ownership of the buffer.
+   * For better performance and portability use power of two dimensions.
+   * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
+   * @note  in case releasePol is "OffStage", application has to call Update() whenever image is re-added to the stage
+   * @param [in] pixBuf      pixel buffer. has to be allocated by application.
+   * @param [in] width       image width in pixels
+   * @param [in] height      image height in pixels
+   * @param [in] pixelformat the pixel format (rgba 32 bit by default)
+   * @param [in] stride      the internal stride of the pixelbuffer in pixels
+   * @param [in] releasePol  optionally relase memory when image is not visible on screen (default: keep image data until Image object is alive).
+   */
+  static BufferImagePtr New( PixelBuffer* pixBuf,
+                             unsigned int width,
+                             unsigned int height,
+                             Pixel::Format pixelformat,
+                             unsigned int stride,
+                             ReleasePolicy releasePol = IMAGE_RELEASE_POLICY_DEFAULT );
+
+  /**
+   * Create a new BufferImage.
+   * Also a pixel buffer for image data is allocated.
+   * Dali has ownership of the buffer.
+   * For better performance use power of two dimensions.
+   * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
+   * @param [in] width image width in pixels
+   * @param [in] height image height in pixels
+   * @param [in] pixelformat the pixel format (rgba 32 bit by default)
+   * @param [in] releasePol optionally release memory when image is not visible on screen (default: keep image data until Image object is alive).
+   */
+  BufferImage(unsigned int width,
+              unsigned int height,
+              Pixel::Format pixelformat,
+              ReleasePolicy releasePol = IMAGE_RELEASE_POLICY_DEFAULT);
+
+  /**
+   * Create a new BufferImage, which uses external data source.
+   * Pixel buffer has to be allocated by application.
+   * Application holds ownership of the buffer.
+   * For better performance and portability use power of two dimensions.
+   * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
+   * @note  in case releasePol is "OffStage", application has to call Update() whenever image is re-added to the stage
+   * @param [in] pixBuf      pixel buffer. has to be allocated by application.
+   * @param [in] width       image width in pixels
+   * @param [in] height      image height in pixels
+   * @param [in] pixelformat the pixel format (rgba 32 bit by default)
+   * @param [in] stride      the internal stride of the pixelbuffer in pixels
+   * @param [in] releasePol  optionally relase memory when image is not visible on screen (default: keep image data until Image object is alive).
+   */
+  BufferImage(PixelBuffer* pixBuf,
+              unsigned int width,
+              unsigned int height,
+              Pixel::Format pixelformat,
+              unsigned int stride,
+              ReleasePolicy releasePol = IMAGE_RELEASE_POLICY_DEFAULT);
+
+protected:
+  /**
+   * A reference counted object may only be deleted by calling Unreference()
+   */
+  virtual ~BufferImage();
+
+public:
+  /**
+   * Notify Dali that the contents of the buffer have changed.
+   * @param [in] updateArea area that has changed in buffer. An empty rect means the whole buffer has changed.
+   */
+  void Update (RectArea& updateArea);
+
+  /**
+   * @copydoc Dali::BufferImage::IsDataExternal
+   */
+  bool IsDataExternal() const;
+
+  /**
+   * Returns the pixel buffer of the Image.
+   * The application developer can write to the buffer.
+   * Upload the modified contents with Update().
+   * @return the pixel buffer
+   */
+  PixelBuffer* GetBuffer();
+
+  /**
+   * Returns buffer size in bytes.
+   * @return the buffer size in bytes
+   */
+  unsigned int GetBufferSize() const;
+
+  /**
+   * Returns buffer stride (in bytes).
+   * @return the buffer stride
+   */
+  unsigned int GetBufferStride() const;
+
+  /**
+   * Get the pixel format
+   * @return The pixel format
+   */
+  Pixel::Format GetPixelFormat() const;
+
+protected: // From Resource
+  /**
+   * @copydoc Dali::Internal::Image::Connect
+   */
+  virtual void Connect();
+
+  /**
+   * @copydoc Dali::Internal::Image::Disconnect
+   */
+  virtual void Disconnect();
+
+  /**
+   * Get the bitmap from local cache or ticket.
+   **/
+  Integration::Bitmap * GetBitmap() const;
+
+private:
+  bool mIsDataExternal; ///< whether application holds ownership of pixel buffer or not
+
+  ResourceClient*            mResourceClient;
+
+protected:
+  Integration::BitmapPtr     mBitmapCached;
+};
+
+} // namespace Internal
+
+/**
+ * Helper methods for public API.
+ */
+inline Internal::BufferImage& GetImplementation(Dali::BufferImage& image)
+{
+  DALI_ASSERT_ALWAYS( image && "BufferImage handle is empty" );
+
+  BaseObject& handle = image.GetBaseObject();
+
+  return static_cast<Internal::BufferImage&>(handle);
+}
+
+inline const Internal::BufferImage& GetImplementation(const Dali::BufferImage& image)
+{
+  DALI_ASSERT_ALWAYS( image && "BufferImage handle is empty" );
+
+  const BaseObject& handle = image.GetBaseObject();
+
+  return static_cast<const Internal::BufferImage&>(handle);
+}
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_BUFFER_IMAGE_H__
index 18d3ce9d916a9dfa96f90cb313f5e7856072fd0f..0f13a5ec07c20fba30bb6d082d538690d373a6c9 100644 (file)
@@ -199,9 +199,9 @@ Rect<int> NinePatchImage::GetChildRectangle()
   return mChildRectangle;
 }
 
-Internal::BitmapImagePtr NinePatchImage::CreateCroppedBitmapImage()
+Internal::BufferImagePtr NinePatchImage::CreateCroppedBufferImage()
 {
-  BitmapImagePtr cropped;
+  BufferImagePtr cropped;
 
   if( ! mBitmap )
   {
@@ -211,7 +211,7 @@ Internal::BitmapImagePtr NinePatchImage::CreateCroppedBitmapImage()
   {
     Pixel::Format pixelFormat = mBitmap->GetPixelFormat();
 
-    cropped = BitmapImage::New( mWidth-2, mHeight-2, pixelFormat, Dali::Image::NEVER );
+    cropped = BufferImage::New( mWidth-2, mHeight-2, pixelFormat, Dali::Image::NEVER );
 
     Integration::Bitmap::PackedPixelsProfile* srcProfile = mBitmap->GetPackedPixelsProfile();
     DALI_ASSERT_DEBUG( srcProfile && "Wrong profile for source bitmap");
index 397407576c7c85b91292f53388590add157fc2c6..1c81e2ecb4d7f64e3a930e291a48557e907be72b 100644 (file)
@@ -21,7 +21,7 @@
 // INTERNAL INCLUDES
 #include <dali/public-api/images/nine-patch-image.h>
 #include <dali/internal/event/images/resource-image-impl.h>
-#include <dali/internal/event/images/bitmap-image-impl.h>
+#include <dali/internal/event/images/buffer-image-impl.h>
 
 namespace Dali
 {
@@ -107,7 +107,7 @@ public:
    *
    * @return the cropped bitmap.
    */
-  BitmapImagePtr CreateCroppedBitmapImage();
+  BufferImagePtr CreateCroppedBufferImage();
 
 
 protected: // From Resource
index fee2d9efaa7c2d75b48a7f9f81f092fa83581de3..5904995fef6af6a028c18ffec705805feaa24a07 100644 (file)
@@ -73,7 +73,7 @@ internal_src_files = \
   $(internal_src_dir)/event/images/bitmap-packed-pixel.cpp \
   $(internal_src_dir)/event/images/bitmap-compressed.cpp \
   $(internal_src_dir)/event/images/image-impl.cpp \
-  $(internal_src_dir)/event/images/bitmap-image-impl.cpp \
+  $(internal_src_dir)/event/images/buffer-image-impl.cpp \
   $(internal_src_dir)/event/images/frame-buffer-image-impl.cpp \
   $(internal_src_dir)/event/images/encoded-buffer-image-impl.cpp \
   $(internal_src_dir)/event/images/image-connector.cpp \
index 20a1c6aa7b81095b419a91727e3326b00a4bbac5..38c8fb21350e39d8cfe9160473bdc16873162247 100644 (file)
@@ -23,7 +23,7 @@
 
 // INTERNAL INCLUDES
 #include <dali/public-api/images/native-image-interface.h>
-#include <dali/public-api/images/bitmap-image.h>
+#include <dali/public-api/images/buffer-image.h>
 #include <dali/public-api/images/pixel.h>
 #include <dali/internal/common/message.h>
 #include <dali/internal/update/common/scene-graph-buffers.h>
index f06a2256792c91653b1815ea9aebc8dee0876f31..28179c314895c1ba5f7e2a7cedaa8615d582a0c0 100644 (file)
@@ -23,7 +23,7 @@
 #include <stdint.h>
 
 // INTERNAL INCLUDES
-#include <dali/public-api/images/bitmap-image.h>
+#include <dali/public-api/images/buffer-image.h>
 #include <dali/internal/common/message.h>
 #include <dali/internal/render/gl-resources/texture.h>
 #include <dali/internal/render/gl-resources/texture-cache.h>
index 103a690222a467e9740b5654c51982bad6c1da5e..55dc43a0991243a8a2331040e84c49e2acb5659d 100644 (file)
@@ -24,7 +24,7 @@
 // INTERNAL INCLUDES
 #include <dali/public-api/images/image.h>
 #include <dali/public-api/images/native-image-interface.h>
-#include <dali/public-api/images/bitmap-image.h>
+#include <dali/public-api/images/buffer-image.h>
 #include <dali/public-api/common/ref-counted-dali-vector.h>
 
 #include <dali/integration-api/bitmap.h>
index 4d93efcc82b71c3f1ac8fd593df34be5d28eee53..d074e68761b1cef2a4bc248462162be850122123 100644 (file)
@@ -92,7 +92,7 @@
 #include <dali/public-api/geometry/spline.h>
 
 #include <dali/public-api/images/atlas.h>
-#include <dali/public-api/images/bitmap-image.h>
+#include <dali/public-api/images/buffer-image.h>
 #include <dali/public-api/images/distance-field.h>
 #include <dali/public-api/images/encoded-buffer-image.h>
 #include <dali/public-api/images/frame-buffer-image.h>
index 34187bd4bdefd4a74b29eb0796cd4478681c6fa7..d2451d3fbed003e1971cfe5087f083bc63530902 100644 (file)
@@ -63,7 +63,7 @@ public_api_src_files = \
   $(public_api_src_dir)/images/image.cpp \
   $(public_api_src_dir)/images/image-attributes.cpp \
   $(public_api_src_dir)/images/pixel.cpp \
-  $(public_api_src_dir)/images/bitmap-image.cpp \
+  $(public_api_src_dir)/images/buffer-image.cpp \
   $(public_api_src_dir)/images/frame-buffer-image.cpp \
   $(public_api_src_dir)/images/encoded-buffer-image.cpp \
   $(public_api_src_dir)/images/nine-patch-image.cpp \
@@ -213,7 +213,7 @@ public_api_core_geometry_header_files = \
 
 public_api_core_images_header_files = \
   $(public_api_src_dir)/images/atlas.h \
-  $(public_api_src_dir)/images/bitmap-image.h \
+  $(public_api_src_dir)/images/buffer-image.h \
   $(public_api_src_dir)/images/distance-field.h \
   $(public_api_src_dir)/images/encoded-buffer-image.h \
   $(public_api_src_dir)/images/frame-buffer-image.h \
index b41c00c520ec81e53770d1f6492ef78ff622f8b6..ddeb054249c2b59a81df0d4a5a657049f19202cc 100644 (file)
@@ -20,7 +20,7 @@
 
 // INTERNAL INCLUDES
 #include <dali/internal/event/images/atlas-impl.h>
-#include <dali/internal/event/images/bitmap-image-impl.h>
+#include <dali/internal/event/images/buffer-image-impl.h>
 
 namespace Dali
 {
@@ -39,11 +39,11 @@ Atlas::Atlas()
 {
 }
 
-bool Atlas::Upload( const BitmapImage& bitmap,
+bool Atlas::Upload( const BufferImage& bufferImage,
                     std::size_t xOffset,
                     std::size_t yOffset )
 {
-  return GetImplementation(*this).Upload( GetImplementation(bitmap), xOffset, yOffset );
+  return GetImplementation(*this).Upload( GetImplementation(bufferImage), xOffset, yOffset );
 }
 
 Atlas Atlas::DownCast( BaseHandle handle )
index 971963523fd9b447104b3b5af04e41755b16b721..454cc6fe49806e7358a4f2adfe51c2a91e51176b 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <dali/public-api/common/dali-common.h>
 #include <dali/public-api/images/image.h>
-#include <dali/public-api/images/bitmap-image.h>
+#include <dali/public-api/images/buffer-image.h>
 
 namespace Dali
 {
@@ -66,12 +66,12 @@ public:
    * @brief Upload a bitmap to the atlas.
    *
    * @pre The bitmap pixel format must match the Atlas format.
-   * @param [in] bitmap The bitmap to upload.
+   * @param [in] bufferImage The buffer image to upload.
    * @param [in] xOffset Specifies an offset in the x direction within the atlas.
    * @param [in] yOffset Specifies an offset in the y direction within the atlas.
    * @return True if the bitmap fits within the atlas at the specified offset.
    */
-  bool Upload( const BitmapImage& bitmap,
+  bool Upload( const BufferImage& bufferImage,
                std::size_t xOffset,
                std::size_t yOffset );
 
diff --git a/dali/public-api/images/bitmap-image.cpp b/dali/public-api/images/bitmap-image.cpp
deleted file mode 100644 (file)
index 4f8ef6a..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * 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/public-api/images/bitmap-image.h>
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/debug.h>
-#include <dali/public-api/common/dali-common.h>
-#include <dali/internal/event/images/bitmap-image-impl.h>
-
-namespace Dali
-{
-
-BitmapImage::BitmapImage()
-{
-}
-
-BitmapImage::BitmapImage(Internal::BitmapImage* internal)
-  : Image(internal)
-{
-}
-
-BitmapImage BitmapImage::DownCast( BaseHandle handle )
-{
-  return BitmapImage( dynamic_cast<Dali::Internal::BitmapImage*>(handle.GetObjectPtr()) );
-}
-
-BitmapImage::~BitmapImage()
-{
-}
-
-BitmapImage::BitmapImage(const BitmapImage& handle)
-: Image(handle)
-{
-}
-
-BitmapImage& BitmapImage::operator=(const BitmapImage& rhs)
-{
-  BaseHandle::operator=(rhs);
-  return *this;
-}
-
-const BitmapImage BitmapImage::WHITE()
-{
-  Internal::BitmapImage* internal = new Internal::BitmapImage(1,1,Pixel::RGBA8888, Dali::Image::NEVER);
-  PixelBuffer* pBuf = internal->GetBuffer();
-  pBuf[0] = pBuf[1] = pBuf[2] = pBuf[3] = 0xFF;
-  return BitmapImage(internal);
-}
-
-BitmapImage BitmapImage::New(unsigned int width, unsigned int height, Pixel::Format pixelformat)
-{
-  DALI_ASSERT_ALWAYS( 0u != width  && "Invalid BitmapImage width requested" );
-  DALI_ASSERT_ALWAYS( 0u != height && "Invalid BitmapImage height requested" );
-
-  Internal::BitmapImagePtr internal = Internal::BitmapImage::New(width, height, pixelformat);
-  return BitmapImage(internal.Get());
-}
-
-BitmapImage BitmapImage::New(unsigned int width, unsigned int height, Pixel::Format pixelformat, ReleasePolicy releasePol)
-{
-  DALI_ASSERT_ALWAYS( 0u != width  && "Invalid BitmapImage width requested" );
-  DALI_ASSERT_ALWAYS( 0u != height && "Invalid BitmapImage height requested" );
-
-  Internal::BitmapImagePtr internal = Internal::BitmapImage::New(width, height, pixelformat, releasePol);
-  return BitmapImage(internal.Get());
-}
-
-BitmapImage BitmapImage::New(PixelBuffer* pixBuf, unsigned int width, unsigned int height, Pixel::Format pixelformat, unsigned int stride)
-{
-  DALI_ASSERT_ALWAYS( 0u != width  && "Invalid BitmapImage width requested" );
-  DALI_ASSERT_ALWAYS( 0u != height && "Invalid BitmapImage height requested" );
-
-  Internal::BitmapImagePtr internal = Internal::BitmapImage::New(pixBuf, width, height, pixelformat, stride);
-  return BitmapImage(internal.Get());
-}
-
-BitmapImage BitmapImage::New(PixelBuffer* pixBuf, unsigned int width, unsigned int height, Pixel::Format pixelformat, unsigned int stride, ReleasePolicy releasePol)
-{
-  DALI_ASSERT_ALWAYS( 0u != width  && "Invalid BitmapImage width requested" );
-  DALI_ASSERT_ALWAYS( 0u != height && "Invalid BitmapImage height requested" );
-  Internal::BitmapImagePtr internal = Internal::BitmapImage::New(pixBuf, width, height, pixelformat, stride, releasePol);
-  return BitmapImage(internal.Get());
-}
-
-PixelBuffer* BitmapImage::GetBuffer()
-{
-  return GetImplementation(*this).GetBuffer();
-}
-
-unsigned int BitmapImage::GetBufferSize() const
-{
-  return GetImplementation(*this).GetBufferSize();
-}
-
-unsigned int BitmapImage::GetBufferStride() const
-{
-  return GetImplementation(*this).GetBufferStride();
-}
-
-Pixel::Format BitmapImage::GetPixelFormat() const
-{
-  return GetImplementation(*this).GetPixelFormat();
-}
-
-void BitmapImage::Update ()
-{
-  RectArea area;
-  GetImplementation(*this).Update(area);
-}
-
-void BitmapImage::Update (RectArea updateArea)
-{
-  GetImplementation(*this).Update(updateArea);
-}
-
-bool BitmapImage::IsDataExternal() const
-{
-  return GetImplementation(*this).IsDataExternal();
-}
-
-} // namespace Dali
diff --git a/dali/public-api/images/bitmap-image.h b/dali/public-api/images/bitmap-image.h
deleted file mode 100644 (file)
index 59febaf..0000000
+++ /dev/null
@@ -1,294 +0,0 @@
-#ifndef __DALI_BITMAP_IMAGE_H__
-#define __DALI_BITMAP_IMAGE_H__
-
-/*
- * 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/images/image.h>
-#include <dali/public-api/images/pixel.h>
-#include <dali/public-api/math/rect.h>
-
-namespace Dali
-{
-
-namespace Internal DALI_INTERNAL
-{
-class BitmapImage;
-}
-
-typedef unsigned char         PixelBuffer;  ///< pixel data buffer
-typedef Rect<unsigned int>    RectArea;     ///< rectangular area (x,y,w,h)
-
-
-/**
- * @brief BitmapImage represents an image resource that can be added to ImageActors.
- * Its pixel buffer data is provided by the application developer.
- *
- * Care should be taken with pixel data allocated by the application,
- * as the data is copied to GL both when the image is added to the
- * stage and after a call to Update().  In both of these cases, a
- * SignalUploaded will be sent to the application confirming that the
- * operation has completed.
- *
- * The application can free the pixel data after receiving a
- * SignalUploaded.
- *
- * Similarly, once the image is on stage (i.e. it's being used by an
- * ImageActor that is on stage), the application should only write to
- * the buffer after receiving a SignalUploaded, then call Update()
- * once the write is finished. This avoids the pixel data being changed
- * whilst it's being copied to GL. Writing to the buffer without waiting
- * for the signal will likely result in visible tearing.
- *
- * If the pixel format of the pixel buffer contains an alpha channel,
- * then the image is considered to be have transparent pixels without
- * regard for the actual content of the channel, and will be blended.
- *
- * If the image is opaque and blending is not required, then the user
- * should call ImageActor::SetUseImageAlpha(false) on the containing actor.
- */
-class DALI_IMPORT_API BitmapImage : public Image
-{
-public:
-  /**
-   * @brief Constructor which creates an uninitialized BitmapImage object.
-   *
-   * Use BitmapImage::New(...) to create an initialised object.
-   */
-  BitmapImage();
-
-  /**
-   * @brief Create a new BitmapImage.
-   *
-   * Also a pixel buffer for image data is allocated.
-   * Dali has ownership of the buffer.
-   * For better performance and portability use power of two dimensions.
-   * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
-   * @note: default resource management policies are Immediate and Never
-   *
-   * @pre width & height are greater than zero
-   * @param [in] width       image width in pixels
-   * @param [in] height      image height in pixels
-   * @param [in] pixelformat the pixel format (rgba 32 bit by default)
-   * @return a handle to a new instance of BitmapImage
-   */
-  static BitmapImage New(unsigned int width,
-                         unsigned int height,
-                         Pixel::Format pixelformat=Pixel::RGBA8888);
-
-  /**
-   * @brief Create a new BitmapImage.
-   *
-   * Also a pixel buffer for image data is allocated.
-   * Dali has ownership of the buffer.
-   * For better performance and portability use power of two dimensions.
-   * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
-   *
-   * @pre width & height are greater than zero
-   * @param [in] width          Image width in pixels
-   * @param [in] height         Image height in pixels
-   * @param [in] pixelFormat    The pixel format
-   * @param [in] releasePolicy  Optionally release memory when image is not visible on screen.
-   * @return a handle to a new instance of BitmapImage
-   */
-  static BitmapImage New(unsigned int  width,
-                         unsigned int  height,
-                         Pixel::Format pixelFormat,
-                         ReleasePolicy releasePolicy);
-
-  /**
-   * @brief Create a new BitmapImage, which uses an external data source.
-   *
-   * The PixelBuffer has to be allocated by application.
-   *
-   * The application holds ownership of the buffer. It must not
-   * destroy the PixelBuffer on a staged image if it has called
-   * Update() and hasn't received a SignalUploaded, or if it has just
-   * added it to the stage and has not received a SignalUploaded.
-   *
-   * For better performance and portability use power of two dimensions.
-   * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
-   *
-   * @pre width & height are greater than zero
-   * @param [in] pixelBuffer  pixel buffer. has to be allocated by application.
-   * @param [in] width        image width in pixels
-   * @param [in] height       image height in pixels
-   * @param [in] pixelFormat  the pixel format (rgba 32 bit by default)
-   * @param [in] stride       the internal stride of the pixelbuffer in pixels
-   * @return a handle to a new instance of BitmapImage
-   */
-  static BitmapImage New(PixelBuffer*  pixelBuffer,
-                         unsigned int  width,
-                         unsigned int  height,
-                         Pixel::Format pixelFormat=Pixel::RGBA8888,
-                         unsigned int  stride=0);
-
-  /**
-   * @brief Create a new BitmapImage, which uses an external data source.
-   *
-   * The PixelBuffer has to be allocated by application.
-   *
-   * The application holds ownership of the buffer. It must not
-   * destroy the PixelBuffer on a staged image if it has called
-   * Update() and hasn't received a SignalUploaded, or if it has just
-   * added it to the stage and has not received a SignalUploaded.
-   *
-   * For better performance and portability use power of two dimensions.
-   * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
-   *
-   * @note in case releasePolicy is "Unused", application has to call
-   * BitmapImage::Update() whenever image is re-added to the stage
-   *
-   * @pre width & height are greater than zero
-   * @param [in] pixelBuffer   pixel buffer. has to be allocated by application.
-   * @param [in] width         image width in pixels
-   * @param [in] height        image height in pixels
-   * @param [in] pixelFormat   the pixel format
-   * @param [in] stride        the internal stride of the pixelbuffer in pixels
-   * @param [in] releasePolicy optionally relase memory when image is not visible on screen.
-   * @return a handle to a new instance of BitmapImage
-   */
-  static BitmapImage New(PixelBuffer*  pixelBuffer,
-                         unsigned int  width,
-                         unsigned int  height,
-                         Pixel::Format pixelFormat,
-                         unsigned int  stride,
-                         ReleasePolicy releasePolicy);
-
-  /**
-   * @brief Downcast an Object handle to BitmapImage.
-   *
-   * If handle points to a BitmapImage the downcast produces valid
-   * handle. If not the returned handle is left uninitialized.
-   *
-   * @param[in] handle to An object
-   * @return handle to a BitmapImage or an uninitialized handle
-   */
-  static BitmapImage DownCast( BaseHandle handle );
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~BitmapImage();
-
-  /**
-   * @brief This copy constructor is required for (smart) pointer semantics.
-   *
-   * @param [in] handle A reference to the copied handle
-   */
-  BitmapImage(const BitmapImage& handle);
-
-  /**
-   * @brief This assignment operator is required for (smart) pointer semantics.
-   *
-   * @param [in] rhs  A reference to the copied handle
-   * @return A reference to this
-   */
-  BitmapImage& operator=(const BitmapImage& rhs);
-
-  /**
-   * @brief White pixel as image data.
-   *
-   * Can be used to create solid color actors.
-   * @return 1 white pixel with 32 bit colordepth
-   */
-  static const BitmapImage WHITE();
-
-public:
-  /**
-   * @brief Returns the pixel buffer of the Image.
-   *
-   * The application can write to the buffer to modify its contents.
-   *
-   * Whilst the image is on stage, after writing to the buffer the
-   * application should call Update() and wait for the
-   * SignalUploaded() method before writing again.
-   *
-   * @return the pixel buffer
-   */
-  PixelBuffer* GetBuffer();
-
-  /**
-   * @brief Returns buffer size in bytes.
-   *
-   * @return the buffer size in bytes
-   */
-  unsigned int GetBufferSize() const;
-
-  /**
-   * @brief Returns buffer stride (in bytes).
-   *
-   * @return the buffer stride
-   */
-  unsigned int GetBufferStride() const;
-
-  /**
-   * @brief Returns the pixel format of the contained bitmap
-   *
-   * @return the pixel format
-   */
-  Pixel::Format GetPixelFormat() const;
-
-  /**
-   * @brief Inform Dali that the contents of the buffer have changed.
-   *
-   * SignalUploaded will be sent in response if the image is on stage
-   * and the image data has been successfully copied to graphics
-   * memory. To avoid visual tearing, the application should wait for
-   * the SignalUploaded before modifying the data.
-   *
-   * The application must not destroy an external PixelBuffer on a staged
-   * image after calling this method until the SignalUploaded has been
-   * successfully received.
-   *
-   * @note: BitmapImage::Update might not work with BGR/BGRA formats!
-   * @note: Some GPUs may not support Non power of two buffer updates (for
-   * example C110/SGX540)
-   */
-  void Update();
-
-  /**
-   * @copydoc Update()
-   * @param [in] updateArea area that has changed in buffer
-   */
-  void Update( RectArea updateArea );
-
-  /**
-   * @brief Returns whether BitmapImage uses external data source or not.
-   *
-   * If not, dali holds ownership of the PixelBuffer, otherwise the application
-   * is responsible for freeing it.
-   *
-   * The application must not destroy an external PixelBuffer on a staged image
-   * if it has called Update() and hasn't received a SignalUploaded.
-   *
-   * @return true if application owns data, false otherwise
-   */
-  bool IsDataExternal() const;
-
-public: // Not intended for application developers
-
-  explicit DALI_INTERNAL BitmapImage(Internal::BitmapImage*);
-};
-
-} // namespace Dali
-
-#endif // __DALI_BITMAP_IMAGE_H__
diff --git a/dali/public-api/images/buffer-image.cpp b/dali/public-api/images/buffer-image.cpp
new file mode 100644 (file)
index 0000000..d3da5bb
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * 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/public-api/images/buffer-image.h>
+
+// INTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+#include <dali/public-api/common/dali-common.h>
+#include <dali/internal/event/images/buffer-image-impl.h>
+
+namespace Dali
+{
+
+BufferImage::BufferImage()
+{
+}
+
+BufferImage::BufferImage(Internal::BufferImage* internal)
+  : Image(internal)
+{
+}
+
+BufferImage BufferImage::DownCast( BaseHandle handle )
+{
+  return BufferImage( dynamic_cast<Dali::Internal::BufferImage*>(handle.GetObjectPtr()) );
+}
+
+BufferImage::~BufferImage()
+{
+}
+
+BufferImage::BufferImage(const BufferImage& handle)
+: Image(handle)
+{
+}
+
+BufferImage& BufferImage::operator=(const BufferImage& rhs)
+{
+  BaseHandle::operator=(rhs);
+  return *this;
+}
+
+const BufferImage BufferImage::WHITE()
+{
+  Internal::BufferImage* internal = new Internal::BufferImage(1,1,Pixel::RGBA8888, Dali::Image::NEVER);
+  PixelBuffer* pBuf = internal->GetBuffer();
+  pBuf[0] = pBuf[1] = pBuf[2] = pBuf[3] = 0xFF;
+  return BufferImage(internal);
+}
+
+BufferImage BufferImage::New(unsigned int width, unsigned int height, Pixel::Format pixelformat)
+{
+  DALI_ASSERT_ALWAYS( 0u != width  && "Invalid BufferImage width requested" );
+  DALI_ASSERT_ALWAYS( 0u != height && "Invalid BufferImage height requested" );
+
+  Internal::BufferImagePtr internal = Internal::BufferImage::New(width, height, pixelformat);
+  return BufferImage(internal.Get());
+}
+
+BufferImage BufferImage::New(unsigned int width, unsigned int height, Pixel::Format pixelformat, ReleasePolicy releasePol)
+{
+  DALI_ASSERT_ALWAYS( 0u != width  && "Invalid BufferImage width requested" );
+  DALI_ASSERT_ALWAYS( 0u != height && "Invalid BufferImage height requested" );
+
+  Internal::BufferImagePtr internal = Internal::BufferImage::New(width, height, pixelformat, releasePol);
+  return BufferImage(internal.Get());
+}
+
+BufferImage BufferImage::New(PixelBuffer* pixBuf, unsigned int width, unsigned int height, Pixel::Format pixelformat, unsigned int stride)
+{
+  DALI_ASSERT_ALWAYS( 0u != width  && "Invalid BufferImage width requested" );
+  DALI_ASSERT_ALWAYS( 0u != height && "Invalid BufferImage height requested" );
+
+  Internal::BufferImagePtr internal = Internal::BufferImage::New(pixBuf, width, height, pixelformat, stride);
+  return BufferImage(internal.Get());
+}
+
+BufferImage BufferImage::New(PixelBuffer* pixBuf, unsigned int width, unsigned int height, Pixel::Format pixelformat, unsigned int stride, ReleasePolicy releasePol)
+{
+  DALI_ASSERT_ALWAYS( 0u != width  && "Invalid BufferImage width requested" );
+  DALI_ASSERT_ALWAYS( 0u != height && "Invalid BufferImage height requested" );
+  Internal::BufferImagePtr internal = Internal::BufferImage::New(pixBuf, width, height, pixelformat, stride, releasePol);
+  return BufferImage(internal.Get());
+}
+
+PixelBuffer* BufferImage::GetBuffer()
+{
+  return GetImplementation(*this).GetBuffer();
+}
+
+unsigned int BufferImage::GetBufferSize() const
+{
+  return GetImplementation(*this).GetBufferSize();
+}
+
+unsigned int BufferImage::GetBufferStride() const
+{
+  return GetImplementation(*this).GetBufferStride();
+}
+
+Pixel::Format BufferImage::GetPixelFormat() const
+{
+  return GetImplementation(*this).GetPixelFormat();
+}
+
+void BufferImage::Update ()
+{
+  RectArea area;
+  GetImplementation(*this).Update(area);
+}
+
+void BufferImage::Update (RectArea updateArea)
+{
+  GetImplementation(*this).Update(updateArea);
+}
+
+bool BufferImage::IsDataExternal() const
+{
+  return GetImplementation(*this).IsDataExternal();
+}
+
+} // namespace Dali
diff --git a/dali/public-api/images/buffer-image.h b/dali/public-api/images/buffer-image.h
new file mode 100644 (file)
index 0000000..14b0bae
--- /dev/null
@@ -0,0 +1,294 @@
+#ifndef __DALI_BUFFER_IMAGE_H__
+#define __DALI_BUFFER_IMAGE_H__
+
+/*
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/images/image.h>
+#include <dali/public-api/images/pixel.h>
+#include <dali/public-api/math/rect.h>
+
+namespace Dali
+{
+
+namespace Internal DALI_INTERNAL
+{
+class BufferImage;
+}
+
+typedef unsigned char         PixelBuffer;  ///< pixel data buffer
+typedef Rect<unsigned int>    RectArea;     ///< rectangular area (x,y,w,h)
+
+
+/**
+ * @brief BufferImage represents an image resource that can be added to ImageActors.
+ * Its pixel buffer data is provided by the application developer.
+ *
+ * Care should be taken with pixel data allocated by the application,
+ * as the data is copied to GL both when the image is added to the
+ * stage and after a call to Update().  In both of these cases, a
+ * SignalUploaded will be sent to the application confirming that the
+ * operation has completed.
+ *
+ * The application can free the pixel data after receiving a
+ * SignalUploaded.
+ *
+ * Similarly, once the image is on stage (i.e. it's being used by an
+ * ImageActor that is on stage), the application should only write to
+ * the buffer after receiving a SignalUploaded, then call Update()
+ * once the write is finished. This avoids the pixel data being changed
+ * whilst it's being copied to GL. Writing to the buffer without waiting
+ * for the signal will likely result in visible tearing.
+ *
+ * If the pixel format of the pixel buffer contains an alpha channel,
+ * then the image is considered to be have transparent pixels without
+ * regard for the actual content of the channel, and will be blended.
+ *
+ * If the image is opaque and blending is not required, then the user
+ * should call ImageActor::SetUseImageAlpha(false) on the containing actor.
+ */
+class DALI_IMPORT_API BufferImage : public Image
+{
+public:
+  /**
+   * @brief Constructor which creates an uninitialized BufferImage object.
+   *
+   * Use BufferImage::New(...) to create an initialised object.
+   */
+  BufferImage();
+
+  /**
+   * @brief Create a new BufferImage.
+   *
+   * Also a pixel buffer for image data is allocated.
+   * Dali has ownership of the buffer.
+   * For better performance and portability use power of two dimensions.
+   * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
+   * @note: default resource management policies are Immediate and Never
+   *
+   * @pre width & height are greater than zero
+   * @param [in] width       image width in pixels
+   * @param [in] height      image height in pixels
+   * @param [in] pixelformat the pixel format (rgba 32 bit by default)
+   * @return a handle to a new instance of BufferImage
+   */
+  static BufferImage New(unsigned int width,
+                         unsigned int height,
+                         Pixel::Format pixelformat=Pixel::RGBA8888);
+
+  /**
+   * @brief Create a new BufferImage.
+   *
+   * Also a pixel buffer for image data is allocated.
+   * Dali has ownership of the buffer.
+   * For better performance and portability use power of two dimensions.
+   * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
+   *
+   * @pre width & height are greater than zero
+   * @param [in] width          Image width in pixels
+   * @param [in] height         Image height in pixels
+   * @param [in] pixelFormat    The pixel format
+   * @param [in] releasePolicy  Optionally release memory when image is not visible on screen.
+   * @return a handle to a new instance of BufferImage
+   */
+  static BufferImage New(unsigned int  width,
+                         unsigned int  height,
+                         Pixel::Format pixelFormat,
+                         ReleasePolicy releasePolicy);
+
+  /**
+   * @brief Create a new BufferImage, which uses an external data source.
+   *
+   * The PixelBuffer has to be allocated by application.
+   *
+   * The application holds ownership of the buffer. It must not
+   * destroy the PixelBuffer on a staged image if it has called
+   * Update() and hasn't received a SignalUploaded, or if it has just
+   * added it to the stage and has not received a SignalUploaded.
+   *
+   * For better performance and portability use power of two dimensions.
+   * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
+   *
+   * @pre width & height are greater than zero
+   * @param [in] pixelBuffer  pixel buffer. has to be allocated by application.
+   * @param [in] width        image width in pixels
+   * @param [in] height       image height in pixels
+   * @param [in] pixelFormat  the pixel format (rgba 32 bit by default)
+   * @param [in] stride       the internal stride of the pixelbuffer in pixels
+   * @return a handle to a new instance of BufferImage
+   */
+  static BufferImage New(PixelBuffer*  pixelBuffer,
+                         unsigned int  width,
+                         unsigned int  height,
+                         Pixel::Format pixelFormat=Pixel::RGBA8888,
+                         unsigned int  stride=0);
+
+  /**
+   * @brief Create a new BufferImage, which uses an external data source.
+   *
+   * The PixelBuffer has to be allocated by application.
+   *
+   * The application holds ownership of the buffer. It must not
+   * destroy the PixelBuffer on a staged image if it has called
+   * Update() and hasn't received a SignalUploaded, or if it has just
+   * added it to the stage and has not received a SignalUploaded.
+   *
+   * For better performance and portability use power of two dimensions.
+   * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
+   *
+   * @note in case releasePolicy is "Unused", application has to call
+   * BufferImage::Update() whenever image is re-added to the stage
+   *
+   * @pre width & height are greater than zero
+   * @param [in] pixelBuffer   pixel buffer. has to be allocated by application.
+   * @param [in] width         image width in pixels
+   * @param [in] height        image height in pixels
+   * @param [in] pixelFormat   the pixel format
+   * @param [in] stride        the internal stride of the pixelbuffer in pixels
+   * @param [in] releasePolicy optionally relase memory when image is not visible on screen.
+   * @return a handle to a new instance of BufferImage
+   */
+  static BufferImage New(PixelBuffer*  pixelBuffer,
+                         unsigned int  width,
+                         unsigned int  height,
+                         Pixel::Format pixelFormat,
+                         unsigned int  stride,
+                         ReleasePolicy releasePolicy);
+
+  /**
+   * @brief Downcast an Object handle to BufferImage.
+   *
+   * If handle points to a BufferImage the downcast produces valid
+   * handle. If not the returned handle is left uninitialized.
+   *
+   * @param[in] handle to An object
+   * @return handle to a BufferImage or an uninitialized handle
+   */
+  static BufferImage DownCast( BaseHandle handle );
+
+  /**
+   * @brief Destructor
+   *
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   */
+  ~BufferImage();
+
+  /**
+   * @brief This copy constructor is required for (smart) pointer semantics.
+   *
+   * @param [in] handle A reference to the copied handle
+   */
+  BufferImage(const BufferImage& handle);
+
+  /**
+   * @brief This assignment operator is required for (smart) pointer semantics.
+   *
+   * @param [in] rhs  A reference to the copied handle
+   * @return A reference to this
+   */
+  BufferImage& operator=(const BufferImage& rhs);
+
+  /**
+   * @brief White pixel as image data.
+   *
+   * Can be used to create solid color actors.
+   * @return 1 white pixel with 32 bit colordepth
+   */
+  static const BufferImage WHITE();
+
+public:
+  /**
+   * @brief Returns the pixel buffer of the Image.
+   *
+   * The application can write to the buffer to modify its contents.
+   *
+   * Whilst the image is on stage, after writing to the buffer the
+   * application should call Update() and wait for the
+   * SignalUploaded() method before writing again.
+   *
+   * @return the pixel buffer
+   */
+  PixelBuffer* GetBuffer();
+
+  /**
+   * @brief Returns buffer size in bytes.
+   *
+   * @return the buffer size in bytes
+   */
+  unsigned int GetBufferSize() const;
+
+  /**
+   * @brief Returns buffer stride (in bytes).
+   *
+   * @return the buffer stride
+   */
+  unsigned int GetBufferStride() const;
+
+  /**
+   * @brief Returns the pixel format of the contained buffer
+   *
+   * @return the pixel format
+   */
+  Pixel::Format GetPixelFormat() const;
+
+  /**
+   * @brief Inform Dali that the contents of the buffer have changed.
+   *
+   * SignalUploaded will be sent in response if the image is on stage
+   * and the image data has been successfully copied to graphics
+   * memory. To avoid visual tearing, the application should wait for
+   * the SignalUploaded before modifying the data.
+   *
+   * The application must not destroy an external PixelBuffer on a staged
+   * image after calling this method until the SignalUploaded has been
+   * successfully received.
+   *
+   * @note: BufferImage::Update might not work with BGR/BGRA formats!
+   * @note: Some GPUs may not support Non power of two buffer updates (for
+   * example C110/SGX540)
+   */
+  void Update();
+
+  /**
+   * @copydoc Update()
+   * @param [in] updateArea area that has changed in buffer
+   */
+  void Update( RectArea updateArea );
+
+  /**
+   * @brief Returns whether BufferImage uses external data source or not.
+   *
+   * If not, dali holds ownership of the PixelBuffer, otherwise the application
+   * is responsible for freeing it.
+   *
+   * The application must not destroy an external PixelBuffer on a staged image
+   * if it has called Update() and hasn't received a SignalUploaded.
+   *
+   * @return true if application owns data, false otherwise
+   */
+  bool IsDataExternal() const;
+
+public: // Not intended for application developers
+
+  explicit DALI_INTERNAL BufferImage(Internal::BufferImage*);
+};
+
+} // namespace Dali
+
+#endif // __DALI_BUFFER_IMAGE_H__
index 1d57a649550fe93752e6f429cec78456c3903ef1..30b5208f7bdf96d4535c6019cff2dd6fbb74d903 100644 (file)
@@ -19,7 +19,7 @@
 #include <dali/public-api/images/glyph-image.h>
 
 // INTERNAL INCLUDES
-#include <dali/public-api/images/bitmap-image.h>
+#include <dali/public-api/images/buffer-image.h>
 #include <dali/public-api/images/resource-image.h>
 #include <dali/public-api/text/text-style.h>
 #include <dali/integration-api/platform-abstraction.h>
@@ -113,13 +113,13 @@ GlyphImage GlyphImage::New( const Character& character, const TextStyle& style )
       // TODO: support more text decoration features: outline, glow, shadow, underline, ...
       const std::size_t width = bitmapPtr->GetImageWidth();
       const std::size_t height = bitmapPtr->GetImageHeight();
-      BitmapImage bitmapImage = BitmapImage::New( width, height, Pixel::RGBA8888 );
+      BufferImage bufferImage = BufferImage::New( width, height, Pixel::RGBA8888 );
 
       // Point the source bitmap buffer.
       unsigned char* src = bitmapPtr->GetBuffer();
 
       // Point the destination image buffer.
-      unsigned char* dst = bitmapImage.GetBuffer();
+      unsigned char* dst = bufferImage.GetBuffer();
 
       //Retrieve the color from the text style.
       const Vector4& color = style.GetTextColor();
@@ -141,9 +141,9 @@ GlyphImage GlyphImage::New( const Character& character, const TextStyle& style )
         }
       }
 
-      bitmapImage.Update();
+      bufferImage.Update();
 
-      image = bitmapImage;
+      image = bufferImage;
     }
   }
 
index 1af2406032ea75d9b679baa1165b53af938b24c7..7a2cec4845ee07a665f18a4fa6f0de7aee35d140 100644 (file)
@@ -150,7 +150,7 @@ public: // Signals
    *
    * It Will be sent after an actor using the image is added to
    * the stage, when such a staged image is reloaded, or when a staged
-   * BitmapImage calls Update().
+   * BufferImage calls Update().
    * @return A signal object to Connect() with.
    */
   ImageSignalType& UploadedSignal();
index 8d13b54b8fd6754063c62d62b8c371c6b4ecb1f2..eb54672ddf3fc087c94c9dd617ef9f4184967769 100644 (file)
@@ -74,10 +74,10 @@ Rect<int> NinePatchImage::GetChildRectangle()
   return GetImplementation(*this).GetChildRectangle();
 }
 
-BitmapImage NinePatchImage::CreateCroppedBitmapImage()
+BufferImage NinePatchImage::CreateCroppedBufferImage()
 {
-  Internal::BitmapImagePtr internal = GetImplementation(*this).CreateCroppedBitmapImage();
-  return BitmapImage(internal.Get());
+  Internal::BufferImagePtr internal = GetImplementation(*this).CreateCroppedBufferImage();
+  return BufferImage(internal.Get());
 }
 
 
index 2facc0525de67ef2e34b41ebe48b1bb3a0e6cd80..ef6569f2d040938c3aa88186ecf1d1d7a1274b74 100644 (file)
@@ -21,7 +21,7 @@
 // INTERNAL INCLUDES
 #include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/images/resource-image.h>
-#include <dali/public-api/images/bitmap-image.h>
+#include <dali/public-api/images/buffer-image.h>
 #include <dali/public-api/math/rect.h>
 
 namespace Dali
@@ -40,11 +40,11 @@ class NinePatchImage;
  * area.
  *
  * The class offers an API to read the stretch area and child area, but it does not
- * remove the border from it's bitmap. An API can be used to obtain a BitmapImage with
+ * remove the border from it's bitmap. An API can be used to obtain a BufferImage with
  * the border removed.
  *
  * Adding this image to an ImageActor using an Image handle will automatically convert
- * to use the cropped BitmapImage - if you don't retain a handle to this object, it will
+ * to use the cropped BufferImage - if you don't retain a handle to this object, it will
  * be automatically destroyed.
  */
 class DALI_IMPORT_API NinePatchImage : public ResourceImage
@@ -115,12 +115,12 @@ public:
   Rect<int> GetChildRectangle();
 
   /**
-   * Creates a bitmap image from the bitmap with the 1 pixel border cropped off.
+   * Creates a buffer image from the bitmap with the 1 pixel border cropped off.
    * This does not change the internal bitmap.
    *
-   * @return The cropped BitmapImage
+   * @return The cropped BufferImage
    */
-  BitmapImage CreateCroppedBitmapImage();
+  BufferImage CreateCroppedBufferImage();
 
 public: // Not intended for application developers
 
index a84eb3c0b589cb77d74309ce7dae2bd8b342f8f2..8b9fb4aee8d425010dc78b18fa0e20906bf3f12a 100644 (file)
@@ -32,7 +32,7 @@ namespace Pixel
 /**
  * @brief Pixel formats
  *
- * @note: BitmapImage::Update might not work with BGR/BGRA formats!
+ * @note: BufferImage::Update might not work with BGR/BGRA formats!
  */
 enum Format ///< pixel format, default color depth is RGBA 32 bit with alpha
 {
index 031076b63ca428bbd8476ddd312245d471abafe6..448b802167e5574e9236054fa4ed926c18c8fb59 100644 (file)
@@ -25,7 +25,7 @@
 #include <dali/public-api/object/type-registry.h>
 #include <dali/internal/event/images/resource-image-impl.h>
 #include <dali/internal/event/images/frame-buffer-image-impl.h>
-#include <dali/internal/event/images/bitmap-image-impl.h>
+#include <dali/internal/event/images/buffer-image-impl.h>
 #include <dali/internal/event/effects/shader-effect-impl.h>
 
 namespace Dali
@@ -328,14 +328,14 @@ Image NewImage( const Property::Value& map )
                                     pixelFormat,
                                     releasePolicy);
       }
-      else if("BitmapImage" == s)
+      else if("BufferImage" == s)
       {
-        ret = BitmapImage::New(attributes.GetWidth(),
+        ret = BufferImage::New(attributes.GetWidth(),
                                attributes.GetHeight(),
                                pixelFormat,
                                releasePolicy);
       }
-      else if("Image" == s || "ResourceImage" == s)
+      else if("ResourceImage" == s)
       {
         ret = ResourceImage::New(filename, attributes, loadPolicy, releasePolicy);
       }
@@ -541,11 +541,11 @@ void CreatePropertyMap( Image image, Property::Map& map )
     std::string imageType( "ResourceImage" );
 
     // Get Type - cannot use TypeRegistry as Image is not an Object and thus, not registered
-    BitmapImage bitmapImage = BitmapImage::DownCast( image );
-    if ( bitmapImage )
+    BufferImage bufferImage = BufferImage::DownCast( image );
+    if ( bufferImage )
     {
-      imageType = "BitmapImage";
-      map[ "pixel-format" ] = GetEnumerationName< Pixel::Format >( bitmapImage.GetPixelFormat(), PIXEL_FORMAT_TABLE, PIXEL_FORMAT_TABLE_COUNT );
+      imageType = "BufferImage";
+      map[ "pixel-format" ] = GetEnumerationName< Pixel::Format >( bufferImage.GetPixelFormat(), PIXEL_FORMAT_TABLE, PIXEL_FORMAT_TABLE_COUNT );
     }
     else if ( FrameBufferImage::DownCast( image ) )
     {
index 17cc49da2f7764c44ee0d02a322bb06576a5fdff..411af54259b8d0916d717af20e6f4b0aefaf4a9c 100644 (file)
@@ -203,7 +203,7 @@ DALI_IMPORT_API Vector3 GetAnchorConstant( const std::string& value );
  * "height"          type FLOAT
  * "pixel-format"    type STRING (enum)
  * "scaling-mode"    type STRING (enum)
- * "type"            type STRING (FrameBufferImage|BitMapImage|Image(default))
+ * "type"            type STRING (FrameBufferImage|BufferImage|ResourceImage(default))
  * @endcode
  * Some fields are optional and some only pertain to a specific type.
  *