Merge "(Automated Tests) Added Video view test to increase coverage" into devel/master
authorDavid Steele <david.steele@samsung.com>
Mon, 11 Jul 2016 10:33:50 +0000 (03:33 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Mon, 11 Jul 2016 10:33:50 +0000 (03:33 -0700)
dali-toolkit/internal/controls/renderers/gradient/gradient-renderer.cpp
dali-toolkit/internal/controls/renderers/gradient/gradient.cpp
dali-toolkit/internal/controls/renderers/gradient/gradient.h
dali-toolkit/internal/text/decorator/text-decorator.cpp

index 637dd6b..f64ad61 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
@@ -326,8 +326,8 @@ void GradientRenderer::InitializeRenderer()
 
   //Set up the texture set
   TextureSet textureSet = TextureSet::New();
-  Dali::BufferImage lookupTexture = mGradient->GenerateLookupTexture();
-  textureSet.SetImage( 0u, lookupTexture );
+  Dali::Texture lookupTexture = mGradient->GenerateLookupTexture();
+  textureSet.SetTexture( 0u, lookupTexture );
   Dali::WrapMode::Type wrap = GetWrapMode( mGradient->GetSpreadMethod() );
   Sampler sampler = Sampler::New();
   sampler.SetWrapMode(  wrap, wrap  );
index d87d132..e070754 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
@@ -88,7 +88,7 @@ const Matrix3& Gradient::GetAlignmentTransform() const
  *  If the stops have not covered the whole zero to one range,
  *  the REPEAT spread behaves different from the two others in the lookup texture generation.
  */
-BufferImage Gradient::GenerateLookupTexture()
+Dali::Texture Gradient::GenerateLookupTexture()
 {
   std::sort( mGradientStops.Begin(), mGradientStops.End() );
 
@@ -133,8 +133,11 @@ BufferImage Gradient::GenerateLookupTexture()
    * Generate the pixels with the color transit from one stop to next.
    */
   unsigned int resolution = EstimateTextureResolution();
-  BufferImage texture = BufferImage::New( resolution, 1 );
-  PixelBuffer* pixels = texture.GetBuffer();
+
+  unsigned int bufferSize = resolution * 4u;
+  unsigned char* pixels = new unsigned char[ bufferSize ];
+  PixelData pixelData = PixelData::New( pixels, bufferSize, resolution, 1u, Pixel::RGBA8888, PixelData::DELETE_ARRAY );
+
   int segmentStart = 0;
   int segmentEnd = 0;
   int k = 0;
@@ -161,6 +164,9 @@ BufferImage Gradient::GenerateLookupTexture()
     segmentStart = segmentEnd;
   }
 
+  Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, resolution, 1u );
+  texture.Upload( pixelData );
+
   // remove the stops added temporarily for generating the pixels, as the spread method might get changed later
   if( tempLastStop )
   {
index 36e6ee4..64fd6b5 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_TOOLKIT_INTERNAL_GRADIENT_H__
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
@@ -23,6 +23,7 @@
 #include <dali/public-api/object/ref-object.h>
 #include <dali/public-api/common/dali-vector.h>
 #include <dali/public-api/images/buffer-image.h>
+#include <dali/devel-api/rendering/texture.h>
 
 namespace Dali
 {
@@ -130,9 +131,9 @@ public:
 
   /**
    * Generate the lookup texture with the gradient stops.
-   * @return the lookup texture which transit smoothly between stops.
+   * @return The lookup texture which transit smoothly between stops.
    */
-  BufferImage GenerateLookupTexture();
+  Dali::Texture GenerateLookupTexture();
 
 private:
 
index 74fc924..cc76691 100644 (file)
@@ -623,11 +623,18 @@ struct Decorator::Impl : public ConnectionTracker
 
   void SetupGestures()
   {
+    // Will consume tap gestures on handles.
     mTapDetector = TapGestureDetector::New();
-    mTapDetector.DetectedSignal().Connect( this, &Decorator::Impl::OnTap );
 
-    mPanGestureDetector = PanGestureDetector::New();
-    mPanGestureDetector.DetectedSignal().Connect( this, &Decorator::Impl::OnPan );
+    // Will consume double tap gestures on handles.
+    mTapDetector.SetMaximumTapsRequired( 2u );
+
+    // Will consume long press gestures on handles.
+    mLongPressDetector = LongPressGestureDetector::New();
+
+    // Detects pan gestures on handles.
+    mPanDetector = PanGestureDetector::New();
+    mPanDetector.DetectedSignal().Connect( this, &Decorator::Impl::OnPan );
   }
 
   void CreateActiveLayer()
@@ -695,8 +702,15 @@ struct Decorator::Impl : public ConnectionTracker
         grabHandle.actor.SetColor( mHandleColor );
 
         grabHandle.grabArea.TouchSignal().Connect( this, &Decorator::Impl::OnGrabHandleTouched );
-        mTapDetector.Attach( grabHandle.grabArea );
-        mPanGestureDetector.Attach( grabHandle.grabArea );
+
+        // The grab handle's actor is attached to the tap and long press detectors in order to consume these events.
+        // Note that no callbacks are connected to any signal emitted by the tap and long press detectors.
+        mTapDetector.Attach( grabHandle.actor );
+        mLongPressDetector.Attach( grabHandle.actor );
+
+        // The grab handle's area is attached to the pan detector.
+        // The OnPan() method is connected to the signals emitted by the pan detector.
+        mPanDetector.Attach( grabHandle.grabArea );
 
         mActiveLayer.Add( grabHandle.actor );
       }
@@ -755,10 +769,17 @@ struct Decorator::Impl : public ConnectionTracker
         primary.grabArea.SetAnchorPoint( AnchorPoint::TOP_CENTER );
         primary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE );
 
-        mTapDetector.Attach( primary.grabArea );
-        mPanGestureDetector.Attach( primary.grabArea );
         primary.grabArea.TouchSignal().Connect( this, &Decorator::Impl::OnHandleOneTouched );
 
+        // The handle's actor is attached to the tap and long press detectors in order to consume these events.
+        // Note that no callbacks are connected to any signal emitted by the tap and long press detectors.
+        mTapDetector.Attach( primary.actor );
+        mLongPressDetector.Attach( primary.actor );
+
+        // The handle's area is attached to the pan detector.
+        // The OnPan() method is connected to the signals emitted by the pan detector.
+        mPanDetector.Attach( primary.grabArea );
+
         primary.actor.Add( primary.grabArea );
 
         CreateHandleMarker( primary, mHandleImages[LEFT_SELECTION_HANDLE_MARKER][HANDLE_IMAGE_RELEASED], LEFT_SELECTION_HANDLE );
@@ -792,10 +813,17 @@ struct Decorator::Impl : public ConnectionTracker
         secondary.grabArea.SetAnchorPoint( AnchorPoint::TOP_CENTER );
         secondary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE );
 
-        mTapDetector.Attach( secondary.grabArea );
-        mPanGestureDetector.Attach( secondary.grabArea );
         secondary.grabArea.TouchSignal().Connect( this, &Decorator::Impl::OnHandleTwoTouched );
 
+        // The handle's actor is attached to the tap and long press detectors in order to consume these events.
+        // Note that no callbacks are connected to any signal emitted by the tap and long press detectors.
+        mTapDetector.Attach( secondary.actor );
+        mLongPressDetector.Attach( secondary.actor );
+
+        // The handle's area is attached to the pan detector.
+        // The OnPan() method is connected to the signals emitted by the pan detector.
+        mPanDetector.Attach( secondary.grabArea );
+
         secondary.actor.Add( secondary.grabArea );
 
         CreateHandleMarker( secondary, mHandleImages[RIGHT_SELECTION_HANDLE_MARKER][HANDLE_IMAGE_RELEASED], RIGHT_SELECTION_HANDLE  );
@@ -1085,14 +1113,6 @@ struct Decorator::Impl : public ConnectionTracker
     }
   }
 
-  void OnTap( Actor actor, const TapGesture& tap )
-  {
-    if( actor == mHandle[GRAB_HANDLE].actor )
-    {
-      // TODO
-    }
-  }
-
   void DoPan( HandleImpl& handle, HandleType type, const PanGesture& gesture )
   {
     if( Gesture::Started == gesture.state )
@@ -1637,8 +1657,10 @@ struct Decorator::Impl : public ConnectionTracker
 
   ControllerInterface& mController;
 
-  TapGestureDetector  mTapDetector;
-  PanGestureDetector  mPanGestureDetector;
+  TapGestureDetector       mTapDetector;
+  PanGestureDetector       mPanDetector;
+  LongPressGestureDetector mLongPressDetector;
+
   Timer               mCursorBlinkTimer;          ///< Timer to signal cursor to blink
   Timer               mScrollTimer;               ///< Timer used to scroll the text when the grab handle is moved close to the edges.