/*
- * 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.
#include <cstring> // for strcmp
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/animation/constraint.h>
-#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
-#include <dali/devel-api/images/texture-set-image.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
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
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)
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);
void PageTurnView::OnStageConnection( int depth )
{
- Control::OnStageConnection( depth );
-
SetupShadowView();
+
+ Control::OnStageConnection( depth );
}
void PageTurnView::OnStageDisconnection()
{
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 )
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 );
}
}