Changed remaining image types to use Texture internally 05/111905/7
authorFerran Sole <ferran.sole@samsung.com>
Tue, 24 Jan 2017 14:26:54 +0000 (14:26 +0000)
committerFerran Sole <ferran.sole@samsung.com>
Wed, 25 Jan 2017 15:16:45 +0000 (15:16 +0000)
- FrameBufferImage, NativeImage, EncodedBufferImage and BufferImage use Dali::Texture internally
- Removed Dali::Atlas class as it is not used

Change-Id: Ife1bf687ca314d87cf5974651857dc7242a1ce37

35 files changed:
automated-tests/src/dali/CMakeLists.txt
automated-tests/src/dali/dali-test-suite-utils/test-native-image.h
automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.cpp
automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.h
automated-tests/src/dali/utc-Dali-Actor.cpp
automated-tests/src/dali/utc-Dali-Atlas.cpp [deleted file]
automated-tests/src/dali/utc-Dali-BufferImage.cpp
automated-tests/src/dali/utc-Dali-EncodedBufferImage.cpp
automated-tests/src/dali/utc-Dali-NativeImage.cpp
automated-tests/src/dali/utc-Dali-RenderTask.cpp
automated-tests/src/dali/utc-Dali-Sampler.cpp
automated-tests/src/dali/utc-Dali-TextureSet.cpp
dali/devel-api/file.list
dali/devel-api/images/atlas.cpp [deleted file]
dali/devel-api/images/atlas.h [deleted file]
dali/internal/event/events/hit-test-algorithm-impl.cpp
dali/internal/event/images/atlas-impl.cpp [deleted file]
dali/internal/event/images/atlas-impl.h [deleted file]
dali/internal/event/images/buffer-image-impl.cpp
dali/internal/event/images/buffer-image-impl.h
dali/internal/event/images/encoded-buffer-image-impl.cpp
dali/internal/event/images/frame-buffer-image-impl.cpp
dali/internal/event/images/frame-buffer-image-impl.h
dali/internal/event/images/native-image-impl.cpp
dali/internal/event/images/native-image-impl.h
dali/internal/event/render-tasks/render-task-impl.cpp
dali/internal/event/render-tasks/render-task-impl.h
dali/internal/event/rendering/texture-impl.h
dali/internal/file.list
dali/internal/render/common/render-manager.cpp
dali/internal/render/renderers/render-sampler.h
dali/internal/render/renderers/render-texture.cpp
dali/internal/update/render-tasks/scene-graph-render-task.cpp
dali/public-api/images/native-image.cpp
dali/public-api/render-tasks/render-task.cpp

index b30287e..33fee82 100644 (file)
@@ -11,7 +11,6 @@ SET(TC_SOURCES
         utc-Dali-AngleAxis.cpp
         utc-Dali-Animation.cpp
         utc-Dali-Any.cpp
-        utc-Dali-Atlas.cpp
         utc-Dali-BaseHandle.cpp
         utc-Dali-BufferImage.cpp
         utc-Dali-CameraActor.cpp
index 3a6557f..1242974 100644 (file)
@@ -48,7 +48,7 @@ public:
   inline void SetGlExtensionCreateResult(bool result){ createResult = result;}
   inline virtual bool GlExtensionCreate() { ++mExtensionCreateCalls; return createResult;};
   inline virtual void GlExtensionDestroy() { ++mExtensionDestroyCalls; };
-  inline virtual GLenum TargetTexture() { ++mTargetTextureCalls; return 1;};
+  inline virtual GLenum TargetTexture() { ++mTargetTextureCalls; return 0;};
   inline virtual void PrepareTexture() {};
   inline virtual unsigned int GetWidth() const {return mWidth;};
   inline virtual unsigned int GetHeight() const {return mHeight;};
index db22b86..991ae07 100644 (file)
@@ -93,7 +93,7 @@ Integration::ResourcePointer TestPlatformAbstraction::LoadResourceSynchronously(
 Integration::BitmapPtr TestPlatformAbstraction::DecodeBuffer( const Integration::ResourceType& resourceType, uint8_t * buffer, size_t size )
 {
   mTrace.PushCall("DecodeBuffer", "");
-  return Integration::BitmapPtr();
+  return mDecodedBitmap;
 }
 
 void TestPlatformAbstraction::CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId)
@@ -181,6 +181,7 @@ void TestPlatformAbstraction::Initialize()
   mResourceRequests.Clear();
   mIsLoadingResult=false;
   mSynchronouslyLoadedResource.Reset();
+  mDecodedBitmap.Reset();
 }
 
 bool TestPlatformAbstraction::WasCalled(TestFuncEnum func)
@@ -214,6 +215,7 @@ void TestPlatformAbstraction::ClearReadyResources()
   mLoadedResourcesQueue.clear();
   mFailedLoadQueue.clear();
   mSynchronouslyLoadedResource.Reset();
+  mDecodedBitmap.Reset();
 }
 
 void TestPlatformAbstraction::SetResourceLoaded(Integration::ResourceId  loadedId,
@@ -307,4 +309,9 @@ void TestPlatformAbstraction::SetSynchronouslyLoadedResource( Integration::Resou
   mSynchronouslyLoadedResource = resource;
 }
 
+void TestPlatformAbstraction::SetDecodedBitmap( Integration::BitmapPtr bitmap )
+{
+  mDecodedBitmap = bitmap;
+}
+
 } // namespace Dali
index d9d3247..6d2cb3f 100644 (file)
@@ -264,6 +264,12 @@ public: // TEST FUNCTIONS
    */
   void SetSynchronouslyLoadedResource( Integration::ResourcePointer resource );
 
+  /**
+   * @brief Sets the bitmap returned by DecodeBuffer()
+   * @param[in] bitmap The decoded bitmap
+   */
+  void SetDecodedBitmap( Integration::BitmapPtr bitmap );
+
 private:
 
   struct LoadedResource
@@ -307,6 +313,7 @@ private:
   bool                          mSaveFileResult;
 
   Integration::ResourcePointer  mSynchronouslyLoadedResource;
+  Integration::BitmapPtr        mDecodedBitmap;
 };
 
 } // Dali
index 74be89d..43162d4 100644 (file)
@@ -2494,6 +2494,12 @@ int UtcDaliActorSetDrawModeOverlayRender(void)
   Actor b = CreateRenderableActor( imageB );
   Actor c = CreateRenderableActor( imageC );
 
+  app.SendNotification();
+  app.Render(1);
+
+  //Textures are bound when first created. Clear bound textures vector
+  app.GetGlAbstraction().ClearBoundTextures();
+
   // Render a,b,c as regular non-overlays. so order will be:
   // a (8)
   // b (9)
diff --git a/automated-tests/src/dali/utc-Dali-Atlas.cpp b/automated-tests/src/dali/utc-Dali-Atlas.cpp
deleted file mode 100644 (file)
index d7c2ae3..0000000
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Copyright (c) 2016 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/integration-api/bitmap.h>
-#include <dali/devel-api/images/atlas.h>
-#include <dali-test-suite-utils.h>
-#include <test-native-image.h>
-
-using namespace Dali;
-
-namespace
-{
-static const char* gTestImageFilename = "icon_wrt.png";
-
-PixelData CreatePixelData(unsigned int width, unsigned int height, Pixel::Format pixelFormat)
-{
-  unsigned int bufferSize = width*height*Pixel::GetBytesPerPixel( pixelFormat );
-  unsigned char* buffer = new unsigned char [ bufferSize ];
-
-  return PixelData::New( buffer, bufferSize, width, height, pixelFormat, PixelData::DELETE_ARRAY );
-}
-
-}
-
-void utc_dali_atlas_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void utc_dali_atlas_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-int UtcDaliAtlasNew(void)
-{
-  TestApplication application;
-
-  // invoke default handle constructor
-  Atlas atlas;
-
-  DALI_TEST_CHECK( !atlas );
-
-  // initialise handle
-  atlas = Atlas::New( 16, 16 );
-
-  DALI_TEST_CHECK( atlas );
-  END_TEST;
-}
-
-int UtcDaliAtlasCopyConstructor(void)
-{
-  TestApplication application;
-
-  Atlas atlas = Atlas::New( 16, 16);
-  Atlas atlasCopy(atlas);
-
-
-  DALI_TEST_EQUALS( (bool)atlasCopy, true, TEST_LOCATION );
-  END_TEST;
-}
-
-int UtcDaliAtlasAssignmentOperator(void)
-{
-  TestApplication application;
-
-  Atlas atlas = Atlas::New( 16, 16);
-
-  Atlas atlas2;
-  DALI_TEST_EQUALS( (bool)atlas2, false, TEST_LOCATION );
-
-  atlas2 = atlas;
-  DALI_TEST_EQUALS( (bool)atlas2, true, TEST_LOCATION );
-
-  END_TEST;
-}
-
-int UtcDaliAtlasDownCast(void)
-{
-  TestApplication application;
-
-  Atlas atlas = Atlas::New( 16, 16);
-
-  BaseHandle handle(atlas);
-  Atlas atlasDowncast = Atlas::DownCast(handle);
-  DALI_TEST_EQUALS( (bool)atlasDowncast, true, TEST_LOCATION );
-
-  Handle handle2 = Handle::New(); // Create a custom object
-  Atlas atlas2 = Atlas::DownCast(handle2);
-  DALI_TEST_EQUALS( (bool)atlas2, false, TEST_LOCATION );
-
-  END_TEST;
-}
-
-int UtcDaliAtlasClear(void)
-{
-  TestApplication application;
-
-  Atlas atlas = Atlas::New( 16, 32, Pixel::RGBA8888 );
-  DALI_TEST_CHECK( atlas );
-
-  atlas.Clear(Color::TRANSPARENT);
-
-  TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
-  callStack.Reset();
-  callStack.Enable(true);
-  application.SendNotification();
-  application.Render(16);
-  application.Render(16);
-  application.SendNotification();
-  application.Render(16);
-  application.SendNotification();
-  callStack.Enable(false);
-
-  std::stringstream out;
-  out << GL_TEXTURE_2D <<", "<< 0u << ", " << 0u << ", " << 0u << ", " << 16u <<", "<< 32u;
-  DALI_TEST_CHECK( callStack.FindMethodAndParams("TexSubImage2D", out.str().c_str() ) );
-
-  END_TEST;
-}
-
-
-// Upload resource image, buffer image & pixel data with same pixel format
-int UtcDaliAtlasUpload01P(void)
-{
-  TestApplication application;
-
-  Atlas atlas = Atlas::New( 16, 40, Pixel::RGBA8888 );
-  DALI_TEST_CHECK( atlas );
-
-  // Using same pixel format
-  PixelBuffer* buffer = new PixelBuffer[16 * 16 * 4];
-  BufferImage image = BufferImage::New( buffer, 16, 16, Pixel::RGBA8888 );
-  DALI_TEST_CHECK( atlas.Upload( image, 0, 0 ) );
-
-  PrepareResourceImage( application, 16, 16, Pixel::RGBA8888 );
-  DALI_TEST_CHECK( atlas.Upload( gTestImageFilename, 0, 16 ) );
-
-  PixelData pixelData = CreatePixelData( 6,8,Pixel::RGBA8888 );
-  DALI_TEST_CHECK( atlas.Upload( pixelData, 2, 32 ) );
-
-  TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
-  callStack.Reset();
-  callStack.Enable(true);
-  application.SendNotification();
-  application.Render(16);
-  application.Render(16);
-  application.SendNotification();
-  application.Render(16);
-  application.SendNotification();
-  callStack.Enable(false);
-
-  {
-    std::stringstream out;
-    out << GL_TEXTURE_2D <<", "<< 0u << ", " << 0u << ", " << 0u << ", " << 16u <<", "<< 16u;
-    DALI_TEST_CHECK( callStack.FindMethodAndParams("TexSubImage2D", out.str().c_str() ) );
-  }
-  {
-    std::stringstream out;
-    out << GL_TEXTURE_2D <<", "<< 0u << ", " << 0u << ", " << 16u << ", " << 16u <<", "<< 16u;
-    DALI_TEST_CHECK( callStack.FindMethodAndParams("TexSubImage2D", out.str().c_str() ) );
-  }
-  {
-    std::stringstream out;
-    out << GL_TEXTURE_2D <<", "<< 0u << ", " << 2u << ", " << 32u << ", " << 6u <<", "<< 8u;
-    DALI_TEST_CHECK( callStack.FindMethodAndParams("TexSubImage2D", out.str().c_str() ) );
-  }
-
-  END_TEST;
-}
-
-// Upload resource image, buffer image & pixel data with different pixel format
-int UtcDaliAtlasUpload02P(void)
-{
-  TestApplication application;
-
-  Atlas atlas = Atlas::New( 20, 20, Pixel::RGBA8888 );
-  DALI_TEST_CHECK( atlas );
-
-  // Using different pixel format
-  PixelBuffer* buffer = new PixelBuffer[16 * 16 * 3];
-  BufferImage image = BufferImage::New( buffer, 16, 16, Pixel::RGB888 );
-  DALI_TEST_CHECK( atlas.Upload( image, 0, 0 ) );
-
-  PrepareResourceImage( application, 12, 12, Pixel::A8 );
-  DALI_TEST_CHECK( atlas.Upload( gTestImageFilename, 6, 6 ) );
-
-  PixelData pixelData = CreatePixelData( 8,8,Pixel::LA88 );
-  DALI_TEST_CHECK( atlas.Upload( pixelData, 10, 10 ) );
-
-  TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
-  callStack.Reset();
-  callStack.Enable(true);
-  application.SendNotification();
-  application.Render(16);
-  application.Render(16);
-  application.SendNotification();
-  application.Render(16);
-  application.SendNotification();
-  callStack.Enable(false);
-
-  {
-    std::stringstream out;
-    out << GL_TEXTURE_2D <<", "<< 0u << ", " << 0u << ", " << 0u << ", " << 16u <<", "<< 16u;
-    DALI_TEST_CHECK( callStack.FindMethodAndParams("TexSubImage2D", out.str().c_str() ) );
-  }
-  {
-    std::stringstream out;
-    out << GL_TEXTURE_2D <<", "<< 0u << ", " << 6u << ", " << 6u << ", " << 12u <<", "<< 12u;
-    DALI_TEST_CHECK( callStack.FindMethodAndParams("TexSubImage2D", out.str().c_str() ) );
-  }
-  {
-    std::stringstream out;
-    out << GL_TEXTURE_2D <<", "<< 0u << ", " << 10u << ", " << 10u << ", " << 8u <<", "<< 8u;
-    DALI_TEST_CHECK( callStack.FindMethodAndParams("TexSubImage2D", out.str().c_str() ) );
-  }
-
-  END_TEST;
-}
-
-// Upload resource image, buffer image & pixel data which cannot fit into the atlas with given offset
-int UtcDaliAtlasUploadN(void)
-{
-  TestApplication application;
-
-  Atlas atlas = Atlas::New( 16, 16, Pixel::RGBA8888 );
-  DALI_TEST_CHECK( atlas );
-
-  // Using image cannot fit into atlas at the given offsets
-  PixelBuffer* buffer = new PixelBuffer[24 * 24 * 4];
-  BufferImage image = BufferImage::New( buffer, 24, 24, Pixel::RGBA8888 );
-  DALI_TEST_CHECK( !atlas.Upload( image, 0, 0 ) );
-
-  PrepareResourceImage( application, 16, 16, Pixel::RGBA8888 );
-  DALI_TEST_CHECK( !atlas.Upload( gTestImageFilename, 10, 10 ) );
-
-  PixelData pixelData = CreatePixelData( 6,6,Pixel::RGBA8888 );
-  DALI_TEST_CHECK( !atlas.Upload( pixelData, 11, 11 ) );
-
-  TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
-  callStack.Reset();
-  callStack.Enable(true);
-  application.SendNotification();
-  application.Render(16);
-  application.Render(16);
-  application.SendNotification();
-  application.Render(16);
-  application.SendNotification();
-  callStack.Enable(false);
-
-  // none of these three upload() call sends texture to GPU
-  DALI_TEST_CHECK( ! callStack.FindMethodAndParams("TexSubImage2D", "0, 0, 24, 24") );
-  DALI_TEST_CHECK( ! callStack.FindMethodAndParams("TexSubImage2D", "10, 10, 16, 16") );
-  DALI_TEST_CHECK( ! callStack.FindMethodAndParams("TexSubImage2D", "11, 11, 6, 6") );
-
-  END_TEST;
-}
-
-
-
-
index 7258578..7d9b9f7 100644 (file)
@@ -79,14 +79,7 @@ int UtcDaliBufferImageDownCast(void)
   TestApplication application;
   tet_infoline("Testing Dali::BufferImage::DownCast()");
 
-  BufferImage bitmap = BufferImage::New(1, 1, Dali::Pixel::BGRA8888);
-  Actor actor = CreateRenderableActor( bitmap );
-  application.SendNotification();
-  application.Render(16);
-  application.Render(16);
-  application.SendNotification();
-
-  Image image = GetTexture( actor );
+  Image image = BufferImage::New(1, 1, Dali::Pixel::BGRA8888);
   BufferImage bufferImage = BufferImage::DownCast( image );
 
   DALI_TEST_CHECK(bufferImage);
@@ -246,17 +239,6 @@ int UtcDaliBufferImageIsDataExternal(void)
   END_TEST;
 }
 
-namespace
-{
-
-static bool SignalReceived;
-static void ImageUploaded(Image image)
-{
-  tet_infoline("Received image uploaded signal");
-  SignalReceived = true;
-}
-}
-
 int UtcDaliBufferImageUpdate01(void)
 {
   TestApplication application;
@@ -270,9 +252,6 @@ int UtcDaliBufferImageUpdate01(void)
   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);
@@ -301,11 +280,8 @@ int UtcDaliBufferImageUpdate01(void)
   const TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
 
   std::stringstream out;
-  out << GL_TEXTURE_2D <<", "<< 0u << ", " << 0u << ", " << 0u << ", " << 16u <<", "<< 16u;
-  DALI_TEST_EQUALS( callStack.TestMethodAndParams(0, "TexSubImage2D", out.str().c_str() ), true, TEST_LOCATION);
-
-  DALI_TEST_CHECK( SignalReceived == true );
-  SignalReceived = false;
+  out << GL_TEXTURE_2D <<", "<< 0u << ", " << 16u <<", "<< 16u;
+  DALI_TEST_EQUALS( callStack.TestMethodAndParams(0, "TexImage2D", out.str().c_str() ), true, TEST_LOCATION);
   END_TEST;
 }
 
@@ -321,9 +297,6 @@ int UtcDaliBufferImageUpdate02(void)
   Stage::GetCurrent().Add(actor);
   actor.SetVisible(true);
 
-  SignalReceived = false;
-  image.UploadedSignal().Connect( ImageUploaded );
-
   application.SendNotification();
   application.Render(0);
   application.Render(16);
@@ -366,78 +339,6 @@ int UtcDaliBufferImageUpdate02(void)
     DALI_TEST_EQUALS( callStack.TestMethodAndParams(2, "TexSubImage2D", out.str().c_str()), 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();
-
-  Actor actor = CreateRenderableActor( image );
-  Stage::GetCurrent().Add(actor);
-  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();
-
-  Actor actor = CreateRenderableActor( image );
-  Stage::GetCurrent().Add(actor);
-  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 aef53e8..922400c 100644 (file)
@@ -755,6 +755,15 @@ const unsigned char sEncodedBufferImageDataPNG[] = {
 
 static const unsigned int sEncodedBufferImageDataPNGLength = sizeof( sEncodedBufferImageDataPNG );
 
+void PrepareDecodeBuffer( TestApplication& application, unsigned int width, unsigned int height, Pixel::Format pixelFormat )
+{
+  TestPlatformAbstraction& platform = application.GetPlatform();
+  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
+  bitmap->GetPackedPixelsProfile()->ReserveBuffer( pixelFormat, width, height, width, height );
+  Integration::BitmapPtr bitmapPtr(bitmap);
+  platform.SetDecodedBitmap( bitmapPtr );
+}
+
 } // anonymous namespace
 
 
@@ -831,6 +840,7 @@ int UtcDaliEncodedBufferImageNewP2(void)
   DALI_TEST_CHECK( !image );
 
   // Trigger image decode to initialise the handle
+  PrepareDecodeBuffer( application, 720u, 1280u, Pixel::RGBA8888 );
   image = EncodedBufferImage::New( sEncodedBufferImageDataPNG, sEncodedBufferImageDataPNGLength, ImageDimensions(), FittingMode::DEFAULT, SamplingMode::DEFAULT );
 
   DALI_TEST_CHECK( image );
index e143837..089ab4e 100644 (file)
@@ -116,90 +116,6 @@ int UtcDaliNativeImageDownCast(void)
   END_TEST;
 }
 
-int UtcDaliNativeImageCreateGlTextureN(void)
-{
-  TestApplication application;
-  tet_infoline( "Testing Dali::NativeImage::GenerateGlTexture()" );
-
-  NativeImage image;
-  try
-  {
-    image.CreateGlTexture();
-    tet_printf( "Assertion test failed - no Exception\n" );
-    tet_result( TET_FAIL );
-  }
-  catch( Dali::DaliException& e )
-  {
-    DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_ASSERT( e, "image &&", TEST_LOCATION );
-  }
-  END_TEST;
-}
-
-int UtcDaliNativeImageCreateGlTextureP(void)
-{
-  TestApplication application;
-  tet_infoline( "Testing Dali::NativeImage::GenerateGlTexture()" );
-
-  TestNativeImagePointer imageInterface = TestNativeImage::New( 16, 16 );
-  NativeImage image = NativeImage::New( *(imageInterface.Get()) );
-  DALI_TEST_CHECK( image );
-
-  image.CreateGlTexture();
-
-  application.SendNotification();
-  application.Render(16);
-
-  DALI_TEST_EQUALS( imageInterface->mExtensionCreateCalls, 1, TEST_LOCATION );
-  DALI_TEST_EQUALS( imageInterface->mTargetTextureCalls, 1, TEST_LOCATION );
-
-  END_TEST;
-}
-
-int UtcDaliNativeImageContextLoss(void)
-{
-  TestApplication application;
-  tet_infoline( "Testing Dali::NativeImage behaviour through a context lost/regained cycle." );
-
-  // Build an image that is expected to have a GL texture created for it and
-  // recreated in a GL context recovery:
-  TestNativeImagePointer eagerImageInterface = TestNativeImage::New( 16, 16 );
-  NativeImage eagerImage = NativeImage::New( *(eagerImageInterface.Get()) );
-  DALI_TEST_CHECK( eagerImage );
-
-  // Build a regular lazy-allocated image for comparison:
-  TestNativeImagePointer lazyImageInterface = TestNativeImage::New( 16, 16 );
-  NativeImage lazyImage = NativeImage::New( *(lazyImageInterface.Get()) );
-  DALI_TEST_CHECK( lazyImage );
-
-  eagerImage.CreateGlTexture();
-
-  application.SendNotification();
-  application.Render(16);
-
-  // Cycle through a context loss and regain, asserting that the texture is
-  // not reallocated if it already existed before the cycle and is never allocated
-  // throughout the cycle if of the regular lazy kind:
-
-  // Call render thread context destroyed / created functions:
-  application.ResetContext();
-
-  // Call event thread function:
-  application.GetCore().RecoverFromContextLoss();
-
-  // Run update/render loop
-  application.SendNotification();
-  application.Render(16);
-
-  DALI_TEST_EQUALS( eagerImageInterface->mExtensionCreateCalls, 1, TEST_LOCATION );
-  DALI_TEST_EQUALS( eagerImageInterface->mTargetTextureCalls, 1, TEST_LOCATION );
-
-  DALI_TEST_EQUALS( lazyImageInterface->mExtensionCreateCalls, 0, TEST_LOCATION );
-  DALI_TEST_EQUALS( lazyImageInterface->mTargetTextureCalls, 0, TEST_LOCATION );
-
-  END_TEST;
-}
-
 int UtcDaliNativeImageExtensionP(void)
 {
   TestApplication application;
@@ -267,7 +183,8 @@ int UtcDaliNativeImageTestCreationFailure(void)
   application.Render();
 
   // Test that nothing was rendered
-  DALI_TEST_EQUALS( nativeImageInterface->mExtensionCreateCalls, 1, TEST_LOCATION );
+  //GlExtensionCreate() called twice, once at initialization and once when trying to bind the texture
+  DALI_TEST_EQUALS( nativeImageInterface->mExtensionCreateCalls, 2, TEST_LOCATION );
   DALI_TEST_EQUALS( nativeImageInterface->mTargetTextureCalls, 0, TEST_LOCATION );
   DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), false, TEST_LOCATION );
   DALI_TEST_EQUALS( drawTrace.FindMethod("DrawElements") || drawTrace.FindMethod("DrawArrays"), false, TEST_LOCATION );
@@ -281,7 +198,7 @@ int UtcDaliNativeImageTestCreationFailure(void)
   application.Render();
 
   // This time around, the bind and draw should occur following the call to nativeImage->GlExtensionCreate.
-  DALI_TEST_EQUALS( nativeImageInterface->mExtensionCreateCalls, 2, TEST_LOCATION );
+  DALI_TEST_EQUALS( nativeImageInterface->mExtensionCreateCalls, 3, TEST_LOCATION );
   DALI_TEST_EQUALS( nativeImageInterface->mTargetTextureCalls, 1, TEST_LOCATION );
   DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
   DALI_TEST_EQUALS( drawTrace.FindMethod("DrawElements") || drawTrace.FindMethod("DrawArrays"), true, TEST_LOCATION );
index e25bf6a..439a451 100644 (file)
@@ -390,20 +390,12 @@ int UtcDaliRenderTaskSetSourceActorP01(void)
   tet_infoline("Testing RenderTask::SetSourceActor() Positive - check that setting a non-renderable actor stops existing source actor being rendered ");
 
   Stage stage = Stage::GetCurrent();
-
-  const std::vector<GLuint>& boundTextures = application.GetGlAbstraction().GetBoundTextures( GL_TEXTURE0 );
-
   RenderTaskList taskList = stage.GetRenderTaskList();
-
   RenderTask task = taskList.GetTask( 0u );
 
   Actor actor = task.GetSourceActor();
   DALI_TEST_CHECK( actor );
 
-  std::vector<GLuint> ids;
-  ids.push_back( 7 );
-  application.GetGlAbstraction().SetNextTextureIds( ids );
-
   BufferImage img = BufferImage::New( 1,1 );
   Actor newActor = CreateRenderableActor( img );
   newActor.SetSize(1,1);
@@ -418,13 +410,17 @@ int UtcDaliRenderTaskSetSourceActorP01(void)
   DALI_TEST_CHECK( task.GetSourceActor() != actor );
   DALI_TEST_CHECK( task.GetSourceActor() == nonRenderableActor );
 
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& drawTrace = gl.GetDrawTrace();
+  drawTrace.Enable(true);
+
   // Update & Render nothing!
   application.GetGlAbstraction().ClearBoundTextures();
   application.SendNotification();
   application.Render();
 
   // Check that nothing was rendered
-  DALI_TEST_EQUALS( boundTextures.size(), 0u, TEST_LOCATION );
+  DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION );
 
   END_TEST;
 }
@@ -438,8 +434,6 @@ int UtcDaliRenderTaskSetSourceActorP02(void)
 
   Stage stage = Stage::GetCurrent();
 
-  const std::vector<GLuint>& boundTextures = application.GetGlAbstraction().GetBoundTextures( GL_TEXTURE0 );
-
   RenderTaskList taskList = stage.GetRenderTaskList();
 
   RenderTask task = taskList.GetTask( 0u );
@@ -447,9 +441,6 @@ int UtcDaliRenderTaskSetSourceActorP02(void)
   Actor actor = task.GetSourceActor();
   DALI_TEST_CHECK( actor );
 
-  std::vector<GLuint> ids;
-  ids.push_back( 7 );
-  application.GetGlAbstraction().SetNextTextureIds( ids );
 
   BufferImage img = BufferImage::New( 1,1 );
   Actor newActor = CreateRenderableActor( img );
@@ -459,6 +450,10 @@ int UtcDaliRenderTaskSetSourceActorP02(void)
   Actor nonRenderableActor = Actor::New();
   stage.Add( nonRenderableActor );
 
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& drawTrace = gl.GetDrawTrace();
+  drawTrace.Enable(true);
+
   // Stop the newActor from being rendered by changing the source actor
   DALI_TEST_CHECK( nonRenderableActor );
   task.SetSourceActor( nonRenderableActor );
@@ -471,7 +466,8 @@ int UtcDaliRenderTaskSetSourceActorP02(void)
   application.Render();
 
   // Check that nothing was rendered
-  DALI_TEST_EQUALS( boundTextures.size(), 0u, TEST_LOCATION );
+  DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION );
+  drawTrace.Reset();
 
   // Set newActor as the new source Actor
   task.SetSourceActor( newActor );
@@ -484,11 +480,7 @@ int UtcDaliRenderTaskSetSourceActorP02(void)
   application.Render();
 
   // Check that the newActor was rendered
-  DALI_TEST_EQUALS( boundTextures.size(), 1u, TEST_LOCATION );
-  if ( boundTextures.size() )
-  {
-    DALI_TEST_EQUALS( boundTextures[0], 7u, TEST_LOCATION );
-  }
+  DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION );
   END_TEST;
 }
 
@@ -499,20 +491,15 @@ int UtcDaliRenderTaskSetSourceActorOffStage(void)
   tet_infoline("Testing RenderTask::SetSourceActor (on/off stage testing)");
 
   Stage stage = Stage::GetCurrent();
-
-  const std::vector<GLuint>& boundTextures = application.GetGlAbstraction().GetBoundTextures( GL_TEXTURE0 );
-
   RenderTaskList taskList = stage.GetRenderTaskList();
-
   RenderTask task = taskList.GetTask( 0u );
 
   Actor actor = task.GetSourceActor();
   DALI_TEST_CHECK( actor );
 
-  std::vector<GLuint> ids;
-  GLuint expectedTextureId( 3 );
-  ids.push_back( expectedTextureId );
-  application.GetGlAbstraction().SetNextTextureIds( ids );
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& drawTrace = gl.GetDrawTrace();
+  drawTrace.Enable(true);
 
   BufferImage img = BufferImage::New( 1,1 );
   Actor newActor = CreateRenderableActor( img );
@@ -521,12 +508,11 @@ int UtcDaliRenderTaskSetSourceActorOffStage(void)
   // Don't add newActor to stage yet   //'
 
   // Update & Render with the actor initially off-stage
-  application.GetGlAbstraction().ClearBoundTextures();
   application.SendNotification();
   application.Render();
 
   // Check that nothing was rendered
-  DALI_TEST_EQUALS( boundTextures.size(), 0u, TEST_LOCATION );
+  DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION );
 
   // Now add to stage
   stage.Add( newActor );
@@ -537,19 +523,17 @@ int UtcDaliRenderTaskSetSourceActorOffStage(void)
   application.Render();
 
   // Check that the newActor was rendered
-  DALI_TEST_EQUALS( boundTextures.size(), 1u, TEST_LOCATION );
-  if ( boundTextures.size() )
-  {
-    DALI_TEST_EQUALS( boundTextures[0], expectedTextureId, TEST_LOCATION );
-  }
+  DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION );
+  drawTrace.Reset();
 
   // Now remove from stage
   stage.Remove( newActor );
 
   // Update & Render with the actor off-stage
-  application.GetGlAbstraction().ClearBoundTextures();
   application.SendNotification();
   application.Render();
+  DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION );
+
   END_TEST;
 }
 
@@ -560,21 +544,12 @@ int UtcDaliRenderTaskSetSourceActorEmpty(void)
   tet_infoline("Testing RenderTask::SetSourceActor (empty handle case)");
 
   Stage stage = Stage::GetCurrent();
-
-  const std::vector<GLuint>& boundTextures = application.GetGlAbstraction().GetBoundTextures( GL_TEXTURE0 );
-
   RenderTaskList taskList = stage.GetRenderTaskList();
-
   RenderTask task = taskList.GetTask( 0u );
 
   Actor actor = task.GetSourceActor();
   DALI_TEST_CHECK( actor );
 
-  std::vector<GLuint> ids;
-  GLuint expectedTextureId( 5 );
-  ids.push_back( expectedTextureId );
-  application.GetGlAbstraction().SetNextTextureIds( ids );
-
   BufferImage img = BufferImage::New( 1,1 );
   Actor newActor = CreateRenderableActor( img );
   newActor.SetSize(1,1);
@@ -587,13 +562,16 @@ int UtcDaliRenderTaskSetSourceActorEmpty(void)
   task.SetSourceActor( Actor() );
   DALI_TEST_CHECK( ! task.GetSourceActor() );
 
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  TraceCallStack& drawTrace = gl.GetDrawTrace();
+  drawTrace.Enable(true);
+
   // Update & Render nothing!
-  application.GetGlAbstraction().ClearBoundTextures();
   application.SendNotification();
   application.Render();
 
   // Check that nothing was rendered
-  DALI_TEST_EQUALS( boundTextures.size(), 0u, TEST_LOCATION );
+  DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION );
 
   // Set with non-empty handle
   task.SetSourceActor( newActor );
@@ -605,11 +583,7 @@ int UtcDaliRenderTaskSetSourceActorEmpty(void)
   application.Render();
 
   // Check that the newActor was rendered
-  DALI_TEST_EQUALS( boundTextures.size(), 1u, TEST_LOCATION );
-  if ( boundTextures.size() )
-  {
-    DALI_TEST_EQUALS( boundTextures[0], expectedTextureId, TEST_LOCATION );
-  }
+  DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION );
   END_TEST;
 }
 
@@ -2414,15 +2388,14 @@ int UtcDaliRenderTaskOnceChain01(void)
 
   application.SendNotification();
 
+  //Both render tasks are executed.
   DALI_TEST_CHECK( UpdateRender(application, drawTrace, true,  firstFinished, false, true, __LINE__ ) );
   DALI_TEST_CHECK( firstFinished == false );
   DALI_TEST_CHECK( secondFinished == false );
 
-  DALI_TEST_CHECK( UpdateRender(application, drawTrace, true,  firstFinished, true, true, __LINE__ ) );
+  //Nothing else to render and both render task should have finished now
+  DALI_TEST_CHECK( UpdateRender(application, drawTrace, false,  firstFinished, true, false, __LINE__ ) );
   DALI_TEST_CHECK( firstFinished == true );
-  DALI_TEST_CHECK( secondFinished == false );
-
-  DALI_TEST_CHECK( UpdateRender(application, drawTrace, false,  secondFinished, true, false, __LINE__ ) );
   DALI_TEST_CHECK( secondFinished == true );
 
   END_TEST;
index ba71e7c..fb895a1 100644 (file)
@@ -154,20 +154,19 @@ int UtcSamplerSetFilterMode(void)
 
   // Verify gl state
 
-  // There are three calls to TexParameteri when the texture is first created
-  // Texture mag filter is not called as the first time set it uses the system default
-  DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 3, TEST_LOCATION);
+  // There are 4 calls to TexParameteri when the texture is first created
+  DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 4, TEST_LOCATION);
 
   std::stringstream out;
   out << GL_TEXTURE_2D << ", " << GL_TEXTURE_MIN_FILTER << ", " << GL_LINEAR;
-  DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(2, "TexParameteri", out.str()), true, TEST_LOCATION);
+  DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(0, "TexParameteri", out.str()), true, TEST_LOCATION);
 
   /**************************************************************/
-  // Default/Default
+  // Linear/Linear
   texParameterTrace.Reset();
   texParameterTrace.Enable( true );
 
-  sampler.SetFilterMode( FilterMode::DEFAULT, FilterMode::DEFAULT );
+  sampler.SetFilterMode( FilterMode::LINEAR, FilterMode::LINEAR );
 
   // Flush the queue and render once
   application.SendNotification();
@@ -177,7 +176,7 @@ int UtcSamplerSetFilterMode(void)
 
   // Verify gl state
 
-  // Should not make any calls when settings are the same
+  // Should not make any calls when settings are the same (DEFAULT = LINEAR )
   DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 0, TEST_LOCATION);
 
   /**************************************************************/
@@ -284,22 +283,21 @@ int UtcSamplerSetWrapMode1(void)
 
   // Verify gl state
 
-  // There are three calls to TexParameteri when the texture is first created
-  // Texture mag filter is not called as the first time set it uses the system default
-  DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 3, TEST_LOCATION);
+  // There are 4 calls to TexParameteri when the texture is first created
+  DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 4, TEST_LOCATION);
 
   std::stringstream out;
   out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_S << ", " << GL_CLAMP_TO_EDGE;
-  DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(0, "TexParameteri", out.str()), true, TEST_LOCATION);
+  DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(2, "TexParameteri", out.str()), true, TEST_LOCATION);
 
   out.str("");
   out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_T << ", " << GL_CLAMP_TO_EDGE;
-  DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(1, "TexParameteri", out.str()), true, TEST_LOCATION);
+  DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(3, "TexParameteri", out.str()), true, TEST_LOCATION);
 
   texParameterTrace.Reset();
   texParameterTrace.Enable( true );
 
-  sampler.SetWrapMode( WrapMode::CLAMP_TO_EDGE, WrapMode::CLAMP_TO_EDGE );
+  sampler.SetWrapMode( WrapMode::DEFAULT, WrapMode::DEFAULT );
 
   // Flush the queue and render once
   application.SendNotification();
@@ -374,10 +372,18 @@ int UtcSamplerSetWrapMode2(void)
   application.SendNotification();
   application.Render();
 
+  // Verify that no TexParameteri calls occurred since wrap mode hasn't changed.
+  DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 0u, TEST_LOCATION );
+
+
+  sampler.SetWrapMode( WrapMode::REPEAT, WrapMode::REPEAT, WrapMode::REPEAT );
+  texParameterTrace.Reset();
+  application.SendNotification();
+  application.Render();
+
   texParameterTrace.Enable( false );
 
   // Verify that 3 TexParameteri calls occurred.
   DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 3u, TEST_LOCATION );
-
   END_TEST;
 }
index 2d1464d..4811fe7 100644 (file)
@@ -231,7 +231,7 @@ int UtcDaliTextureSetSetSampler(void)
   // Verify gl state
   // There are 4 calls to TexParameteri when the texture is first created
   // as the texture is using default sampling parametrers there shouldn't be any more calls to TexParameteri
-  DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 3, TEST_LOCATION);
+  DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 4, TEST_LOCATION);
 
   texParameterTrace.Reset();
   texParameterTrace.Enable( true );
index 9d0f677..394fd97 100644 (file)
@@ -4,7 +4,6 @@ devel_api_src_files = \
   $(devel_api_src_dir)/animation/path-constrainer.cpp \
   $(devel_api_src_dir)/common/hash.cpp \
   $(devel_api_src_dir)/events/hit-test-algorithm.cpp \
-  $(devel_api_src_dir)/images/atlas.cpp \
   $(devel_api_src_dir)/images/distance-field.cpp \
   $(devel_api_src_dir)/images/texture-set-image.cpp \
   $(devel_api_src_dir)/images/nine-patch-image.cpp \
@@ -38,7 +37,6 @@ devel_api_core_events_header_files = \
   $(devel_api_src_dir)/events/hit-test-algorithm.h
 
 devel_api_core_images_header_files = \
-  $(devel_api_src_dir)/images/atlas.h \
   $(devel_api_src_dir)/images/distance-field.h \
   $(devel_api_src_dir)/images/native-image-interface-extension.h \
   $(devel_api_src_dir)/images/texture-set-image.h \
diff --git a/dali/devel-api/images/atlas.cpp b/dali/devel-api/images/atlas.cpp
deleted file mode 100644 (file)
index 38d9ac9..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2015 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/devel-api/images/atlas.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/event/images/atlas-impl.h>
-#include <dali/internal/event/images/buffer-image-impl.h>
-#include <dali/internal/event/images/pixel-data-impl.h>
-
-namespace Dali
-{
-
-Atlas Atlas::New( SizeType width,
-                  SizeType height,
-                  Pixel::Format pixelFormat,
-                  bool recoverContext )
-{
-  DALI_ASSERT_ALWAYS( 0u != width  && "Invalid Atlas width requested" );
-  DALI_ASSERT_ALWAYS( 0u != height && "Invalid Atlas height requested" );
-
-  return Atlas( Internal::Atlas::New( width, height, pixelFormat, recoverContext ) );
-}
-
-Atlas::Atlas()
-{
-}
-
-void Atlas::Clear( const Vector4& color  )
-{
-  GetImplementation( *this ).Clear( color );
-}
-
-bool Atlas::Upload( BufferImage bufferImage,
-                    SizeType xOffset,
-                    SizeType yOffset )
-{
-  return GetImplementation(*this).Upload( GetImplementation(bufferImage), xOffset, yOffset );
-}
-
-bool Atlas::Upload( const std::string& url,
-                    SizeType xOffset,
-                    SizeType yOffset )
-{
-  return GetImplementation(*this).Upload( url, xOffset, yOffset );
-}
-
-bool Atlas::Upload( PixelData pixelData,
-                    SizeType xOffset,
-                    SizeType yOffset )
-{
-  Internal::PixelData& internalPixelData = GetImplementation( pixelData );
-  return GetImplementation(*this).Upload( &internalPixelData, xOffset, yOffset );
-}
-
-Atlas Atlas::DownCast( BaseHandle handle )
-{
-  return Atlas( dynamic_cast<Dali::Internal::Atlas*>(handle.GetObjectPtr()) );
-}
-
-Atlas::~Atlas()
-{
-}
-
-Atlas::Atlas( const Atlas& handle )
-: Image( handle )
-{
-}
-
-Atlas& Atlas::operator=( const Atlas& rhs )
-{
-  BaseHandle::operator=(rhs);
-  return *this;
-}
-
-Atlas::Atlas( Internal::Atlas* internal )
-: Image( internal )
-{
-}
-
-} // namespace Dali
diff --git a/dali/devel-api/images/atlas.h b/dali/devel-api/images/atlas.h
deleted file mode 100644 (file)
index efa9eea..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-#ifndef DALI_ATLAS_H
-#define DALI_ATLAS_H
-
-/*
- * Copyright (c) 2016 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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <stdint.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/images/buffer-image.h>
-#include <dali/public-api/images/image.h>
-#include <dali/public-api/images/pixel-data.h>
-
-namespace Dali
-{
-
-namespace Internal DALI_INTERNAL
-{
-class Atlas;
-}
-
-/**
- * @brief An Atlas is a large image containing multiple smaller images.
- *
- * Buffer image and resource image( by providing the url ) are supported for uploading.
- * Images must be uploaded at a specified position, to populate the Atlas.
- * The client is responsible for generating the appropriate geometry (UV coordinates) needed to draw images within the Atlas.
- *
- * @note For gles 2.0, matched pixel format is demanded to ensure the correct atlasing.
- *       The only exception supported is uploading image of RGB888 to atlas of RGBA8888 format which is converted manually before pushing to GPU.
- *
- * For context recovery after loss:
- * By default, the atlas will re-upload the resource images automatically,
- * while the buffer images are left to the client to upload again by connecting to the Stage::ContextRegainedSignal().
- * If resource and buffer images are mixed and they overlap inside the atlas, the recovered contents may be incorrect.
- * In these case, switch off the context recovery by calling SetContextRecovery( false ),
- * and upload both buffer images and resource image to the atlas in order to restore the atlas.
- */
-class DALI_IMPORT_API Atlas : public Image
-{
-public:
-
-  typedef uint32_t SizeType;
-
-public:
-
-  /**
-   * @brief Create a new Atlas.
-   *
-   * @pre width & height are greater than zero.
-   * The maximum size of the atlas is limited by GL_MAX_TEXTURE_SIZE.
-   * @param [in] width          The atlas width in pixels.
-   * @param [in] height         The atlas height in pixels.
-   * @param [in] pixelFormat    The pixel format (rgba 32 bit by default).
-   * @param [in] recoverContext Whether re-uploading the resource images automatically when regaining the context( true by default )
-   * @return A handle to a new Atlas.
-   */
-  static Atlas New( SizeType width,
-                    SizeType height,
-                    Pixel::Format pixelFormat = Pixel::RGBA8888,
-                    bool recoverContext = true );
-
-  /**
-   * @brief Create an empty handle.
-   *
-   * Calling member functions of an empty handle is not allowed.
-   */
-  Atlas();
-
-  /**
-   * @brief Clear the Atlas with the given color
-   *
-   * @note The Atlas does not clear itself automatically during construction.
-   * Application should call this clear function to avoid getting garbage pixels in the atlas.
-   * By calling Clear, all the current uploaded image information will be lost.
-   * @param [in] color The color used to clear the Atlas.
-   */
-  void Clear( const Vector4& color  );
-
-  /**
-   * @brief Upload a buffer image to the atlas.
-   *
-   * @pre The pixel format of this buffer image must match the Atlas format.
-   * @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 image has compatible pixel format and fits within the atlas at the specified offset.
-   */
-  bool Upload( BufferImage bufferImage,
-               SizeType xOffset,
-               SizeType yOffset );
-
-  /**
-   * @brief Upload a resource image to atlas
-   *
-   * @param [in] url The URL of the resource image file to use
-   * @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 image has compatible pixel format and fits within the atlas at the specified offset.
-   */
-  bool Upload( const std::string& url,
-               SizeType xOffset,
-               SizeType yOffset );
-
-  /**
-   * @brief Upload a pixel buffer to atlas
-   *
-   * @param [in] pixelData      The pixel data.
-   * @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.
-   */
-  bool Upload( PixelData pixelData,
-               SizeType xOffset,
-               SizeType yOffset );
-  /**
-   * @brief Downcast an Object handle to Atlas.
-   *
-   * If handle points to a Atlas the downcast produces valid
-   * handle. If not the returned handle is left uninitialized.
-   *
-   * @param[in] handle to An object
-   * @return handle to a Atlas or an empty handle
-   */
-  static Atlas DownCast( BaseHandle handle );
-
-  /**
-   * @brief Destructor
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~Atlas();
-
-  /**
-   * @brief This copy constructor is required for (smart) pointer semantics.
-   *
-   * @param [in] handle A reference to the copied handle
-   */
-  Atlas( const Atlas& 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
-   */
-  Atlas& operator=( const Atlas& rhs);
-
-public: // Not intended for application developers
-
-  explicit DALI_INTERNAL Atlas( Internal::Atlas* );
-};
-
-} // namespace Dali
-
-#endif // DALI_ATLAS_H
index 62ad33f..16118a9 100644 (file)
@@ -550,19 +550,11 @@ bool HitTestRenderTaskList( Stage& stage,
   for( RenderTaskList::RenderTaskContainer::reverse_iterator iter = tasks.rbegin(); endIter != iter; ++iter )
   {
     RenderTask& renderTask = GetImplementation( *iter );
-    Dali::FrameBufferImage frameBufferImage = renderTask.GetTargetFrameBuffer();
-
-    // Note that if frameBufferImage is NULL we are using the default (on screen) render target
-    if( frameBufferImage )
+    bool isOffscreenRenderTask = ( iter->GetTargetFrameBuffer() || iter->GetFrameBuffer() );
+    if( (onScreen && isOffscreenRenderTask) || (!onScreen && !isOffscreenRenderTask) )
     {
-      ResourceId id = GetImplementation( frameBufferImage ).GetResourceId();
-
-      // Change comparison depending on if on-screen or off-screen.
-      if( onScreen ? ( 0 != id ) : ( 0 == id ) )
-      {
-        // Skip to next task
-        continue;
-      }
+      // Skip to next task
+      continue;
     }
 
     if( HitTestRenderTask( exclusives, stage, layers, renderTask, screenCoordinates, results, hitCheck ) )
diff --git a/dali/internal/event/images/atlas-impl.cpp b/dali/internal/event/images/atlas-impl.cpp
deleted file mode 100644 (file)
index e5e3080..0000000
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Copyright (c) 2016 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/atlas-impl.h>
-
-// EXTERNAL INCLUDES
-#include <cstring> // for memset()
-
-// 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-packed-pixel.h>
-#include <dali/internal/event/resources/resource-client.h>
-#include <dali/integration-api/bitmap.h>
-#include <dali/integration-api/platform-abstraction.h>
-
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace
-{
-TypeRegistration mType( typeid( Dali::Atlas ), typeid( Dali::Image ), NULL );
-}
-
-Atlas* Atlas::New( SizeType width,
-                   SizeType height,
-                   Pixel::Format pixelFormat,
-                   bool recoverContext)
-{
-  return new Atlas( width, height, pixelFormat, recoverContext );
-}
-
-void Atlas::Clear(const Vector4& color)
-{
-  ClearCache();
-  ClearBackground( color );
-}
-
-bool Atlas::Upload( BufferImage& bufferImage,
-                    SizeType xOffset,
-                    SizeType yOffset )
-{
-  bool uploadSuccess( false );
-
-  if( IsInside( xOffset + bufferImage.GetWidth(),  yOffset + bufferImage.GetHeight() ) )
-  {
-    AllocateAtlas();
-    ResourceId destId = GetResourceId();
-
-    if( destId )
-    {
-      bufferImage.UploadBitmap( destId, xOffset, yOffset );
-      uploadSuccess = true;
-    }
-  }
-
-  return uploadSuccess;
-}
-
-bool Atlas::Upload( const std::string& url,
-                    SizeType xOffset,
-                    SizeType yOffset)
-{
-  bool uploadSuccess( false );
-
-  Integration::BitmapPtr bitmap = LoadBitmap( url );
-
-  if( bitmap && IsInside( xOffset + bitmap->GetImageWidth(), yOffset + bitmap->GetImageHeight()) )
-  {
-    AllocateAtlas();
-    ResourceId destId = GetResourceId();
-    if( destId )
-    {
-      mResourceClient.UploadBitmap( destId, bitmap, xOffset, yOffset  );
-      uploadSuccess = true;
-
-      if( mRecoverContext )
-      {
-        mTiles.PushBack( new Tile(xOffset, yOffset, url) );
-      }
-    }
-  }
-  return uploadSuccess;
-}
-
-bool Atlas::Upload( PixelDataPtr pixelData,
-                    SizeType xOffset,
-                    SizeType yOffset )
-{
-  bool uploadSuccess( false );
-  if( IsInside( xOffset + pixelData->GetWidth(),  yOffset + pixelData->GetHeight() ) )
-  {
-    AllocateAtlas();
-    ResourceId destId = GetResourceId();
-
-    if( destId )
-    {
-      mResourceClient.UploadBitmap( destId, pixelData, xOffset, yOffset  );
-      uploadSuccess = true;
-    }
-  }
-
-  return uploadSuccess;
-}
-
-void Atlas::RecoverFromContextLoss()
-{
-  ResourceId destId = GetResourceId();
-  if( destId )
-  {
-    if( mClear )
-    {
-      ClearBackground( mClearColor );
-    }
-
-    if( mRecoverContext )
-    {
-      // Restore the atlas by re-uploading the url resources
-      Vector< Tile* >::ConstIterator end = mTiles.End();
-      for( Vector<Tile*>::Iterator iter = mTiles.Begin(); iter != end; iter++ )
-      {
-        Integration::BitmapPtr bitmap = LoadBitmap( (*iter)->url );
-        mResourceClient.UploadBitmap( destId, bitmap, (*iter)->xOffset, (*iter)->yOffset  );
-      }
-    }
-  }
-}
-
-Atlas::~Atlas()
-{
-  ReleaseAtlas();
-}
-
-Atlas::Atlas( SizeType width,
-              SizeType height,
-              Pixel::Format pixelFormat,
-              bool recoverContext )
-: mResourceClient( ThreadLocalStorage::Get().GetResourceClient() ),
-  mClearColor( Vector4::ZERO ),
-  mPixelFormat( pixelFormat ),
-  mClear( false ),
-  mRecoverContext( recoverContext )
-{
-  mWidth  = width;
-  mHeight = height;
-}
-
-void Atlas::Connect()
-{
-  ++mConnectionCount;
-
-  if( mConnectionCount == 1 )
-  {
-    AllocateAtlas();
-  }
-}
-
-void Atlas::Disconnect()
-{
-  if( mConnectionCount )
-  {
-    --mConnectionCount;
-
-    // Only release the atlas upon destruction
-  }
-}
-
-bool Atlas::IsInside( SizeType x, SizeType y )
-{
-  bool fit(false);
-
-  if( x <= mWidth  && y <= mHeight )
-  {
-    fit = true;
-  }
-  else
-  {
-    DALI_LOG_ERROR( "image does not fit within the atlas \n" );
-  }
-
-  return fit;
-}
-
-void Atlas::AllocateAtlas()
-{
-  if( !mTicket )
-  {
-    mTicket = mResourceClient.AllocateTexture( mWidth, mHeight, mPixelFormat );
-    mTicket->AddObserver( *this );
-  }
-}
-
-void Atlas::ReleaseAtlas()
-{
-  mTicket.Reset();
-  ClearCache();
-}
-
-void Atlas::ClearBackground(const Vector4& color )
-{
-  AllocateAtlas();
-  ResourceId destId = GetResourceId();
-  if( destId )
-  {
-    const unsigned int numPixels = mWidth * mHeight;
-    unsigned int bytesPerPixel = Pixel::GetBytesPerPixel(mPixelFormat);
-    BufferImagePtr imageData = BufferImage::New( mWidth, mHeight, mPixelFormat );
-    PixelBuffer* pixbuf = imageData->GetBuffer();
-
-    if( pixbuf )
-    {
-      // converting color value from float 0.f~1.f to byte 0~255
-      unsigned char r =  static_cast<unsigned char>( 255.f * Clamp( color.r, 0.f, 1.f ) );
-      unsigned char g =  static_cast<unsigned char>( 255.f * Clamp( color.g, 0.f, 1.f ) );
-      unsigned char b =  static_cast<unsigned char>( 255.f * Clamp( color.b, 0.f, 1.f ) );
-      unsigned char a =  static_cast<unsigned char>( 255.f * Clamp( color.a, 0.f, 1.f ) );
-      if( mPixelFormat == Pixel::RGBA8888 )
-      {
-        // For little-endian byte order, the RGBA channels needs to be reversed for bit shifting.
-        uint32_t clearColor = ( (uint32_t) a<<24 | (uint32_t)b << 16 | (uint32_t)g << 8 | (uint32_t)r );
-        uint32_t* buf = (uint32_t *) pixbuf;
-        for( unsigned int i = 0; i < numPixels; ++i )
-        {
-          buf[i] = clearColor;
-        }
-      }
-      else if( mPixelFormat == Pixel::RGB888 )
-      {
-        for( unsigned int i = 0; i < numPixels; ++i )
-        {
-          pixbuf[i*bytesPerPixel] = r;
-          pixbuf[i*bytesPerPixel+1] = g;
-          pixbuf[i*bytesPerPixel+2] = b;
-        }
-      }
-      else if( mPixelFormat == Pixel::A8 )
-      {
-        memset( pixbuf, a, numPixels );
-      }
-    }
-
-    mClearColor = color;
-    mClear = true;
-
-    imageData->UploadBitmap( destId, 0, 0 );
-  }
-}
-
-void Atlas::ClearCache()
-{
-  Vector< Tile* >::ConstIterator end = mTiles.End();
-  for( Vector<Tile*>::Iterator iter = mTiles.Begin(); iter != end; iter++ )
-  {
-    delete *iter;
-  }
-  mTiles.Clear();
-}
-
-Integration::BitmapPtr Atlas::LoadBitmap( const std::string& url )
-{
-  Integration::BitmapResourceType resourceType;
-  Integration::PlatformAbstraction& platformAbstraction = Internal::ThreadLocalStorage::Get().GetPlatformAbstraction();
-
-  Integration::ResourcePointer resource = platformAbstraction.LoadResourceSynchronously(resourceType, url);
-  Integration::BitmapPtr bitmap = static_cast<Integration::Bitmap*>( resource.Get());
-
-  return bitmap;
-}
-
-} // namespace Internal
-
-} // namespace Dali
diff --git a/dali/internal/event/images/atlas-impl.h b/dali/internal/event/images/atlas-impl.h
deleted file mode 100644 (file)
index 8edab85..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-#ifndef __DALI_INTERNAL_ATLAS_H__
-#define __DALI_INTERNAL_ATLAS_H__
-
-/*
- * Copyright (c) 2015 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/dali-vector.h>
-#include <dali/devel-api/images/atlas.h>
-#include <dali/internal/event/images/context-recovery-interface.h>
-#include <dali/internal/event/images/image-impl.h>
-#include <dali/internal/event/images/buffer-image-impl.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-class ResourceClient;
-
-typedef Dali::Atlas::SizeType SizeType;
-
-/**
- * Internal class for Dali::Atlas
- */
-class Atlas : public Image, public ContextRecoveryInterface
-{
-public:
-
-  /**
-   * @brief Create a new Atlas.
-   *
-   * @pre width & height are greater than zero.
-   * The maximum size of the atlas is limited by GL_MAX_TEXTURE_SIZE.
-   * @param [in] width          The atlas width in pixels.
-   * @param [in] height         The atlas height in pixels.
-   * @param [in] pixelFormat    The pixel format.
-   * @param [in] recoverContext Whether re-uploading the resource images automatically when regaining the context
-   * @return A pointer to a new Atlas.
-   */
-  static Atlas* New( SizeType width,
-                     SizeType height,
-                     Pixel::Format pixelFormat,
-                     bool recoverContext);
-
-  /**
-   * @copydoc Dali::Atlas::Clear
-   */
-  void Clear( const Vector4& color  );
-
-  /**
-   * @copydoc Dali::Atlas::Upload( const BufferImage&, uint32_t, uint32_t )
-   */
-  bool Upload( BufferImage& bufferImage,
-               SizeType xOffset,
-               SizeType yOffset );
-
-  /**
-   * @copydoc Dali::Atlas::Upload( const std::string&, uint32_t, uint32_t )
-   */
-  bool Upload( const std::string& url,
-               SizeType xOffset,
-               SizeType yOffset );
-
-  /**
-   * @copydoc Dali::Atlas::Upload( Dali::PixelData, uint32_t, uint32_t )
-   */
-  bool Upload( PixelDataPtr pixelData,
-               SizeType xOffset,
-               SizeType yOffset );
-
-  /**
-   * @copydoc ContextRecoveryInterface::RecoverFromContextLoss
-   */
-  virtual void RecoverFromContextLoss();
-
-protected:
-
-  /**
-   * @brief Protected constructor.
-   *
-   * @pre width & height are greater than zero.
-   * The maximum size of the atlas is limited by GL_MAX_TEXTURE_SIZE.
-   * @param [in] width          The atlas width in pixels.
-   * @param [in] height         The atlas height in pixels.
-   * @param [in] pixelFormat    The pixel format.
-   * @param [in] recoverContext Whether re-uploading the resource images automatically when regaining the context
-   */
-  Atlas( SizeType width,
-         SizeType height,
-         Pixel::Format pixelFormat,
-         bool recoverContext);
-
-  /**
-   * A reference counted object may only be deleted by calling Unreference()
-   */
-  virtual ~Atlas();
-
-  /**
-   * @copydoc Dali::Internal::Image::Connect
-   */
-  virtual void Connect();
-
-  /**
-   * @copydoc Dali::Internal::Image::Disconnect
-   */
-  virtual void Disconnect();
-
-private:
-
-  /**
-   * Helper for Upload methods
-   * @return True if the size of the bitmap fits within the atlas at the specified offset
-   */
-  bool IsInside( SizeType x, SizeType y );
-
-  /**
-   * Helper to create the Atlas resource
-   */
-  void AllocateAtlas();
-
-  /**
-   * Helper to release the Atlas resource
-   */
-  void ReleaseAtlas();
-
-  /**
-   * Upload a bitmap with the given color to clear the background.
-   */
-  void ClearBackground( const Vector4& color  );
-
-  /**
-   * Clear all the current tiles and resources of the atlas
-   */
-  void ClearCache();
-
-  /**
-   * Load the bitmap data from the url
-   */
-  Integration::BitmapPtr LoadBitmap( const std::string& url );
-
-private:
-
-  /**
-   * Record of the url resource in the Atlas.
-   */
-  struct Tile
-  {
-    Tile( SizeType xOffset, SizeType yOffset, const std::string& url )
-    : xOffset( xOffset ), yOffset( yOffset ), url(url)
-    {}
-
-    ~Tile(){};
-
-    SizeType xOffset;   ///< Offset in the x direction within the atlas
-    SizeType yOffset;   ///< Offset in the y direction within the atlas
-    std::string url;    ///< The URL of the resource image file to use
-
-  private:
-    Tile(const Tile& rhs); ///< not defined
-    Tile& operator=(const Tile& rhs); ///< not defined
-  };
-
-private:
-
-  ResourceClient&          mResourceClient;
-  Vector4                  mClearColor;       ///< The background clear color
-  Vector<Tile*>            mTiles;            ///< The url resources, which would recover automatically when regaining context
-  Pixel::Format            mPixelFormat;      ///< The pixel format (rgba 32 bit by default)
-  bool                     mClear:1;          ///< Clear the backgound or not
-  bool                     mRecoverContext:1; ///< Re-upload the url resources or not when regaining context
-};
-
-} // namespace Internal
-
-/**
- * Helper methods for public API.
- */
-inline Internal::Atlas& GetImplementation(Dali::Atlas& image)
-{
-  DALI_ASSERT_ALWAYS( image && "Atlas handle is empty" );
-
-  BaseObject& handle = image.GetBaseObject();
-
-  return static_cast<Internal::Atlas&>(handle);
-}
-
-inline const Internal::Atlas& GetImplementation(const Dali::Atlas& image)
-{
-  DALI_ASSERT_ALWAYS( image && "Atlas handle is empty" );
-
-  const BaseObject& handle = image.GetBaseObject();
-
-  return static_cast<const Internal::Atlas&>(handle);
-}
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_ATLAS_H__
index 8f8f786..3e2ca4b 100644 (file)
@@ -23,8 +23,8 @@
 
 // INTERNAL INCLUDES
 #include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/images/pixel-data.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>
 
 using namespace Dali::Integration;
@@ -45,6 +45,7 @@ BufferImagePtr BufferImage::New( unsigned int width,
 {
   BufferImagePtr internal = new BufferImage( width, height, pixelformat );
   internal->Initialize();
+  internal->Update( RectArea() );
   return internal;
 }
 
@@ -56,6 +57,7 @@ BufferImagePtr BufferImage::New( PixelBuffer* pixBuf,
 {
   BufferImagePtr internal = new BufferImage( pixBuf, width, height, pixelformat, stride );
   internal->Initialize();
+  internal->Update( RectArea() );
   return internal;
 }
 
@@ -98,12 +100,6 @@ BufferImage::BufferImage(PixelBuffer* pixBuf,
 
 BufferImage::~BufferImage()
 {
-  if( mTicket )
-  {
-    mTicket->RemoveObserver(*this);
-    mTicket.Reset();
-  }
-
   delete[] mInternalBuffer;
 }
 
@@ -131,41 +127,25 @@ bool BufferImage::IsDataExternal() const
   return ( mExternalBuffer ? true : false );
 }
 
-void BufferImage::Update( RectArea& updateArea )
+void BufferImage::Update( const RectArea& updateArea )
 {
-  if ( !mTicket )
+  if ( !mTexture )
   {
-    CreateHostBitmap();
+    mTexture = NewTexture::New( Dali::TextureType::TEXTURE_2D, mPixelFormat, mWidth, mHeight );
   }
   DALI_ASSERT_DEBUG( updateArea.x + updateArea.width <= mWidth && updateArea.y + updateArea.height <= mHeight );
-  UploadArea( mTicket->GetId(), updateArea );
-}
-
-void BufferImage::CreateHostBitmap()
-{
-  Integration::Bitmap* bitmap = Bitmap::New( Bitmap::BITMAP_2D_PACKED_PIXELS, mResourcePolicy );
-  Bitmap::PackedPixelsProfile* const packedBitmap = bitmap->GetPackedPixelsProfile();
-  DALI_ASSERT_DEBUG(packedBitmap);
-
-  packedBitmap->ReserveBuffer( mPixelFormat, mWidth, mHeight );
-  DALI_ASSERT_DEBUG(bitmap->GetBuffer() != 0);
-  DALI_ASSERT_DEBUG(bitmap->GetBufferSize() >= mHeight * mWidth * mBytesPerPixel );
-
-  mTicket = mResourceClient->AddBitmapImage( bitmap );
-  mTicket->AddObserver(*this);
+  UploadArea( updateArea );
 }
 
-void BufferImage::UploadArea( ResourceId destId, const RectArea& area )
+void BufferImage::UploadArea( const RectArea& area )
 {
-  Integration::Bitmap* bitmap = Bitmap::New( Bitmap::BITMAP_2D_PACKED_PIXELS, mResourcePolicy );
-  Bitmap::PackedPixelsProfile* const packedBitmap = bitmap->GetPackedPixelsProfile();
-  DALI_ASSERT_DEBUG(packedBitmap);
   DALI_ASSERT_DEBUG( area.width <= mWidth && area.height <= mHeight );
 
   mBufferWidth = area.width ? area.width : mWidth;
-  packedBitmap->ReserveBuffer( mPixelFormat, mBufferWidth, area.height ? area.height : mHeight );
-  DALI_ASSERT_DEBUG(bitmap->GetBuffer() != 0);
-  DALI_ASSERT_DEBUG(bitmap->GetBufferSize() >= mBufferWidth * ( area.height ? area.height : mHeight ) * mBytesPerPixel );
+  uint32_t bufferHeight = area.height ? area.height : mHeight;
+  size_t bufferSize = mBytesPerPixel * mBufferWidth * bufferHeight;
+  unsigned char* buffer = reinterpret_cast< Dali::Integration::PixelBuffer* >( malloc( bufferSize ) );
+  DALI_ASSERT_DEBUG(buffer != 0);
 
   // Are we uploading from an external or internal buffer ?
   if ( mExternalBuffer )
@@ -173,11 +153,11 @@ void BufferImage::UploadArea( ResourceId destId, const RectArea& area )
     // Check if we're doing the entire area without stride mismatch between source and dest ?
     if( ( mByteStride == mWidth * mBytesPerPixel ) && area.IsEmpty() )
     {
-      memcpy( bitmap->GetBuffer(), mExternalBuffer, mBufferSize );
+      memcpy( buffer, mExternalBuffer, mBufferSize );
     }
     else
     {
-      UpdateBufferArea( mExternalBuffer, bitmap->GetBuffer(), area );
+      UpdateBufferArea( mExternalBuffer, buffer, area );
     }
   }
   else
@@ -185,26 +165,15 @@ void BufferImage::UploadArea( ResourceId destId, const RectArea& area )
     // Check if we're doing the entire internal buffer ?
     if( area.IsEmpty() )
     {
-      memcpy( bitmap->GetBuffer(), mInternalBuffer, bitmap->GetBufferSize() );
+      memcpy( buffer, mInternalBuffer, bufferSize );
     }
     else
     {
-      UpdateBufferArea( mInternalBuffer, bitmap->GetBuffer(), area );
+      UpdateBufferArea( mInternalBuffer, buffer, area );
     }
   }
-  mResourceClient->UploadBitmap( destId, bitmap, area.x, area.y );
-
-}
-
-void BufferImage::UploadBitmap( ResourceId destId, std::size_t xOffset, std::size_t yOffset )
-{
-  RectArea area( xOffset, yOffset, 0, 0 );
-  if ( !mTicket )
-  {
-    CreateHostBitmap();
-  }
-
-  UploadArea( destId, area );
+  PixelDataPtr pixelData = PixelData::New( buffer, bufferSize, mBufferWidth, bufferHeight, mPixelFormat, Dali::PixelData::FREE );
+  mTexture->Upload( pixelData, 0u, 0u, area.x, area.y, mBufferWidth, bufferHeight );
 }
 
 void BufferImage::UpdateBufferArea( PixelBuffer* src, PixelBuffer* dest, const RectArea& area )
@@ -222,20 +191,6 @@ void BufferImage::UpdateBufferArea( PixelBuffer* src, PixelBuffer* dest, const R
   }
 }
 
-void BufferImage::Connect()
-{
-  if ( !mConnectionCount++ && !mTicket )
-  {
-    RectArea area;
-    Update( area );
-  }
-}
-
-void BufferImage::Disconnect()
-{
-  --mConnectionCount;
-}
-
 } // namespace Internal
 
 } // namespace Dali
index 496eaac..6b8ceb5 100644 (file)
@@ -129,7 +129,7 @@ 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);
+  void Update( const RectArea& updateArea);
 
   /**
    * @copydoc Dali::BufferImage::IsDataExternal
@@ -174,26 +174,6 @@ public:
     return mPixelFormat;
   }
 
-  /**
-   * @brief Upload pixel data to another resource at an offset
-   *
-   * @param destId ResourceId of the destination
-   * @param xOffset x offset in the destination
-   * @param yOffset y offset in the destination
-   */
-  void UploadBitmap( ResourceId destId, std::size_t xOffset, std::size_t yOffset );
-
-protected: // From Image
-  /**
-   * @copydoc Dali::Internal::Image::Connect
-   */
-  virtual void Connect();
-
-  /**
-   * @copydoc Dali::Internal::Image::Disconnect
-   */
-  virtual void Disconnect();
-
 private:
 
   void SetupBuffer( unsigned int width,
@@ -201,9 +181,7 @@ private:
                     Pixel::Format pixelformat,
                     unsigned int byteStride );
 
-  void CreateHostBitmap();
-
-  void UploadArea( ResourceId destId, const RectArea& area );
+  void UploadArea( const RectArea& area );
 
   void UpdateBufferArea( PixelBuffer* src, PixelBuffer* dest, const RectArea& area );
 
index 5538994..f7bf280 100644 (file)
@@ -24,7 +24,6 @@
 // INTERNAL INCLUDES
 #include <dali/public-api/object/type-registry.h>
 #include <dali/internal/event/common/thread-local-storage.h>
-#include <dali/internal/event/resources/resource-client.h>
 #include <dali/integration-api/platform-abstraction.h>
 
 namespace Dali
@@ -71,9 +70,35 @@ EncodedBufferImagePtr EncodedBufferImage::New( const uint8_t * const encodedImag
 
   if( bitmap )
   {
-    ResourceClient &resourceClient = ThreadLocalStorage::Get().GetResourceClient();
-    image->mTicket = resourceClient.AddBitmapImage( bitmap.Get() );
-    image->mTicket->AddObserver( *image );
+    unsigned width  = bitmap->GetImageWidth();
+    unsigned height = bitmap->GetImageHeight();
+
+    //Create texture
+    Pixel::Format format = bitmap->GetPixelFormat();
+    image->mTexture = NewTexture::New( Dali::TextureType::TEXTURE_2D, format, width, height );
+
+    //Upload data to the texture
+    size_t bufferSize = bitmap->GetBufferSize();
+    PixelDataPtr pixelData = PixelData::New( bitmap->GetBufferOwnership(), bufferSize, width, height, format,
+                                             static_cast< Dali::PixelData::ReleaseFunction >( bitmap->GetReleaseFunction() ) );
+    image->mTexture->Upload( pixelData );
+
+    image->mWidth = size.GetWidth();
+    if( image->mWidth == 0 )
+    {
+      image->mWidth = width;
+    }
+
+    image->mHeight = size.GetHeight();
+    if( image->mHeight == 0 )
+    {
+      image->mHeight = height;
+    }
+  }
+  else
+  {
+    image->mTexture = NewTexture::New( Dali::TextureType::TEXTURE_2D, Pixel::RGBA8888, 0u, 0u );
+    image->mWidth = image->mHeight = 0u;
   }
 
   return image;
index de3fe78..d5f1c89 100644 (file)
@@ -21,7 +21,6 @@
 // INTERNAL INCLUDES
 #include <dali/public-api/object/type-registry.h>
 #include <dali/internal/event/common/thread-local-storage.h>
-#include <dali/internal/event/resources/resource-client.h>
 
 namespace Dali
 {
@@ -32,6 +31,13 @@ namespace Internal
 namespace
 {
 TypeRegistration mType( typeid( Dali::FrameBufferImage ), typeid( Dali::Image ), NULL );
+
+const int RenderBufferFormatToFrameBufferAttachments[]  = { Dali::FrameBuffer::Attachment::NONE,
+                                                            Dali::FrameBuffer::Attachment::DEPTH,
+                                                            Dali::FrameBuffer::Attachment::STENCIL,
+                                                            Dali::FrameBuffer::Attachment::DEPTH_STENCIL
+                                                          };
+
 } // unnamed namespace
 
 FrameBufferImagePtr FrameBufferImage::New( unsigned int width,
@@ -39,8 +45,13 @@ FrameBufferImagePtr FrameBufferImage::New( unsigned int width,
                                            Pixel::Format pixelFormat,
                                            RenderBuffer::Format bufferformat )
 {
-  FrameBufferImagePtr image = new FrameBufferImage( width, height, pixelFormat, bufferformat );
+  FrameBufferImagePtr image = new FrameBufferImage( width, height );
   image->Initialize();
+
+  image->mTexture = NewTexture::New( Dali::TextureType::TEXTURE_2D, pixelFormat, width, height );
+  image->mFrameBufferObject = FrameBuffer::New( width, height, RenderBufferFormatToFrameBufferAttachments[bufferformat] );
+  image->mFrameBufferObject->AttachColorTexture( image->mTexture, 0u, 0u );
+
   return image;
 }
 
@@ -48,18 +59,17 @@ FrameBufferImagePtr FrameBufferImage::New( NativeImageInterface& nativeImage )
 {
   FrameBufferImagePtr image = new FrameBufferImage( nativeImage );
   image->Initialize();
+
+  image->mTexture = NewTexture::New( nativeImage );
+  image->mFrameBufferObject = FrameBuffer::New( image->mTexture->GetWidth(), image->mTexture->GetHeight(), Dali::FrameBuffer::Attachment::NONE );
+  image->mFrameBufferObject->AttachColorTexture( image->mTexture, 0u, 0u );
+
   return image;
 }
 
-
-FrameBufferImage::FrameBufferImage( unsigned int width,
-                                    unsigned int height,
-                                    Pixel::Format pixelFormat,
-                                    RenderBuffer::Format bufferformat )
+FrameBufferImage::FrameBufferImage( unsigned int width, unsigned int height)
 : Image(),
   mNativeImage(0),
-  mPixelFormat( pixelFormat ),
-  mBufferFormat( bufferformat ),
   mIsNativeFbo( false )
 {
   mWidth  = width;
@@ -69,54 +79,12 @@ FrameBufferImage::FrameBufferImage( unsigned int width,
 FrameBufferImage::FrameBufferImage( NativeImageInterface& nativeImage )
 : Image(),
   mNativeImage( &nativeImage ),
-  mPixelFormat( Pixel::FIRST_VALID_PIXEL_FORMAT ),
-  mBufferFormat( RenderBuffer::COLOR ),
   mIsNativeFbo( true )
 {
   mWidth = nativeImage.GetWidth();
   mHeight = nativeImage.GetHeight();
 }
 
-void FrameBufferImage::Connect()
-{
-  ++mConnectionCount;
-
-  if (mConnectionCount == 1)
-  {
-    // ticket was thrown away when related actors went offstage
-    if (!mTicket)
-    {
-      ResourceClient& resourceClient = ThreadLocalStorage::Get().GetResourceClient();
-      if (mNativeImage)
-      {
-        mTicket = resourceClient.AddFrameBufferImage(*mNativeImage);
-        mTicket->AddObserver(*this);
-      }
-      else
-      {
-        mTicket = resourceClient.AddFrameBufferImage(mWidth, mHeight, mPixelFormat, mBufferFormat);
-        mTicket->AddObserver(*this);
-      }
-    }
-  }
-}
-
-void FrameBufferImage::Disconnect()
-{
-  if(!mTicket)
-  {
-    return;
-  }
-
-  DALI_ASSERT_DEBUG(mConnectionCount > 0);
-  --mConnectionCount;
-  if (mConnectionCount == 0)
-  {
-    // release image memory when it's not visible anymore (decrease ref. count of texture)
-    mTicket->RemoveObserver(*this);
-    mTicket.Reset();
-  }
-}
 
 bool FrameBufferImage::IsNativeFbo() const
 {
index 42d5872..7e69797 100644 (file)
@@ -21,6 +21,7 @@
 // INTERNAL INCLUDES
 #include <dali/internal/event/images/image-impl.h>
 #include <dali/public-api/images/frame-buffer-image.h>
+#include <dali/internal/event/rendering/frame-buffer-impl.h>
 
 namespace Dali
 {
@@ -51,7 +52,7 @@ public:
   /**
    * @copydoc Dali::FrameBufferImage::FrameBufferImage
    */
-  FrameBufferImage( unsigned int width, unsigned int height, Pixel::Format pixelFormat, RenderBuffer::Format bufferformat );
+  FrameBufferImage( unsigned int width, unsigned int height );
 
   /**
    * @copydoc Dali::FrameBufferImage::FrameBufferImage
@@ -63,16 +64,13 @@ public:
    */
   bool IsNativeFbo() const;
 
-public: // From Image
   /**
-   * @copydoc Dali::Internal::Image::Connect()
+   * @return Internal FrameBuffer used by this FrameBufferImage
    */
-  virtual void Connect();
-
-  /**
-   * @copydoc Dali::Internal::Image::Disconnect()
-   */
-  virtual void Disconnect();
+  FrameBuffer* GetFrameBuffer() const
+  {
+    return mFrameBufferObject.Get();
+  }
 
 protected:
   /**
@@ -82,9 +80,8 @@ protected:
 
 private:
   // cached values for the size / pixel format we were created with. Needed to recreate us when we Connect() to stage and mTicket was reset from a previous call to Disconnect().
+  FrameBufferPtr  mFrameBufferObject;
   NativeImageInterfacePtr mNativeImage;
-  Pixel::Format mPixelFormat;
-  RenderBuffer::Format mBufferFormat;
   bool mIsNativeFbo;
 }; // class FrameBufferImage
 
index 6f965cb..9c9fdc0 100644 (file)
@@ -22,9 +22,6 @@
 #include <dali/public-api/common/dali-common.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/integration-api/debug.h>
-#include <dali/internal/event/resources/resource-ticket.h>
-#include <dali/internal/event/common/thread-local-storage.h>
-#include <dali/internal/event/resources/resource-client.h>
 #include <dali/internal/event/common/stage-impl.h>
 #include <dali/devel-api/images/native-image-interface-extension.h>
 
@@ -57,16 +54,10 @@ NativeImagePtr NativeImage::New( NativeImageInterface& resourceData )
   NativeImagePtr image = new NativeImage( resourceData );
   image->Initialize();
 
-  ResourceClient &resourceClient = ThreadLocalStorage::Get().GetResourceClient();
-
   image->mWidth  = resourceData.GetWidth();
   image->mHeight = resourceData.GetHeight();
 
-  const ResourceTicketPtr& ticket = resourceClient.AddNativeImage( resourceData );
-  DALI_ASSERT_DEBUG( dynamic_cast<ImageTicket*>( ticket.Get() ) && "Resource ticket not ImageTicket subclass for image resource.\n" );
-  image->mTicket = static_cast<ImageTicket*>(ticket.Get());
-  image->mTicket->AddObserver( *image );
-
+  image->mTexture = NewTexture::New( resourceData );
   return image;
 }
 
@@ -74,12 +65,6 @@ NativeImage::~NativeImage()
 {
 }
 
-void NativeImage::CreateGlTexture()
-{
-  ResourceClient& resourceClient = ThreadLocalStorage::Get().GetResourceClient();
-  resourceClient.CreateGlTexture( GetResourceId() );
-}
-
 const char* NativeImage::GetCustomFragmentPreFix()
 {
   if( mCustomFragmentPreFix.empty() )
index ef580fb..8c2c00b 100644 (file)
@@ -49,11 +49,6 @@ public:
    */
   static NativeImagePtr New( NativeImageInterface& nativeImageInterface );
 
-  /**
-   * @copydoc Dali::NativeImage::CreateGlTexture
-   */
-  void CreateGlTexture();
-
 protected:
 
   /**
index a1ad2b8..64a3f77 100644 (file)
@@ -147,54 +147,28 @@ CameraActor* RenderTask::GetCameraActor() const
   return static_cast< CameraActor* >( mCameraConnector.mActor );
 }
 
-void RenderTask::SetTargetFrameBuffer( Dali::FrameBufferImage image )
+void RenderTask::SetTargetFrameBuffer( FrameBufferImagePtr image )
 {
-  if ( mFrameBufferImage != image )
+  mFrameBufferImage = image;
+  FrameBuffer* frameBufferPtr( NULL );
+  if( image )
   {
-    // if we have a scene object we need to track connection status and set frame buffer id as well as updating target frame buffer
-    if ( mSceneObject )
-    {
-      if(mFrameBufferImage)
-      {
-        GetImplementation(mFrameBufferImage).Disconnect();
-      }
-
-      // update target frame buffer
-      mFrameBufferImage = image;
-
-      unsigned int resourceId = 0;
-      bool isNativeFBO = false;
-      if( mFrameBufferImage )
-      {
-        Dali::Internal::FrameBufferImage& impl = GetImplementation( mFrameBufferImage );
-        impl.Connect();
-        resourceId = impl.GetResourceId();
-        isNativeFBO = impl.IsNativeFbo();
-      }
-
-      // mSceneObject is being used in a separate thread; queue a message to set the value
-      SetFrameBufferIdMessage( GetEventThreadServices(), *mSceneObject, resourceId, isNativeFBO );
-    }
-    else
-    {
-      // update target frame buffer
-      mFrameBufferImage = image;
-    }
+    frameBufferPtr = image->GetFrameBuffer();
   }
+
+  SetFrameBuffer( frameBufferPtr );
 }
 
-void RenderTask::SetFrameBuffer( Dali::FrameBuffer frameBuffer )
+void RenderTask::SetFrameBuffer( FrameBufferPtr frameBuffer )
 {
+  mFrameBuffer = frameBuffer;
+  Render::FrameBuffer* renderFrameBufferPtr( NULL );
   if( frameBuffer )
   {
-    mFrameBuffer = Internal::FrameBufferPtr( &GetImplementation( frameBuffer ) );
-    SetFrameBufferMessage( GetEventThreadServices(), *mSceneObject, mFrameBuffer->GetRenderObject() );
-  }
-  else
-  {
-    mFrameBuffer.Reset();
-    SetFrameBufferMessage( GetEventThreadServices(), *mSceneObject, NULL );
+    renderFrameBufferPtr = mFrameBuffer->GetRenderObject();
   }
+
+  SetFrameBufferMessage( GetEventThreadServices(), *mSceneObject, renderFrameBufferPtr );
 }
 
 FrameBuffer* RenderTask::GetFrameBuffer() const
@@ -202,9 +176,9 @@ FrameBuffer* RenderTask::GetFrameBuffer() const
   return mFrameBuffer.Get();
 }
 
-Dali::FrameBufferImage RenderTask::GetTargetFrameBuffer() const
+FrameBufferImage* RenderTask::GetTargetFrameBuffer() const
 {
-  return mFrameBufferImage;
+  return mFrameBufferImage.Get();
 }
 
 void RenderTask::SetScreenToFrameBufferFunction( ScreenToFrameBufferFunction conversionFunction )
@@ -262,8 +236,8 @@ void RenderTask::GetViewport( Viewport& viewPort ) const
     if ( mFrameBufferImage )
     {
       viewPort.x = viewPort.y = 0;
-      viewPort.width = mFrameBufferImage.GetWidth();
-      viewPort.height = mFrameBufferImage.GetHeight();
+      viewPort.width = mFrameBufferImage->GetWidth();
+      viewPort.height = mFrameBufferImage->GetHeight();
     }
     else
     {
@@ -505,26 +479,14 @@ SceneGraph::RenderTask* RenderTask::CreateSceneObject()
   // Keep the raw-pointer until DiscardSceneObject is called
   mSceneObject = SceneGraph::RenderTask::New();
 
-  // if we have a frame buffer we need to track connection status then send a message to set the frame buffer id in case it has changed since last time we were on stage
-  unsigned int resourceId = 0;
-  bool isNativeFBO = false;
-  if( mFrameBufferImage )
-  {
-    Dali::Internal::FrameBufferImage& impl = GetImplementation( mFrameBufferImage );
-    impl.Connect();
-    resourceId = impl.GetResourceId();
-    isNativeFBO = impl.IsNativeFbo();
-  }
-
-  // mSceneObject is being used in a separate thread; queue a message to set the value
-  SetFrameBufferIdMessage( GetEventThreadServices(), *mSceneObject, resourceId, isNativeFBO );
-
   // Send messages to set other properties that may have changed since last time we were on stage
   SetExclusiveMessage( GetEventThreadServices(), *mSceneObject, mExclusive );
   SetClearColorMessage(  GetEventThreadServices(), *mSceneObject, mClearColor );
   SetClearEnabledMessage(  GetEventThreadServices(), *mSceneObject, mClearEnabled );
   SetCullModeMessage(  GetEventThreadServices(), *mSceneObject, mCullMode );
   SetRefreshRateMessage(  GetEventThreadServices(), *mSceneObject, mRefreshRate );
+  SetSyncRequiredMessage( GetEventThreadServices(), *mSceneObject, mRequiresSync );
+  SetFrameBuffer( mFrameBuffer );
 
   // Caller takes ownership
   return mSceneObject;
@@ -539,12 +501,6 @@ void RenderTask::DiscardSceneObject()
 {
   // mSceneObject is not owned; throw away the raw-pointer
   mSceneObject = NULL;
-
-  // if we have a frame buffer we need to track connection status
-  if(mFrameBufferImage)
-  {
-    GetImplementation(mFrameBufferImage).Disconnect();
-  }
 }
 
 /********************************************************************************
index 9002aa6..0c65e6f 100644 (file)
@@ -21,7 +21,7 @@
 // INTERNAL INCLUDES
 #include <dali/public-api/object/base-object.h>
 #include <dali/public-api/render-tasks/render-task.h>
-#include <dali/public-api/images/frame-buffer-image.h>
+#include <dali/internal/event/images/frame-buffer-image-impl.h>
 #include <dali/internal/event/common/object-impl.h>
 #include <dali/internal/event/rendering/frame-buffer-impl.h>
 
@@ -96,17 +96,17 @@ public:
   /**
    * @copydoc Dali::RenderTask::SetTargetFrameBuffer()
    */
-  void SetTargetFrameBuffer( Dali::FrameBufferImage frameBuffer );
+  void SetTargetFrameBuffer( FrameBufferImagePtr frameBuffer );
 
   /**
    * @copydoc Dali::RenderTask::GetTargetFrameBuffer
    */
-  Dali::FrameBufferImage GetTargetFrameBuffer() const;
+  FrameBufferImage* GetTargetFrameBuffer() const;
 
   /**
     * @copydoc Dali::RenderTask::SetFrameBuffer()
     */
-   void SetFrameBuffer( Dali::FrameBuffer frameBuffer );
+   void SetFrameBuffer( FrameBufferPtr frameBuffer );
 
    /**
     * @copydoc Dali::RenderTask::GetFrameBuffer
@@ -461,7 +461,7 @@ private:
 
   unsigned int mRefreshOnceCounter;
 
-  Dali::FrameBufferImage mFrameBufferImage;  ///< Optional off-screen render target.
+  FrameBufferImagePtr mFrameBufferImage;  ///< Optional off-screen render target.
   FrameBufferPtr  mFrameBuffer;
 
 
index b4f33a5..a6fd3dc 100644 (file)
@@ -109,7 +109,6 @@ public:
    */
   unsigned int GetHeight() const;
 
-
 private: // implementation
 
   /**
index 5358b5f..cf648b1 100644 (file)
@@ -62,7 +62,6 @@ internal_src_files = \
   $(internal_src_dir)/event/events/tap-gesture-processor.cpp \
   $(internal_src_dir)/event/events/touch-data-impl.cpp \
   $(internal_src_dir)/event/events/touch-event-processor.cpp \
-  $(internal_src_dir)/event/images/atlas-impl.cpp \
   $(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 \
index 1e141d0..1021521 100644 (file)
@@ -699,7 +699,7 @@ void RenderManager::DoRender( RenderInstruction& instruction, Shader& defaultSha
     mImpl->context.InvalidateFramebuffer(GL_FRAMEBUFFER, 2, attachments);
   }
 
-  if( instruction.mRenderTracker && offscreen != NULL )
+  if( instruction.mRenderTracker && ( offscreen != NULL || instruction.mFrameBuffer != NULL ) )
   {
     // This will create a sync object every frame this render tracker
     // is alive (though it should be now be created only for
index 83cf6bb..35557ca 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <dali/public-api/actors/sampling.h>
 #include <dali/public-api/rendering/sampler.h>
-#include <dali/internal/render/renderers/render-sampler.h>
 
 namespace Dali
 {
index 2a9d4c4..e612537 100644 (file)
@@ -799,6 +799,11 @@ void NewTexture::Upload( Context& context, PixelDataPtr pixelData, const Interna
 
 bool NewTexture::Bind( Context& context, unsigned int textureUnit, Render::Sampler* sampler )
 {
+  if( mNativeImage && mId == 0 )
+  {
+    Initialize( context );
+  }
+
   if( mId != 0 )
   {
     context.ActiveTexture( static_cast<TextureUnit>(textureUnit) );
@@ -823,34 +828,37 @@ void NewTexture::ApplySampler( Context& context, Render::Sampler* sampler )
 
   if( mSampler.mBitfield != oldSampler.mBitfield )
   {
-    if( mSampler.mMinificationFilter != oldSampler.mMinificationFilter )
+    GLint mode = FilterModeToGL( mSampler.mMinificationFilter, DALI_MINIFY_DEFAULT, GL_MINIFY_DEFAULT );
+    if( mode != FilterModeToGL( oldSampler.mMinificationFilter, DALI_MINIFY_DEFAULT, GL_MINIFY_DEFAULT ) )
     {
-      GLint glFilterMode = FilterModeToGL( mSampler.mMinificationFilter, DALI_MINIFY_DEFAULT, GL_MINIFY_DEFAULT );
-      context.TexParameteri( mTarget, GL_TEXTURE_MIN_FILTER, glFilterMode );
+      context.TexParameteri( mTarget, GL_TEXTURE_MIN_FILTER, mode );
     }
 
-    if( mSampler.mMagnificationFilter != oldSampler.mMagnificationFilter )
+    mode = FilterModeToGL( mSampler.mMagnificationFilter, DALI_MAGNIFY_DEFAULT, GL_MAGNIFY_DEFAULT );
+    if( mode != FilterModeToGL( oldSampler.mMagnificationFilter, DALI_MAGNIFY_DEFAULT, GL_MAGNIFY_DEFAULT ) )
     {
-      GLint glFilterMode = FilterModeToGL( mSampler.mMagnificationFilter, DALI_MAGNIFY_DEFAULT, GL_MAGNIFY_DEFAULT );
-      context.TexParameteri( mTarget, GL_TEXTURE_MAG_FILTER, glFilterMode );
+      context.TexParameteri( mTarget, GL_TEXTURE_MAG_FILTER, mode );
     }
 
-    if( mSampler.mSWrapMode != oldSampler.mSWrapMode )
+    mode = WrapModeToGL( mSampler.mSWrapMode, GL_WRAP_DEFAULT );
+    if( mode != WrapModeToGL( oldSampler.mSWrapMode, GL_WRAP_DEFAULT ) )
     {
-      GLint glWrapMode = WrapModeToGL( mSampler.mSWrapMode, GL_WRAP_DEFAULT );
-      context.TexParameteri( mTarget, GL_TEXTURE_WRAP_S, glWrapMode );
+      context.TexParameteri( mTarget, GL_TEXTURE_WRAP_S, mode );
     }
 
-    if( mSampler.mTWrapMode != oldSampler.mTWrapMode )
+    mode = WrapModeToGL( mSampler.mTWrapMode, GL_WRAP_DEFAULT );
+    if( mode != WrapModeToGL( oldSampler.mTWrapMode, GL_WRAP_DEFAULT ) )
     {
-      GLint glWrapMode = WrapModeToGL( mSampler.mTWrapMode, GL_WRAP_DEFAULT );
-      context.TexParameteri( mTarget, GL_TEXTURE_WRAP_T, glWrapMode );
+      context.TexParameteri( mTarget, GL_TEXTURE_WRAP_T, mode );
     }
 
-    if( mType == TextureType::TEXTURE_CUBE && mSampler.mRWrapMode != oldSampler.mRWrapMode )
+    if( mType == TextureType::TEXTURE_CUBE )
     {
-      GLint glWrapMode = WrapModeToGL( mSampler.mRWrapMode, GL_WRAP_DEFAULT );
-      context.TexParameteri( mTarget, GL_TEXTURE_WRAP_R, glWrapMode );
+      mode = WrapModeToGL( mSampler.mRWrapMode, GL_WRAP_DEFAULT );
+      if( mode != WrapModeToGL( oldSampler.mRWrapMode, GL_WRAP_DEFAULT ) )
+      {
+        context.TexParameteri( mTarget, GL_TEXTURE_WRAP_R, mode );
+      }
     }
   }
 }
index 45de3d4..3ef1b3f 100644 (file)
@@ -127,7 +127,6 @@ unsigned int RenderTask::GetFrameBufferId() const
 
 void RenderTask::SetFrameBuffer( Render::FrameBuffer* frameBuffer )
 {
-  mTargetIsNativeFramebuffer = false;
   mFrameBuffer = frameBuffer;
 }
 
@@ -344,6 +343,14 @@ void RenderTask::UpdateState()
           mNotifyTrigger = true;
         }
       }
+      else if( mFrameBuffer )
+      {
+        if( !mRenderSyncTracker || (mRenderSyncTracker && mRenderSyncTracker->IsSynced() ))
+        {
+          mWaitingToRender = false;
+          mNotifyTrigger = true;
+        }
+      }
       else
       {
         mNotifyTrigger = true;
@@ -421,7 +428,7 @@ void RenderTask::PrepareRenderInstruction( RenderInstruction& instruction, Buffe
                      viewportSet ? &viewport : NULL,
                      mClearEnabled ? &GetClearColor( updateBufferIndex ) : NULL );
 
-  if( mTargetIsNativeFramebuffer && mRequiresSync &&
+  if( mRequiresSync &&
       mRefreshRate == Dali::RenderTask::REFRESH_ONCE &&
       mResourcesFinished )
   {
index 81fae36..1508296 100644 (file)
@@ -50,7 +50,7 @@ NativeImage& NativeImage::operator=( const NativeImage& rhs )
 
 void NativeImage::CreateGlTexture()
 {
-  GetImplementation(*this).CreateGlTexture();
+  //Nothing to do here. The texture is created immediately.
 }
 
 NativeImage NativeImage::New( NativeImageInterface& resourceData )
index 9d0da9b..b9545ab 100644 (file)
@@ -23,6 +23,7 @@
 #include <dali/public-api/rendering/frame-buffer.h>
 #include <dali/internal/event/actors/actor-impl.h>
 #include <dali/internal/event/actors/camera-actor-impl.h>
+#include <dali/internal/event/images/frame-buffer-image-impl.h>
 #include <dali/internal/event/render-tasks/render-task-impl.h>
 
 namespace Dali
@@ -117,19 +118,32 @@ CameraActor RenderTask::GetCameraActor() const
   return Dali::CameraActor(GetImplementation(*this).GetCameraActor());
 }
 
-void RenderTask::SetTargetFrameBuffer( FrameBufferImage frameBuffer )
+void RenderTask::SetTargetFrameBuffer( Dali::FrameBufferImage frameBuffer )
 {
-  GetImplementation(*this).SetTargetFrameBuffer( frameBuffer );
+  Internal::FrameBufferImage* frameBufferPtr( NULL );
+  if( frameBuffer )
+  {
+    frameBufferPtr = &GetImplementation( frameBuffer );
+  }
+
+  GetImplementation(*this).SetTargetFrameBuffer( frameBufferPtr );
 }
 
 FrameBufferImage RenderTask::GetTargetFrameBuffer() const
 {
-  return GetImplementation(*this).GetTargetFrameBuffer();
+  Internal::FrameBufferImage* frameBufferPtr = GetImplementation(*this).GetTargetFrameBuffer();
+  return Dali::FrameBufferImage( frameBufferPtr );
 }
 
 void RenderTask::SetFrameBuffer( FrameBuffer frameBuffer )
 {
-  GetImplementation(*this).SetFrameBuffer( frameBuffer );
+  Internal::FrameBuffer* frameBufferPtr( NULL );
+  if( frameBuffer )
+  {
+    frameBufferPtr = &GetImplementation( frameBuffer );
+  }
+
+  GetImplementation(*this).SetFrameBuffer( frameBufferPtr );
 }
 
 FrameBuffer RenderTask::GetFrameBuffer() const