Revert "Change fitting mode to match previous behaviour." 24/172224/1
authorhuiyu.eun <huiyu.eun@samsung.com>
Tue, 13 Mar 2018 01:49:16 +0000 (10:49 +0900)
committerhuiyu.eun <huiyu.eun@samsung.com>
Tue, 13 Mar 2018 02:07:17 +0000 (11:07 +0900)
This reverts commit f22c4ec4fc3e7ae6e746d747fc9f49736565840d.

Change-Id: I6ea68318d8ea8ddc9e8be77d46029dbc5daf22e5

examples/animated-gradient-card-active/animated-gradient-card-active.cpp
examples/blocks/blocks-example.cpp
examples/clipping/clipping-item-factory.cpp
examples/image-view-alpha-blending/image-view-alpha-blending-example.cpp
examples/item-view/item-view-example.cpp
examples/perf-scroll/perf-scroll.cpp

index 3414361..2c436bb 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2018 Samsung Electronics Co., Ltd.
+* Copyright (c) 2017 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.
@@ -141,16 +141,8 @@ public:
 
       mImageUrl[k] = CARD_IMAGE_LIST[k];
 
-      // Create an image view for this item
       mCard[k] = ImageView::New();
-      {
-        Property::Map propertyMap;
-        propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE);
-        propertyMap.Insert(ImageVisual::Property::URL, mImageUrl[k]);
-        propertyMap.Insert(DevelVisual::Property::VISUAL_FITTING_MODE, DevelVisual::FILL);
-        mCard[k].SetProperty(Toolkit::ImageView::Property::IMAGE, propertyMap);
-      }
-
+      mCard[k].SetImage( mImageUrl[k] );
       mCard[k].SetParentOrigin( ParentOrigin::CENTER );
       mCard[k].SetAnchorPoint( AnchorPoint::CENTER );
       mCard[k].SetSize( mSize.x, mSize.y );
index 7cadbe2..dc3b208 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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,7 +23,6 @@
 
 #include <dali/dali.h>
 #include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
 #include "shared/view.h"
 
 using namespace Dali;
@@ -587,12 +586,7 @@ private:
    */
   ImageView CreateImage(const std::string& filename)
   {
-    Property::Map propertyMap;
-    propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE);
-    propertyMap.Insert(ImageVisual::Property::URL, filename);
-    propertyMap.Insert(DevelVisual::Property::VISUAL_FITTING_MODE, DevelVisual::FILL);
-    ImageView actor = ImageView::New();
-    actor.SetProperty(Toolkit::ImageView::Property::IMAGE, propertyMap);
+    ImageView actor = ImageView::New(filename);
     actor.SetParentOrigin(ParentOrigin::TOP_LEFT);
     actor.SetAnchorPoint(AnchorPoint::CENTER);
     return actor;
index 9d3b886..f6cf377 100644 (file)
@@ -107,7 +107,7 @@ Actor ClippingItemFactory::NewItem( unsigned int itemId )
   Property::Map propertyMap;
   propertyMap.Insert(Visual::Property::TYPE,  Visual::IMAGE);
   propertyMap.Insert(ImageVisual::Property::URL, IMAGE_PATHS[ itemId % NUM_IMAGES ] );
-  propertyMap.Insert(DevelVisual::Property::VISUAL_FITTING_MODE, DevelVisual::FILL);
+  propertyMap.Insert(DevelVisual::Property::FITTING_MODE, DevelVisual::FILL);
   ImageView actor = ImageView::New();
   actor.SetProperty(Toolkit::ImageView::Property::IMAGE, propertyMap);
 
index bf6067c..011e7c6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -16,8 +16,6 @@
  */
 
 #include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/image-loader/texture-manager.h>
-#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
 
 using namespace Dali;
 
@@ -50,28 +48,28 @@ private:
     Stage stage = Stage::GetCurrent();
     stage.KeyEventSignal().Connect(this, &ImageViewAlphaBlendApp::OnKeyEvent);
 
-    auto green0 = Vector4( 0.f, 1.f, 0.f, 0.25f );
-    auto green1 = Vector4( 0.f, 0.25f, 0.f, 0.25f );
-    auto redGreen0 = CreateTexture( Color::RED, green0 );
-    auto redGreen1 = CreateTexture( Color::RED, green1 );
+    Vector4 green0 = Vector4( 0.f, 1.f, 0.f, 0.25f );
+    Vector4 green1 = Vector4( 0.f, 0.25f, 0.f, 0.25f );
+    BufferImage redGreen0 = CreateBufferImage( Color::RED, green0 );
+    BufferImage redGreen1 = CreateBufferImage( Color::RED, green1 );
     float imageSize = 512.f;
 
-    Toolkit::ImageView imageView0 = CreateImageView( IMAGE_PATH );
+    Toolkit::ImageView imageView0 = Toolkit::ImageView::New( IMAGE_PATH );
     imageView0.SetSize(imageSize, imageSize);
     imageView0.SetParentOrigin( ParentOrigin::CENTER );
     imageView0.SetY( -imageSize*0.5f );
     stage.Add(imageView0);
-    Toolkit::ImageView imageView1 = CreateImageView( redGreen0 );
+    Toolkit::ImageView imageView1 = Toolkit::ImageView::New( redGreen0 );
     imageView1.SetParentOrigin( ParentOrigin::CENTER );
     imageView1.SetSize(imageSize, imageSize);
     imageView0.Add(imageView1);
 
-    Toolkit::ImageView imageView2 = CreateImageView( IMAGE_PATH );
+    Toolkit::ImageView imageView2 = Toolkit::ImageView::New( IMAGE_PATH );
     imageView2.SetSize(imageSize, imageSize);
     imageView2.SetParentOrigin( ParentOrigin::CENTER );
     imageView2.SetY( imageSize*0.5f );
     stage.Add(imageView2);
-    Toolkit::ImageView imageView3 = CreateImageView( redGreen1);
+    Toolkit::ImageView imageView3 = Toolkit::ImageView::New( redGreen1);
     imageView3.SetParentOrigin( ParentOrigin::CENTER );
     imageView3.SetSize(imageSize, imageSize);
     imageView2.Add(imageView3);
@@ -97,41 +95,22 @@ private:
     }
   }
 
-  std::string CreateTexture( const Vector4& color1, const Vector4& color2 )
+  BufferImage CreateBufferImage( const Vector4& color1, const Vector4& color2 )
   {
-    const auto width = 2u;
-    const auto height = 1u;
-    auto size = width * height * 4;
-    auto pixelBuffer = new unsigned char[size];
-    pixelBuffer[0] = 0xFF * color1.x;
-    pixelBuffer[1] = 0xFF * color1.y;
-    pixelBuffer[2] = 0xFF * color1.z;
-    pixelBuffer[3] = 0xFF * color1.w;
-    pixelBuffer[4] = 0xFF * color2.x;
-    pixelBuffer[5] = 0xFF * color2.y;
-    pixelBuffer[6] = 0xFF * color2.z;
-    pixelBuffer[7] = 0xFF * color2.w;
-
-    auto pixelData = PixelData::New(pixelBuffer, size, width, height, Pixel::RGBA8888, PixelData::ReleaseFunction::DELETE_ARRAY);
-    auto texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
-    texture.Upload(pixelData);
-
-    return Toolkit::TextureManager::AddTexture(texture);
+    BufferImage image = BufferImage::New( 2, 1, Pixel::RGBA8888 );
+    PixelBuffer* pixelBuffer = image.GetBuffer();
+    pixelBuffer[0]=0xFF * color1.x;
+    pixelBuffer[1]=0xFF * color1.y;
+    pixelBuffer[2]=0xFF * color1.z;
+    pixelBuffer[3]=0xFF * color1.w;
+    pixelBuffer[4]=0xFF * color2.x;
+    pixelBuffer[5]=0xFF * color2.y;
+    pixelBuffer[6]=0xFF * color2.z;
+    pixelBuffer[7]=0xFF * color2.w;
+    image.Update();
+    return image;
   }
 
-  template<typename TextT>
-  Toolkit::ImageView CreateImageView(TextT&& filename)
-  {
-    auto imageView = Toolkit::ImageView::New();
-
-    Property::Map propertyMap;
-    propertyMap.Insert(Toolkit::ImageVisual::Property::URL, std::forward<TextT>(filename));
-    propertyMap.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
-    propertyMap.Insert(Toolkit::DevelVisual::Property::VISUAL_FITTING_MODE, Toolkit::DevelVisual::FILL);
-    imageView.SetProperty(Toolkit::ImageView::Property::IMAGE, propertyMap );
-
-    return imageView;
-  }
 
 private:
   Application&  mApplication;
index 6172a73..61dce2d 100644 (file)
@@ -870,7 +870,7 @@ public: // From ItemFactory
     Property::Map propertyMap;
     propertyMap.Insert(Toolkit::Visual::Property::TYPE,  Visual::IMAGE);
     propertyMap.Insert(ImageVisual::Property::URL, IMAGE_PATHS[ itemId % NUM_IMAGES ] );
-    propertyMap.Insert(DevelVisual::Property::VISUAL_FITTING_MODE, DevelVisual::FILL);
+    propertyMap.Insert(DevelVisual::Property::FITTING_MODE, DevelVisual::FILL);
     ImageView actor = ImageView::New();
     actor.SetProperty( Toolkit::ImageView::Property::IMAGE, propertyMap );
     actor.SetZ( 0.0f );
index beedecf..6740eee 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -16,7 +16,7 @@
  */
 
 #include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+
 #include "shared/utility.h"
 
 using namespace Dali;
@@ -278,13 +278,7 @@ public:
 
     for( size_t i(0); i<actorCount; ++i )
     {
-      mImageView[i] = ImageView::New();
-      Property::Map propertyMap;
-      propertyMap.Insert(Toolkit::ImageVisual::Property::URL, ImagePath(i));
-      propertyMap.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
-      propertyMap.Insert(Toolkit::DevelVisual::Property::VISUAL_FITTING_MODE, Toolkit::DevelVisual::FILL);
-      mImageView[i].SetProperty(Toolkit::ImageView::Property::IMAGE, propertyMap);
-
+      mImageView[i] = ImageView::New( ImagePath(i) );
       mImageView[i].SetSize( Vector3(0.0f,0.0f,0.0f) );
       mImageView[i].SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
       mParent.Add( mImageView[i] );