X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fpage-turn-view%2Fpage-turn-view-impl.cpp;h=0ee82e9d07750ace0826b532db2c752cd9c50c2b;hb=410125f32fcd135226a2a0a668b2855ea9e17a69;hp=f6d5e7a1da2fbea18118ea3e1bfcbd60422629e0;hpb=a3ab994876ea86236784101dd85370815c336e8b;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp b/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp index f6d5e7a..0ee82e9 100644 --- a/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp +++ b/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 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. @@ -22,10 +22,8 @@ #include // for strcmp #include #include -#include #include #include -#include #include // INTERNAL INCLUDES @@ -39,9 +37,6 @@ using namespace Dali; namespace //Unnamed namespace { -// broken image is loaded if there is no valid image provided for the page -const char * const BROKEN_IMAGE_URL( DALI_IMAGE_DIR "broken.png"); - // properties set on shader, these properties have the constant value in regardless of the page status const char * const PROPERTY_SPINE_SHADOW ( "uSpineShadowParameter" ); // uniform for both spine and turn effect @@ -282,14 +277,13 @@ PageTurnView::Page::Page() propertyTurnDirection = actor.RegisterProperty(PROPERTY_TURN_DIRECTION, -1.f); } -void PageTurnView::Page::SetImage( Image image ) +void PageTurnView::Page::SetTexture( Texture texture ) { if( !textureSet ) { textureSet = TextureSet::New(); } - - TextureSetImage( textureSet, 0u, image ); + textureSet.SetTexture( 0u, texture ); } void PageTurnView::Page::UseEffect(Shader newShader) @@ -398,7 +392,7 @@ void PageTurnView::OnInitialize() Self().Add( mPages[i].actor ); } - // create the layer for turning images + // create the layer for turning pages mTurningPageLayer = Layer::New(); mTurningPageLayer.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); mTurningPageLayer.SetBehavior(Layer::LAYER_3D); @@ -479,9 +473,9 @@ void PageTurnView::SetupShadowView() void PageTurnView::OnStageConnection( int depth ) { - Control::OnStageConnection( depth ); - SetupShadowView(); + + Control::OnStageConnection( depth ); } void PageTurnView::OnStageDisconnection() @@ -584,13 +578,9 @@ void PageTurnView::AddPage( int pageIndex ) { int index = pageIndex % NUMBER_OF_CACHED_PAGES; - Image newPageImage; - newPageImage = mPageFactory->NewPage( pageIndex ); - - if( !newPageImage ) // load the broken image - { - newPageImage = ResourceImage::New( BROKEN_IMAGE_URL ); - } + Texture newPage; + newPage = mPageFactory->NewPage( pageIndex ); + DALI_ASSERT_ALWAYS( newPage && "must pass in valid texture" ); bool isLeftSide = ( pageIndex < mCurrentPageIndex ); if( mPages[index].isTurnBack != isLeftSide ) @@ -602,11 +592,11 @@ void PageTurnView::AddPage( int pageIndex ) mPages[index].actor.SetOrientation( Degree( degree ), Vector3::YAXIS ); mPages[index].actor.SetVisible( false ); mPages[index].UseEffect( mSpineEffectShader, mGeometry ); - mPages[index].SetImage( newPageImage ); + mPages[index].SetTexture( newPage ); // For Portrait, nothing to do // For Landscape, set the parent origin to CENTER - OnAddPage( mPages[index].actor, isLeftSide ); + OnAddPage( mPages[index].actor, isLeftSide ); } }