|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Graphics Extension Library source file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "GfxRectangleIteratorP.h" |
|
20 #include "GfxRectangle2D.h" |
|
21 |
|
22 |
|
23 // --------------------------------------------------------------------------- |
|
24 // Constructor |
|
25 // --------------------------------------------------------------------------- |
|
26 // -------------------------------------------------------------------------- |
|
27 // CGfxRectangleIteratorP::CGfxRectangleIteratorP( TGfxRectangularShape* aRect, |
|
28 // --------------------------------------------------------------------------- |
|
29 CGfxRectangleIteratorP::CGfxRectangleIteratorP( TGfxRectangularShape* aRect, |
|
30 TGfxAffineTransform* aTransform ) |
|
31 { |
|
32 TFloatFixPt KZero; |
|
33 if ( aRect->iWidth < KZero ) |
|
34 aRect->iWidth = KZero; |
|
35 |
|
36 if ( aRect->iHeight < KZero ) |
|
37 aRect->iHeight = KZero; |
|
38 |
|
39 iRect = aRect; |
|
40 iTransform = aTransform; |
|
41 } |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // destructor |
|
45 // --------------------------------------------------------------------------- |
|
46 // -------------------------------------------------------------------------- |
|
47 // CGfxRectangleIteratorP::~CGfxRectangleIteratorP( ) |
|
48 // --------------------------------------------------------------------------- |
|
49 CGfxRectangleIteratorP::~CGfxRectangleIteratorP( ) |
|
50 { |
|
51 } |
|
52 |
|
53 // -------------------------------------------------------------------------- |
|
54 // TGfxSegType CGfxRectangleIteratorP::CurrentSegment( TFloatFixPt* aCoords ) |
|
55 // --------------------------------------------------------------------------- |
|
56 TGfxSegType CGfxRectangleIteratorP::CurrentSegment( TFloatFixPt* aCoords ) |
|
57 { |
|
58 TGfxSegType segtype; |
|
59 |
|
60 switch ( iIdx ) |
|
61 { |
|
62 case 0: |
|
63 aCoords[0] = iRect->iX; |
|
64 aCoords[1] = iRect->iY; |
|
65 segtype = EGfxSegMoveTo; |
|
66 break; |
|
67 case 1: |
|
68 aCoords[0] = iRect->iX + iRect->iWidth; |
|
69 aCoords[1] = iRect->iY ; |
|
70 segtype = EGfxSegLineTo; |
|
71 break; |
|
72 case 2: |
|
73 aCoords[0] = iRect->iX + iRect->iWidth; |
|
74 aCoords[1] = iRect->iY + iRect->iHeight; |
|
75 segtype = EGfxSegLineTo; |
|
76 break; |
|
77 case 3: |
|
78 aCoords[0] = iRect->iX; |
|
79 aCoords[1] = iRect->iY + iRect->iHeight; |
|
80 segtype = EGfxSegLineTo; |
|
81 break; |
|
82 default: |
|
83 segtype = EGfxSegClose; |
|
84 } |
|
85 |
|
86 if ( !iTransform->IsIdentity() ) |
|
87 { |
|
88 iTransform->Transform( aCoords, aCoords, 1 ); |
|
89 } |
|
90 |
|
91 return segtype; |
|
92 } |
|
93 |
|
94 // -------------------------------------------------------------------------- |
|
95 // TBool CGfxRectangleIteratorP::IsDone() |
|
96 // --------------------------------------------------------------------------- |
|
97 TBool CGfxRectangleIteratorP::IsDone() |
|
98 { |
|
99 return ( iIdx > 4 ); |
|
100 } |
|
101 |
|
102 // -------------------------------------------------------------------------- |
|
103 // void CGfxRectangleIteratorP::Next() |
|
104 // --------------------------------------------------------------------------- |
|
105 void CGfxRectangleIteratorP::NextL() |
|
106 { |
|
107 iIdx++; |
|
108 } |
|
109 |
|
110 |