add CaptureProvider
authorDae young Ryu <karzia@samsung.com>
Thu, 27 Jun 2013 11:55:50 +0000 (20:55 +0900)
committerDae young Ryu <karzia@samsung.com>
Thu, 27 Jun 2013 12:05:16 +0000 (21:05 +0900)
Change-Id: I3179e64ad09c9b7a11367c041b3e48a913be3f39
Signed-off-by: Dae young Ryu <karzia@samsung.com>
src/ui/animations/FUiAnim_VisualElementImpl.cpp
src/ui/inc/FUiAnim_IVisualElementCaptureProvider.h [new file with mode: 0644]
src/ui/inc/FUiAnim_VisualElementImpl.h

index da09ad0..f2cb3c2 100644 (file)
@@ -44,7 +44,7 @@
 
 #include "FUi_Rectanglef.h"
 #include "FUi_CoordinateSystemUtils.h"
-
+#include "FUiAnim_IVisualElementCaptureProvider.h"
 #include "FUiAnim_VisualElementImpl.h"
 #include "FUiAnim_VisualElementCanvas.h"
 
@@ -224,6 +224,7 @@ _VisualElementImpl::_VisualElementImpl(VisualElement& element)
        , __pBoundsChangedCallbackData(null)
        , __pDestroyedCallback(null)
        , __pDestroyedCallbackData(null)
+       , __pCaptureProvider(null)
 {
        ClearLastResult();
 
@@ -282,6 +283,7 @@ _VisualElementImpl::_VisualElementImpl(VisualElement& presentation, _VisualEleme
        , __pBoundsChangedCallbackData(modelImpl.__pBoundsChangedCallbackData)
        , __pDestroyedCallback(modelImpl.__pDestroyedCallback)
        , __pDestroyedCallbackData(modelImpl.__pDestroyedCallbackData)
+       , __pCaptureProvider(null)
 {
        ClearLastResult();
 
@@ -6119,20 +6121,36 @@ _VisualElementImpl::CaptureI(Canvas& outputCanvas, const FloatRectangle& rectDes
                        {
                                _EflVisualElementSurfaceImpl* pSurfImpl = dynamic_cast<_EflVisualElementSurfaceImpl*>(_VisualElementSurfaceImpl::GetInstance(*__pSharedData->pSurface));
 
-                               if(pSurfImpl && pSurfImpl->GetNativeHandle() && pSurfImpl->__isImageObject)
+                               if(pSurfImpl && pSurfImpl->GetNativeHandle() )
                                {
                                        BufferInfo info;
-                                       __pSharedData->pSurface->GetBufferInfo(info);
+                                       byte* pStart = null;
+                                       bool isCaptured = false;
 
-                                       byte* pStart = (byte*)evas_object_image_data_get((Evas_Object*)pSurfImpl->GetNativeHandle(), false);
-                                       _DisplayManager::RestoreContext();
+                                       if(pSurfImpl->__isImageObject)
+                                       {
+                                               __pSharedData->pSurface->GetBufferInfo(info);
 
-                                       if(pStart)
+                                               pStart = (byte*)evas_object_image_data_get((Evas_Object*)pSurfImpl->GetNativeHandle(), false);
+                                               _DisplayManager::RestoreContext();
+                                       }
+                                       else
                                        {
+                                               if(__pCaptureProvider)
+                                               {
+                                                       isCaptured = true;
+                                                       if(__pCaptureProvider->OnCaptureAcquire(info))
+                                                       {
+                                                               pStart = (byte*)info.pPixels;
+                                                       }
+                                                       _DisplayManager::RestoreContext();
+                                               }
+                                       }
 
+                                       if(pStart)
+                                       {
                                                _VisualElementCoordinateSystem::ConvertRectangleToPhysicalIntegral(drawRect.x, drawRect.y, drawRect.width, drawRect.height);
 
-
                                                BufferInfo copyInfo;
                                                copyInfo.bitsPerPixel = info.bitsPerPixel;
                                                copyInfo.width = drawRect.width;
@@ -6193,10 +6211,16 @@ _VisualElementImpl::CaptureI(Canvas& outputCanvas, const FloatRectangle& rectDes
                                                        }
                                                        delete [] pCopy;
                                                }
+                                               if(isCaptured && __pCaptureProvider)
+                                               {
+                                                       __pCaptureProvider->OnCaptureRleased();
+                                               }
+
                                        }
+
                                }
-#endif
                        }
+#endif
                }
                else
                {
@@ -6295,11 +6319,28 @@ _VisualElementImpl::CaptureI(Canvas& outputCanvas, const FloatRectangle& rectDes
 
                                if(pSurfImpl && pSurfImpl->GetNativeHandle() && pSurfImpl->__isImageObject)
                                {
-                                       byte* pStart = (byte*)evas_object_image_data_get((Evas_Object*)pSurfImpl->GetNativeHandle(), false);
-                                       _DisplayManager::RestoreContext();
-
                                        BufferInfo info;
-                                       __pSharedData->pSurface->GetBufferInfo(info);
+                                       byte* pStart = null;
+                                       bool isCaptured = false;
+                                       if(pSurfImpl->__isImageObject)
+                                       {
+                                               __pSharedData->pSurface->GetBufferInfo(info);
+
+                                               pStart = (byte*)evas_object_image_data_get((Evas_Object*)pSurfImpl->GetNativeHandle(), false);
+                                               _DisplayManager::RestoreContext();
+                                       }
+                                       else
+                                       {
+                                               if(__pCaptureProvider)
+                                               {
+                                                       isCaptured = true;
+                                                       if(__pCaptureProvider->OnCaptureAcquire(info))
+                                                       {
+                                                               pStart = (byte*)info.pPixels;
+                                                       }
+                                                       _DisplayManager::RestoreContext();
+                                               }
+                                       }
 
                                        if(pStart)
                                        {
@@ -6324,6 +6365,10 @@ _VisualElementImpl::CaptureI(Canvas& outputCanvas, const FloatRectangle& rectDes
                                                                delete pBitmap;
                                                        }
                                                }
+                                               if(isCaptured && __pCaptureProvider)
+                                               {
+                                                       __pCaptureProvider->OnCaptureRleased();
+                                               }
                                        }
                                }
 #endif
@@ -6859,6 +6904,17 @@ _VisualElementImpl::SetDestroyedCallback(DestroyedCallback pCallback, void* pDat
        __pDestroyedCallbackData = pData;
 }
 
+void
+_VisualElementImpl::SetCaptureProvider(_IVisualElementCaptureProvider* pProvider)
+{
+       __pCaptureProvider = pProvider;
+}
+
+_IVisualElementCaptureProvider*
+_VisualElementImpl::GetCaptureProvider(void) const
+{
+       return __pCaptureProvider;
+}
 
 // delegate---------------------------------------------------------------------------------
 
diff --git a/src/ui/inc/FUiAnim_IVisualElementCaptureProvider.h b/src/ui/inc/FUiAnim_IVisualElementCaptureProvider.h
new file mode 100644 (file)
index 0000000..c679f81
--- /dev/null
@@ -0,0 +1,45 @@
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 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.
+//
+
+/**
+ * @file       FUiAnim_IVisualElementCaptureProvider.h
+ * @brief      Header file of  _IVisualElementCaptureProvider class
+ *
+ * This file contains declarations _IVisualElementCaptureProvider class.
+ */
+
+#ifndef _FUI_ANIM_INTERNAL_IVISUALELEMENT_CAPTUREPROVIDER_H_
+#define _FUI_ANIM_INTERNAL_IVISUALELEMENT_CAPTUREPROVIDER_H_
+
+namespace Tizen { namespace Graphics {
+class BufferInfo;
+}}
+namespace Tizen { namespace Ui { namespace Animations
+{
+
+class _IVisualElementCaptureProvider
+{
+public:
+       virtual bool OnCaptureAcquire(Tizen::Graphics::BufferInfo& output) = 0;
+       virtual void OnCaptureRleased(void) = 0;
+
+       virtual ~_IVisualElementCaptureProvider(void){};
+};
+
+}}}            // Tizen::Ui::Animations
+
+#endif // _FUI_ANIM_INTERNAL_INATIVENODE_H_
index f995bbe..9cd7fea 100644 (file)
@@ -37,7 +37,6 @@
 #include <FUiAnimVisualElementSurface.h>
 #include <FUiAnimVisualElement.h>
 
-
 #include "FUi_PropertyBase.h"
 
 #include "FUiAnim_RootVisualElement.h"
@@ -67,12 +66,11 @@ class _WebImpl;
 namespace Tizen { namespace Ui { namespace Animations
 {
 
-class _IVisualElementObserver;
 class IVisualElementAnimationProvider;
 class IVisualElementContentProvider;
 class IVisualElementEventListener;
 class _AnimationManager;
-
+class _IVisualElementCaptureProvider;
 
 extern const wchar_t* VePropBounds;
 extern const wchar_t* VePropContentBounds;
@@ -791,6 +789,9 @@ public:
        typedef void (*DestroyedCallback)(void*);
        void SetDestroyedCallback(DestroyedCallback pCallback, void* pData);
 
+       void SetCaptureProvider(_IVisualElementCaptureProvider* pProvider);
+       _IVisualElementCaptureProvider* GetCaptureProvider(void) const;
+
 protected:
 //     virtual _VisualElementImpl* CloneN(void);
 
@@ -1361,6 +1362,8 @@ private:
        DestroyedCallback       __pDestroyedCallback;
        void* __pDestroyedCallbackData;
 
+       _IVisualElementCaptureProvider* __pCaptureProvider;
+
        friend class _VeDebug;
        friend class _EflNode;
        friend class _VisualElementModelObserver;