svgtopt/SVG/SVGImpl/src/SVGTransformableImpl.cpp
author hgs
Wed, 03 Nov 2010 18:56:10 +0200
changeset 46 88edb906c587
permissions -rw-r--r--
201044
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description:  SVG Implementation source file
hgs
parents:
diff changeset
    15
 *
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
hgs
parents:
diff changeset
    19
#if !defined(__E32BASE_H__)
hgs
parents:
diff changeset
    20
#include <e32base.h>
hgs
parents:
diff changeset
    21
#endif
hgs
parents:
diff changeset
    22
hgs
parents:
diff changeset
    23
#include "SVGTransformableImpl.h"
hgs
parents:
diff changeset
    24
hgs
parents:
diff changeset
    25
hgs
parents:
diff changeset
    26
// ==========================================================================
hgs
parents:
diff changeset
    27
// Need method description
hgs
parents:
diff changeset
    28
// ==========================================================================
hgs
parents:
diff changeset
    29
CSvgTransformableImpl* CSvgTransformableImpl::NewL()
hgs
parents:
diff changeset
    30
    {
hgs
parents:
diff changeset
    31
    CSvgTransformableImpl* self = new ( ELeave ) CSvgTransformableImpl();
hgs
parents:
diff changeset
    32
    CleanupStack::PushL( self );
hgs
parents:
diff changeset
    33
    self->ConstructL();
hgs
parents:
diff changeset
    34
    CleanupStack::Pop();
hgs
parents:
diff changeset
    35
hgs
parents:
diff changeset
    36
    return self;
hgs
parents:
diff changeset
    37
    }
hgs
parents:
diff changeset
    38
hgs
parents:
diff changeset
    39
// ==========================================================================
hgs
parents:
diff changeset
    40
// Need method description
hgs
parents:
diff changeset
    41
// ==========================================================================
hgs
parents:
diff changeset
    42
CSvgTransformableImpl* CSvgTransformableImpl::NewLC()
hgs
parents:
diff changeset
    43
    {
hgs
parents:
diff changeset
    44
    CSvgTransformableImpl* self = new ( ELeave ) CSvgTransformableImpl();
hgs
parents:
diff changeset
    45
    CleanupStack::PushL( self );
hgs
parents:
diff changeset
    46
    self->ConstructL();
hgs
parents:
diff changeset
    47
hgs
parents:
diff changeset
    48
    return self;
hgs
parents:
diff changeset
    49
    }
hgs
parents:
diff changeset
    50
hgs
parents:
diff changeset
    51
// ==========================================================================
hgs
parents:
diff changeset
    52
// Need method description
hgs
parents:
diff changeset
    53
// ==========================================================================
hgs
parents:
diff changeset
    54
CSvgTransformableImpl::~CSvgTransformableImpl()
hgs
parents:
diff changeset
    55
    {
hgs
parents:
diff changeset
    56
	if ( iTransform )
hgs
parents:
diff changeset
    57
		{
hgs
parents:
diff changeset
    58
		delete iTransform;
hgs
parents:
diff changeset
    59
		iTransform = NULL;
hgs
parents:
diff changeset
    60
		}
hgs
parents:
diff changeset
    61
    }
hgs
parents:
diff changeset
    62
hgs
parents:
diff changeset
    63
// From MSvgTransformable
hgs
parents:
diff changeset
    64
hgs
parents:
diff changeset
    65
// ==========================================================================
hgs
parents:
diff changeset
    66
// Need method description
hgs
parents:
diff changeset
    67
// ==========================================================================
hgs
parents:
diff changeset
    68
void CSvgTransformableImpl::GetTransform( MSvgTransformList*& aTransformList )
hgs
parents:
diff changeset
    69
    {
hgs
parents:
diff changeset
    70
    aTransformList = ( MSvgTransformList * ) iTransform;
hgs
parents:
diff changeset
    71
    }
hgs
parents:
diff changeset
    72
hgs
parents:
diff changeset
    73
// ==========================================================================
hgs
parents:
diff changeset
    74
// Need method description
hgs
parents:
diff changeset
    75
// ==========================================================================
hgs
parents:
diff changeset
    76
void CSvgTransformableImpl::SetTransform( MSvgTransformList*& aTransformList )
hgs
parents:
diff changeset
    77
    {
hgs
parents:
diff changeset
    78
    iTransform = ( CSvgTransformListImpl * ) aTransformList;
hgs
parents:
diff changeset
    79
	iTransform->SetAvoidConsolidation(EFalse);
hgs
parents:
diff changeset
    80
    }
hgs
parents:
diff changeset
    81
hgs
parents:
diff changeset
    82
// From MSvgLocatable
hgs
parents:
diff changeset
    83
hgs
parents:
diff changeset
    84
// ==========================================================================
hgs
parents:
diff changeset
    85
// Need method description
hgs
parents:
diff changeset
    86
// ==========================================================================
hgs
parents:
diff changeset
    87
const TGfxAffineTransform& CSvgTransformableImpl::GetCTM()
hgs
parents:
diff changeset
    88
    {
hgs
parents:
diff changeset
    89
    return iCTM;
hgs
parents:
diff changeset
    90
    }
hgs
parents:
diff changeset
    91
hgs
parents:
diff changeset
    92
// ==========================================================================
hgs
parents:
diff changeset
    93
// Need method description
hgs
parents:
diff changeset
    94
// ==========================================================================
hgs
parents:
diff changeset
    95
void CSvgTransformableImpl::SetCTM( TGfxAffineTransform& aTr )
hgs
parents:
diff changeset
    96
    {
hgs
parents:
diff changeset
    97
    iCTM = aTr;
hgs
parents:
diff changeset
    98
    }
hgs
parents:
diff changeset
    99
hgs
parents:
diff changeset
   100
// Private
hgs
parents:
diff changeset
   101
hgs
parents:
diff changeset
   102
// ==========================================================================
hgs
parents:
diff changeset
   103
// Need method description
hgs
parents:
diff changeset
   104
// ==========================================================================
hgs
parents:
diff changeset
   105
void CSvgTransformableImpl::ConstructL()
hgs
parents:
diff changeset
   106
    {
hgs
parents:
diff changeset
   107
    iTransform = CSvgTransformListImpl::NewL();
hgs
parents:
diff changeset
   108
    }
hgs
parents:
diff changeset
   109
hgs
parents:
diff changeset
   110
// ==========================================================================
hgs
parents:
diff changeset
   111
// Need method description
hgs
parents:
diff changeset
   112
// ==========================================================================
hgs
parents:
diff changeset
   113
CSvgTransformableImpl::CSvgTransformableImpl()
hgs
parents:
diff changeset
   114
    {
hgs
parents:
diff changeset
   115
    }
hgs
parents:
diff changeset
   116
hgs
parents:
diff changeset
   117
// ==========================================================================
hgs
parents:
diff changeset
   118
// perform a deep clone of this object
hgs
parents:
diff changeset
   119
// ==========================================================================
hgs
parents:
diff changeset
   120
CSvgTransformableImpl* CSvgTransformableImpl::CloneL()
hgs
parents:
diff changeset
   121
    {
hgs
parents:
diff changeset
   122
    CSvgTransformableImpl* newObject = CSvgTransformableImpl::NewL();
hgs
parents:
diff changeset
   123
    CleanupStack::PushL(newObject);
hgs
parents:
diff changeset
   124
hgs
parents:
diff changeset
   125
    // copy iTransform
hgs
parents:
diff changeset
   126
    if (newObject->iTransform != NULL)
hgs
parents:
diff changeset
   127
        {
hgs
parents:
diff changeset
   128
        delete newObject->iTransform;
hgs
parents:
diff changeset
   129
        newObject->iTransform= NULL;
hgs
parents:
diff changeset
   130
        }
hgs
parents:
diff changeset
   131
    newObject->iTransform = this->iTransform->CloneL();
hgs
parents:
diff changeset
   132
hgs
parents:
diff changeset
   133
    // copy iCTM
hgs
parents:
diff changeset
   134
    newObject->iCTM = this->iCTM;
hgs
parents:
diff changeset
   135
    CleanupStack::Pop();
hgs
parents:
diff changeset
   136
hgs
parents:
diff changeset
   137
    return newObject;
hgs
parents:
diff changeset
   138
    }
hgs
parents:
diff changeset
   139
hgs
parents:
diff changeset
   140
hgs
parents:
diff changeset
   141
void  CSvgTransformableImpl::SetTransformList(TGfxAffineTransform& aTr)
hgs
parents:
diff changeset
   142
	{
hgs
parents:
diff changeset
   143
	iTransform->ReplaceItem(aTr, 0);
hgs
parents:
diff changeset
   144
	iTransform->SetAvoidConsolidation(EFalse);
hgs
parents:
diff changeset
   145
	}
hgs
parents:
diff changeset
   146