Making DALi public API typesafe using guaranteed types; uint8_t, uint32_t
[platform/core/uifw/dali-core.git] / dali / public-api / render-tasks / render-task.cpp
index 32f0c9d..099a0ad 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
 
 // INTERNAL INCLUDES
 #include <dali/public-api/common/constants.h>
+#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>
-#include <dali/devel-api/rendering/frame-buffer.h>
 
 namespace Dali
 {
@@ -42,12 +43,12 @@ static bool FullScreenFrameBufferFunction( Vector2& coordinates )
 RenderTask::ConstScreenToFrameBufferFunction RenderTask::DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION = DefaultScreenToFrameBufferFunction;
 RenderTask::ConstScreenToFrameBufferFunction RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION        = FullScreenFrameBufferFunction;
 
-const bool         RenderTask::DEFAULT_EXCLUSIVE     = false;
-const bool         RenderTask::DEFAULT_INPUT_ENABLED = true;
-const Vector4      RenderTask::DEFAULT_CLEAR_COLOR   = Vector4( 0.0f, 0.0f, 0.0f, 1.0f ); // cannot use Color::Black because it may or may not be initialized yet
-const bool         RenderTask::DEFAULT_CLEAR_ENABLED = false;
-const bool         RenderTask::DEFAULT_CULL_MODE     = true;
-const unsigned int RenderTask::DEFAULT_REFRESH_RATE  = REFRESH_ALWAYS;
+const bool     RenderTask::DEFAULT_EXCLUSIVE     = false;
+const bool     RenderTask::DEFAULT_INPUT_ENABLED = true;
+const Vector4  RenderTask::DEFAULT_CLEAR_COLOR   = Vector4( 0.0f, 0.0f, 0.0f, 1.0f ); // cannot use Color::Black because it may or may not be initialized yet
+const bool     RenderTask::DEFAULT_CLEAR_ENABLED = false;
+const bool     RenderTask::DEFAULT_CULL_MODE     = true;
+const uint32_t RenderTask::DEFAULT_REFRESH_RATE  = REFRESH_ALWAYS;
 
 RenderTask::RenderTask()
 {
@@ -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
@@ -227,12 +241,12 @@ bool RenderTask::GetCullMode() const
   return GetImplementation(*this).GetCullMode();
 }
 
-void RenderTask::SetRefreshRate( unsigned int refreshRate )
+void RenderTask::SetRefreshRate( uint32_t refreshRate )
 {
   GetImplementation(*this).SetRefreshRate( refreshRate );
 }
 
-unsigned int RenderTask::GetRefreshRate() const
+uint32_t RenderTask::GetRefreshRate() const
 {
   return GetImplementation(*this).GetRefreshRate();
 }