Merge "Add IMPORT_DALI_API to item-layout" into tizen
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / bubble-effect / bubble-emitter-impl.h
index 5a42bc7..3ae36a1 100644 (file)
@@ -1,30 +1,37 @@
 #ifndef __DALI_TOOLKIT_INTERNAL_BUBBLE_EMITTER_IMPL_H__
 #define __DALI_TOOLKIT_INTERNAL_BUBBLE_EMITTER_IMPL_H__
 
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/actors/camera-actor.h>
+#include <dali/public-api/actors/image-actor.h>
+#include <dali/public-api/actors/mesh-actor.h>
+#include <dali/public-api/common/stage.h>
+#include <dali/public-api/images/frame-buffer-image.h>
+#include <dali/public-api/geometry/mesh.h>
+#include <dali/public-api/render-tasks/render-task.h>
 
 // INTERNAL INCLUDES
-#include <dali/dali.h>
 #include <dali-toolkit/public-api/controls/control-impl.h>
 #include <dali-toolkit/public-api/controls/bubble-effect/bubble-emitter.h>
 #include <dali-toolkit/public-api/shader-effects/bubble-effect/bubble-effect.h>
 
-#include <map>
-
 namespace Dali
 {
 
@@ -37,7 +44,7 @@ namespace Internal
 /**
  * BubbleEmitter implementation class.
  */
-class BubbleEmitter : public ControlImpl
+class BubbleEmitter : public Control
 {
 public:
 
@@ -126,6 +133,11 @@ private:
   void OnRenderFinished(RenderTask& source);
 
   /**
+   * Callback function from Stage to tell us if the context has been regained.
+   */
+  void OnContextRegained();
+
+  /**
    * Generate the material object which is attached to the meshActor to describe its color, texture, texture mapping mode etc.
    */
   void GenMaterial();
@@ -198,6 +210,8 @@ private:
   unsigned int                mNumBubblePerShader;  ///< How many bubbles for each BubbleEffect shader.
   unsigned int                mNumShader;           ///< How many BubbleEffect shaders are used.
   unsigned int                mTotalNumOfBubble;    ///< mNumBubblePerShader*mNumShader.
+  bool                        mRenderTaskRunning;   ///< If the background render task is currently running
+
   Vector2                     mBubbleSizeRange;     ///< The bubble size range.
 
   std::vector<Mesh>           mMesh;                ///< The mesh vector, each mesh is used to create a meshActor which applies a BubbleEffect.
@@ -210,6 +224,8 @@ private:
 
   unsigned int                mCurrentUniform;      ///< Keep track of the uniform index for the newly emitted bubble
 
+  Vector3                     mHSVDelta;            ///< The HSV difference used to adjust the background image color.
+  Image                       mBackgroundImage;     ///< The original background image
   FrameBufferImage            mEffectImage;         ///< The image stores the adjusted color of the background image.The bubbles pick color from this image.
   CameraActor                 mCameraActor;         ///< The render task views the scene from the perspective of this actor.