photosgallery/slideshow/engine/effectsrc/shwcrossfadelayout.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 15 Mar 2010 12:40:30 +0200
branchRCL_3
changeset 12 ce1c7ad1f18b
parent 0 4e91876724a2
child 13 bcb43dc84c44
permissions -rw-r--r--
Revision: 201009 Kit: 201010

/*
* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:    Layout that performs crossfade
 *
*/




//  Include Files
#include "shwcrossfadelayout.h"

#include <glxlog.h>
#include <glxtracer.h>

#include "shwconstants.h"

using namespace NShwSlideshow;

// -----------------------------------------------------------------------------
// Constructor
// -----------------------------------------------------------------------------
TShwCrossFadeLayout::TShwCrossFadeLayout()
	{
	TRACER("TShwCrossFadeLayout::TShwCrossFadeLayout");
	GLX_LOG_INFO("TShwCrossFadeLayout::TShwCrossFadeLayout");
	__DEBUG_ONLY( _iName = _L("TShwCrossfadeLayout") );
	// default values
	// style is linear
	iOpacity.SetStyle( EAlfTimedValueStyleLinear );
	}

// -----------------------------------------------------------------------------
// Destructor
// -----------------------------------------------------------------------------
TShwCrossFadeLayout::~TShwCrossFadeLayout()
	{
	TRACER("TShwCrossFadeLayout::~TShwCrossFadeLayout");
	GLX_LOG_INFO("TShwCrossFadeLayout::~TShwCrossFadeLayout");
	// Do nothing
	}

// -----------------------------------------------------------------------------
// Set
// -----------------------------------------------------------------------------
void TShwCrossFadeLayout::Set( TReal32 aOpacity, TInt aDuration )
	{
	TRACER("TShwCrossFadeLayout::Set");
	GLX_LOG_INFO("TShwCrossFadeLayout::Set");
	iOpacity.Set( aOpacity, aDuration );
	}

// -----------------------------------------------------------------------------
// Pause
// -----------------------------------------------------------------------------
void TShwCrossFadeLayout::Pause()
	{
	TRACER("TShwCrossFadeLayout::Pause");
	GLX_LOG_INFO("TShwCrossFadeLayout::Pause");
	iOpacity.Pause();
	}

// -----------------------------------------------------------------------------
// Resume
// -----------------------------------------------------------------------------
void TShwCrossFadeLayout::Resume()
	{
	TRACER("TShwCrossFadeLayout::Resume");
	GLX_LOG_INFO("TShwCrossFadeLayout::Resume");
	iOpacity.Resume();
	}

// -----------------------------------------------------------------------------
// DoSetLayoutValues
// -----------------------------------------------------------------------------
void TShwCrossFadeLayout::DoSetLayoutValues( TGlxLayoutInfo& aInfo )
	{
	TRACER("TShwCrossFadeLayout::DoSetLayoutValues");
	GLX_LOG_INFO("TShwCrossFadeLayout::DoSetLayoutValues");
	// get new opacity
	TReal32 opacity = iOpacity.Now();

	// ensure value is inside maximum and minimum opacity
    opacity = Min( opacity, KMaxOpacity );
    opacity = Max( opacity, KMinOpacity );
	}

// -----------------------------------------------------------------------------
// DoChanged
// -----------------------------------------------------------------------------
TBool TShwCrossFadeLayout::DoChanged() const
	{
	TRACER("TShwCrossFadeLayout::DoChanged");
	GLX_LOG_INFO("TShwCrossFadeLayout::DoChanged");
	return iOpacity.Changed();
	}
	
// -----------------------------------------------------------------------------
// DoClearChanged
// -----------------------------------------------------------------------------
void TShwCrossFadeLayout::DoClearChanged() 
	{
	TRACER("TShwCrossFadeLayout::DoClearChanged");
	GLX_LOG_INFO("TShwCrossFadeLayout::DoClearChanged");
	iOpacity.ClearChanged();
	}