46
|
1 |
/*
|
|
2 |
* Copyright (c) 2003 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: SVG Implementation source file
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "SVGMemoryManager.h"
|
|
20 |
#include "SVGPaintCssValueImpl.h"
|
|
21 |
#include "SVGFloatCssValueImpl.h"
|
|
22 |
#include "SVGIntCssValueImpl.h"
|
|
23 |
#include "SVGStrCssValueImpl.h"
|
|
24 |
#include "SVGVectorCssValueImpl.h"
|
|
25 |
#include "SVGClrCssValueImpl.h"
|
|
26 |
#include "SVGDocumentImpl.h"
|
|
27 |
|
|
28 |
class CSvgElementImpl;
|
|
29 |
|
|
30 |
const TUint CSvgMemoryManager::KCssPaintBlockSize = 20;
|
|
31 |
const TUint CSvgMemoryManager::KCssFloatBlockSize = 20;
|
|
32 |
const TUint CSvgMemoryManager::KCssIntBlockSize = 20;
|
|
33 |
const TUint CSvgMemoryManager::KCssClrBlockSize = 20;
|
|
34 |
const TUint CSvgMemoryManager::KCssStrBlockSize = 20;
|
|
35 |
const TUint CSvgMemoryManager::KCssVectorBlockSize = 4;
|
|
36 |
|
|
37 |
// ==========================================================================
|
|
38 |
// Need method description
|
|
39 |
// ==========================================================================
|
|
40 |
CSvgMemoryManager* CSvgMemoryManager::NewL()
|
|
41 |
{
|
|
42 |
CSvgMemoryManager* self = new ( ELeave ) CSvgMemoryManager;
|
|
43 |
CleanupStack::PushL( self );
|
|
44 |
self->ConstructL();
|
|
45 |
CleanupStack::Pop();
|
|
46 |
|
|
47 |
return self;
|
|
48 |
}
|
|
49 |
|
|
50 |
// ==========================================================================
|
|
51 |
// Need method description
|
|
52 |
// ==========================================================================
|
|
53 |
CSvgMemoryManager* CSvgMemoryManager::NewLC()
|
|
54 |
{
|
|
55 |
CSvgMemoryManager* self = new ( ELeave ) CSvgMemoryManager;
|
|
56 |
CleanupStack::PushL( self );
|
|
57 |
self->ConstructL();
|
|
58 |
|
|
59 |
return self;
|
|
60 |
}
|
|
61 |
|
|
62 |
// ==========================================================================
|
|
63 |
// Need method description
|
|
64 |
// ==========================================================================
|
|
65 |
void CSvgMemoryManager::ConstructL()
|
|
66 |
{
|
|
67 |
}
|
|
68 |
|
|
69 |
// ==========================================================================
|
|
70 |
// Need method description
|
|
71 |
// ==========================================================================
|
|
72 |
CSvgMemoryManager::CSvgMemoryManager() :
|
|
73 |
iCPaintCssValueImplArrays( 2 ),
|
|
74 |
iCFloatCssValueImplArrays( 2 ),
|
|
75 |
iCClrCssValueImplArrays( 2 ),
|
|
76 |
iCIntCssValueImplArrays( 2 ),
|
|
77 |
iCStrCssValueImplArrays( 2 ),
|
|
78 |
iCVectorCssValueImplArrays( 1 )
|
|
79 |
{
|
|
80 |
}
|
|
81 |
|
|
82 |
// ==========================================================================
|
|
83 |
// Need method description
|
|
84 |
// ==========================================================================
|
|
85 |
CSvgMemoryManager::~CSvgMemoryManager()
|
|
86 |
{
|
|
87 |
//delete all of the paint blocks
|
|
88 |
TInt cPaintCSSValueImplArraysCnt = iCPaintCssValueImplArrays.Count();
|
|
89 |
for (TInt i=0; i < cPaintCSSValueImplArraysCnt; i++)
|
|
90 |
{
|
|
91 |
delete [] iCPaintCssValueImplArrays[i];
|
|
92 |
}
|
|
93 |
iCPaintCssValueImplArrays.Close();
|
|
94 |
|
|
95 |
|
|
96 |
//delete all of the float blocks
|
|
97 |
TInt cFloatValueImplArraysCnt = iCFloatCssValueImplArrays.Count();
|
|
98 |
for (TInt i=0; i < cFloatValueImplArraysCnt; i++)
|
|
99 |
{
|
|
100 |
delete [] iCFloatCssValueImplArrays[i];
|
|
101 |
}
|
|
102 |
iCFloatCssValueImplArrays.Close();
|
|
103 |
|
|
104 |
//delete all of the clr blocks
|
|
105 |
TInt cClrCssValueImplArraysCnt = iCClrCssValueImplArrays.Count();
|
|
106 |
for (TInt i=0; i < cClrCssValueImplArraysCnt; i++)
|
|
107 |
{
|
|
108 |
delete [] iCClrCssValueImplArrays[i];
|
|
109 |
}
|
|
110 |
iCClrCssValueImplArrays.Close();
|
|
111 |
|
|
112 |
|
|
113 |
//delete all of the int blocks
|
|
114 |
TInt cIntCssValueImplArraysCnt = iCIntCssValueImplArrays.Count();
|
|
115 |
for (TInt i=0; i < cIntCssValueImplArraysCnt; i++)
|
|
116 |
{
|
|
117 |
delete [] iCIntCssValueImplArrays[i];
|
|
118 |
}
|
|
119 |
iCIntCssValueImplArrays.Close();
|
|
120 |
|
|
121 |
//delete all of the str blocks
|
|
122 |
TInt cStrCssValueImplArraysCnt = iCStrCssValueImplArrays.Count();
|
|
123 |
for (TInt i=0; i < cStrCssValueImplArraysCnt; i++)
|
|
124 |
{
|
|
125 |
delete [] iCStrCssValueImplArrays[i];
|
|
126 |
}
|
|
127 |
iCStrCssValueImplArrays.Close();
|
|
128 |
|
|
129 |
//delete all of the vector blocks
|
|
130 |
TInt cVectorCssValueImplArraysCnt = iCVectorCssValueImplArrays.Count();
|
|
131 |
for (TInt i=0; i < cVectorCssValueImplArraysCnt; i++)
|
|
132 |
{
|
|
133 |
delete [] iCVectorCssValueImplArrays[i];
|
|
134 |
}
|
|
135 |
iCVectorCssValueImplArrays.Close();
|
|
136 |
|
|
137 |
}
|
|
138 |
|
|
139 |
// ==========================================================================
|
|
140 |
// Need method description
|
|
141 |
// ==========================================================================
|
|
142 |
CCssValue* CSvgMemoryManager::CloneCssValueL(CCssValue* aCssValue )
|
|
143 |
{
|
|
144 |
CCssValue* lCssValueCloned = NULL;
|
|
145 |
|
|
146 |
//see if the value is in a paint block
|
|
147 |
TInt cPaintCssValueImplArraysCnt = iCPaintCssValueImplArrays.Count();
|
|
148 |
for (TInt i=0; i < cPaintCssValueImplArraysCnt; i++)
|
|
149 |
{
|
|
150 |
CPaintCssValueImpl* aPaintBlock = iCPaintCssValueImplArrays[i];
|
|
151 |
if ((TInt)aCssValue >= (TInt)&aPaintBlock[0] && (TInt)aCssValue <= (TInt)&aPaintBlock[KCssPaintBlockSize])
|
|
152 |
{
|
|
153 |
//aValue is a Paint clone it as such
|
|
154 |
if ( ((CPaintCssValueImpl*)aCssValue)->iUrlId )
|
|
155 |
{
|
|
156 |
lCssValueCloned = GetCssPaintObjectL(((CPaintCssValueImpl*)aCssValue)->iUrlId->Des(),
|
|
157 |
((CPaintCssValueImpl*)aCssValue)->iSvgElementImpl);
|
|
158 |
}
|
|
159 |
else
|
|
160 |
{
|
|
161 |
lCssValueCloned = GetCssPaintObjectL( ((CPaintCssValueImpl*)aCssValue)->iSvgElementImpl );
|
|
162 |
}
|
|
163 |
|
|
164 |
MGfxPaint* value = ((CPaintCssValueImpl*)aCssValue)->Value();
|
|
165 |
|
|
166 |
if (value)
|
|
167 |
{
|
|
168 |
((CPaintCssValueImpl*)lCssValueCloned)->CloneRGBValueL( value->GetColor() );
|
|
169 |
}
|
|
170 |
|
|
171 |
return lCssValueCloned;
|
|
172 |
}
|
|
173 |
}
|
|
174 |
|
|
175 |
//see if the value is in a float block
|
|
176 |
TInt cFloatCssValueImplArraysCnt = iCFloatCssValueImplArrays.Count();
|
|
177 |
for (TInt i=0; i < cFloatCssValueImplArraysCnt; i++)
|
|
178 |
{
|
|
179 |
CFloatCssValueImpl* aFloatBlock = iCFloatCssValueImplArrays[i];
|
|
180 |
if ((TInt)aCssValue >= (TInt)&aFloatBlock[0] && (TInt)aCssValue <= (TInt)&aFloatBlock[KCssFloatBlockSize])
|
|
181 |
{
|
|
182 |
//aValue is a Float clone it as such
|
|
183 |
lCssValueCloned = GetCssFloatObjectL(((CFloatCssValueImpl*)aCssValue)->Value());
|
|
184 |
return lCssValueCloned;
|
|
185 |
}
|
|
186 |
}
|
|
187 |
|
|
188 |
//see if the value is in a str block
|
|
189 |
TInt cClrCssValueImplArraysCnt = iCClrCssValueImplArrays.Count();
|
|
190 |
for (TInt i=0; i < cClrCssValueImplArraysCnt; i++)
|
|
191 |
{
|
|
192 |
CClrCssValueImpl* aClrBlock = iCClrCssValueImplArrays[i];
|
|
193 |
if ((TInt)aCssValue >= (TInt)&aClrBlock[0] && (TInt)aCssValue <= (TInt)&aClrBlock[KCssClrBlockSize])
|
|
194 |
{
|
|
195 |
//aValue is a Clr clone it as such
|
|
196 |
lCssValueCloned = GetCssClrObjectL();
|
|
197 |
((CClrCssValueImpl*)lCssValueCloned)->SetL((CClrCssValueImpl*)aCssValue);
|
|
198 |
|
|
199 |
return lCssValueCloned;
|
|
200 |
}
|
|
201 |
}
|
|
202 |
|
|
203 |
//see if the value is in an int block
|
|
204 |
TInt cIntCssValueImplArraysCnt = iCIntCssValueImplArrays.Count();
|
|
205 |
for (TInt i=0; i < cIntCssValueImplArraysCnt; i++)
|
|
206 |
{
|
|
207 |
CIntCssValueImpl* aIntBlock = iCIntCssValueImplArrays[i];
|
|
208 |
if ((TInt)aCssValue >= (TInt)&aIntBlock[0] && (TInt)aCssValue <= (TInt)&aIntBlock[KCssIntBlockSize])
|
|
209 |
{
|
|
210 |
//aValue is an Int clone it as such
|
|
211 |
lCssValueCloned = GetCssIntObjectL(((CIntCssValueImpl*)aCssValue)->Value());
|
|
212 |
return lCssValueCloned;
|
|
213 |
}
|
|
214 |
}
|
|
215 |
|
|
216 |
//see if the value is in a str block
|
|
217 |
TInt cStrCssValueImplArraysCnt = iCStrCssValueImplArrays.Count();
|
|
218 |
for (TInt i=0; i < cStrCssValueImplArraysCnt; i++)
|
|
219 |
{
|
|
220 |
CStrCssValueImpl* aStrBlock = iCStrCssValueImplArrays[i];
|
|
221 |
if ((TInt)aCssValue >= (TInt)&aStrBlock[0] && (TInt)aCssValue <= (TInt)&aStrBlock[KCssStrBlockSize])
|
|
222 |
{
|
|
223 |
//aValue is a string clone it as such
|
|
224 |
//makes a copy of the string
|
|
225 |
lCssValueCloned = GetCssStrObjectL(((CStrCssValueImpl*)aCssValue)->Value());
|
|
226 |
return lCssValueCloned;
|
|
227 |
}
|
|
228 |
}
|
|
229 |
|
|
230 |
//see if the value is in a vector block
|
|
231 |
TInt cVectorCssValueImplArraysCnt = iCVectorCssValueImplArrays.Count();
|
|
232 |
for (TInt i=0; i < cVectorCssValueImplArraysCnt; i++)
|
|
233 |
{
|
|
234 |
CVectorCssValueImpl* aVectorBlock = iCVectorCssValueImplArrays[i];
|
|
235 |
if ((TInt)aCssValue >= (TInt)&aVectorBlock[0] && (TInt)aCssValue <= (TInt)&aVectorBlock[KCssVectorBlockSize])
|
|
236 |
{
|
|
237 |
//aValue is a vector clone it as such
|
|
238 |
//makes a copy of the vector
|
|
239 |
lCssValueCloned = GetCssVectorObjectL(((CVectorCssValueImpl*)aCssValue)->Value());
|
|
240 |
return lCssValueCloned;
|
|
241 |
}
|
|
242 |
}
|
|
243 |
|
|
244 |
return NULL;
|
|
245 |
}
|
|
246 |
|
|
247 |
// ==========================================================================
|
|
248 |
// BEGIN CIntCssValue Memory Management
|
|
249 |
// ==========================================================================
|
|
250 |
// ==========================================================================
|
|
251 |
// CSvgMemoryManager::AllocateCssIntBlockL
|
|
252 |
// ==========================================================================
|
|
253 |
void CSvgMemoryManager::AllocateCssIntBlockL( )
|
|
254 |
{
|
|
255 |
//setup the new current block
|
|
256 |
iCurrentIntObjectIndex = 0;
|
|
257 |
|
|
258 |
iCIntCssValueImplArray = new ( ELeave ) CIntCssValueImpl[KCssIntBlockSize];
|
|
259 |
|
|
260 |
//put the new block into the larger tracking array.
|
|
261 |
iCIntCssValueImplArrays.AppendL(iCIntCssValueImplArray);
|
|
262 |
|
|
263 |
}
|
|
264 |
|
|
265 |
// ==========================================================================
|
|
266 |
// CSvgMemoryManager::GetCssIntObject
|
|
267 |
// MAIN allocation block
|
|
268 |
// ==========================================================================
|
|
269 |
CIntCssValueImpl* CSvgMemoryManager::GetCssIntObjectL( TInt aInitValue )
|
|
270 |
{
|
|
271 |
if ( !iCIntCssValueImplArray || iCurrentIntObjectIndex >= KCssIntBlockSize )
|
|
272 |
{
|
|
273 |
//we have used all of the objects in the current array
|
|
274 |
//and need to allocate another one
|
|
275 |
AllocateCssIntBlockL();
|
|
276 |
}
|
|
277 |
CIntCssValueImpl* lIntObject = &iCIntCssValueImplArray[iCurrentIntObjectIndex++];
|
|
278 |
lIntObject->SetValueL(aInitValue);
|
|
279 |
return ( lIntObject );
|
|
280 |
}
|
|
281 |
|
|
282 |
// ==========================================================================
|
|
283 |
// CSvgMemoryManager::GetCssIntObject
|
|
284 |
// ==========================================================================
|
|
285 |
CIntCssValueImpl* CSvgMemoryManager::GetCssIntObjectL( CIntCssValueImpl* aIntValue )
|
|
286 |
{
|
|
287 |
return GetCssIntObjectL( aIntValue->Value() );
|
|
288 |
}
|
|
289 |
|
|
290 |
// ==========================================================================
|
|
291 |
// CSvgMemoryManager::GetCssIntObject
|
|
292 |
// ==========================================================================
|
|
293 |
CIntCssValueImpl* CSvgMemoryManager::GetCssIntObjectL( const TDesC& aValueString )
|
|
294 |
{
|
|
295 |
CIntCssValueImpl* intObject = GetCssIntObjectL();
|
|
296 |
|
|
297 |
intObject->SetValueL(aValueString);
|
|
298 |
|
|
299 |
return intObject;
|
|
300 |
|
|
301 |
}
|
|
302 |
// ==========================================================================
|
|
303 |
// END OF CIntCssValue Memory Management
|
|
304 |
// ==========================================================================
|
|
305 |
|
|
306 |
// ==========================================================================
|
|
307 |
// BEGIN CPaintCssValueImpl Memory Management
|
|
308 |
// ==========================================================================
|
|
309 |
// ==========================================================================
|
|
310 |
// CSvgMemoryManager::AllocateCssPaintBlockL
|
|
311 |
// ==========================================================================
|
|
312 |
void CSvgMemoryManager::AllocateCssPaintBlockL()
|
|
313 |
{
|
|
314 |
//setup the new current block
|
|
315 |
iCurrentPaintObjectIndex = 0;
|
|
316 |
|
|
317 |
iCPaintCssValueImplArray = new ( ELeave ) CPaintCssValueImpl[KCssPaintBlockSize];
|
|
318 |
|
|
319 |
//may not need this as long as we always pass in initial values for paint
|
|
320 |
//Mem::FillZ( iCPaintCssValueImplArray, sizeof(CPaintCssValueImpl)*KCssPaintBlockSize);
|
|
321 |
|
|
322 |
//put the new block into the larger tracking array.
|
|
323 |
iCPaintCssValueImplArrays.AppendL(iCPaintCssValueImplArray);
|
|
324 |
|
|
325 |
}
|
|
326 |
|
|
327 |
// ==========================================================================
|
|
328 |
// CSvgMemoryManager::GetCssPaintObject
|
|
329 |
// ==========================================================================
|
|
330 |
CPaintCssValueImpl* CSvgMemoryManager::GetCssPaintObjectL( CSvgElementImpl* aElementImpl )
|
|
331 |
{
|
|
332 |
if ( !iCPaintCssValueImplArray || iCurrentPaintObjectIndex >= KCssPaintBlockSize )
|
|
333 |
{
|
|
334 |
//we have used all of the objects in the current array
|
|
335 |
//and need to allocate another one
|
|
336 |
AllocateCssPaintBlockL();
|
|
337 |
}
|
|
338 |
|
|
339 |
CPaintCssValueImpl* lPaintObject = &iCPaintCssValueImplArray[iCurrentPaintObjectIndex++];
|
|
340 |
lPaintObject->SetElement(aElementImpl);
|
|
341 |
return ( lPaintObject );
|
|
342 |
}
|
|
343 |
|
|
344 |
// ==========================================================================
|
|
345 |
// CSvgMemoryManager::GetCssPaintObject
|
|
346 |
// ==========================================================================
|
|
347 |
CPaintCssValueImpl* CSvgMemoryManager::GetCssPaintObjectL( const TDesC& aValue, CSvgElementImpl* aElementImpl)
|
|
348 |
{
|
|
349 |
CPaintCssValueImpl* lPaintObject = GetCssPaintObjectL(aElementImpl);
|
|
350 |
|
|
351 |
CSvgElementImpl* lReferencedElement = NULL;
|
|
352 |
// iUrlFlag is true means this paint is gradient.
|
|
353 |
|
|
354 |
CSvgDocumentImpl *lDoc = (CSvgDocumentImpl *)aElementImpl->OwnerDocument();
|
|
355 |
|
|
356 |
if (lDoc)
|
|
357 |
{
|
|
358 |
lReferencedElement = ( CSvgElementImpl*)lDoc->GetElementById( aValue );
|
|
359 |
}
|
|
360 |
|
|
361 |
if(lReferencedElement)
|
|
362 |
{
|
|
363 |
lPaintObject->SetUrlflag();
|
|
364 |
lPaintObject->SetUrlIdL(aValue);
|
|
365 |
lPaintObject->iValue = lPaintObject->Value();
|
|
366 |
}
|
|
367 |
else
|
|
368 |
{
|
|
369 |
lPaintObject->SetValueL(aValue);
|
|
370 |
}
|
|
371 |
return lPaintObject;
|
|
372 |
}
|
|
373 |
// ==========================================================================
|
|
374 |
// END OF CPaintCssValueImpl Memory Management
|
|
375 |
// ==========================================================================
|
|
376 |
|
|
377 |
// ==========================================================================
|
|
378 |
// BEGIN CFloatCssValueImpl Memory Management
|
|
379 |
// ==========================================================================
|
|
380 |
// ==========================================================================
|
|
381 |
// CSvgMemoryManager::AllocateCssFloatBlockL
|
|
382 |
// ==========================================================================
|
|
383 |
void CSvgMemoryManager::AllocateCssFloatBlockL( )
|
|
384 |
{
|
|
385 |
//setup the new current block
|
|
386 |
iCurrentFloatObjectIndex = 0;
|
|
387 |
|
|
388 |
iCFloatCssValueImplArray = new ( ELeave ) CFloatCssValueImpl[KCssFloatBlockSize];
|
|
389 |
|
|
390 |
//put the new block into the larger tracking array.
|
|
391 |
iCFloatCssValueImplArrays.AppendL(iCFloatCssValueImplArray);
|
|
392 |
|
|
393 |
}
|
|
394 |
|
|
395 |
// ==========================================================================
|
|
396 |
// CSvgMemoryManager::GetCssFloatObject
|
|
397 |
// MAIN allocation block
|
|
398 |
// ==========================================================================
|
|
399 |
CFloatCssValueImpl* CSvgMemoryManager::GetCssFloatObjectL( float aFloat )
|
|
400 |
{
|
|
401 |
if ( !iCFloatCssValueImplArray || iCurrentFloatObjectIndex >= KCssFloatBlockSize )
|
|
402 |
{
|
|
403 |
//we have used all of the objects in the current array
|
|
404 |
//and need to allocate another one
|
|
405 |
AllocateCssFloatBlockL();
|
|
406 |
}
|
|
407 |
|
|
408 |
CFloatCssValueImpl* lFloatObject = &iCFloatCssValueImplArray[iCurrentFloatObjectIndex++];
|
|
409 |
lFloatObject->SetValueL( aFloat );
|
|
410 |
return ( lFloatObject );
|
|
411 |
}
|
|
412 |
|
|
413 |
// ==========================================================================
|
|
414 |
// CSvgMemoryManager::GetCssIntObject
|
|
415 |
// ==========================================================================
|
|
416 |
CFloatCssValueImpl* CSvgMemoryManager::GetCssFloatObjectL( CFloatCssValueImpl* aFloatValue )
|
|
417 |
{
|
|
418 |
return GetCssFloatObjectL( aFloatValue->Value() );
|
|
419 |
}
|
|
420 |
|
|
421 |
// ==========================================================================
|
|
422 |
// CSvgMemoryManager::GetCssFloatObject
|
|
423 |
// ==========================================================================
|
|
424 |
CFloatCssValueImpl* CSvgMemoryManager::GetCssFloatObjectL( const TDesC& aValueString )
|
|
425 |
{
|
|
426 |
CFloatCssValueImpl* floatObject = GetCssFloatObjectL();
|
|
427 |
|
|
428 |
floatObject->SetValueL(aValueString);
|
|
429 |
|
|
430 |
return floatObject;
|
|
431 |
|
|
432 |
}
|
|
433 |
// ==========================================================================
|
|
434 |
// END OF CFloatCssValueImpl Memory Management
|
|
435 |
// ==========================================================================
|
|
436 |
|
|
437 |
// ==========================================================================
|
|
438 |
// BEGIN CClrCssValueImpl Memory Management
|
|
439 |
// ==========================================================================
|
|
440 |
// ==========================================================================
|
|
441 |
// CSvgMemoryManager::AllocateCssClrBlockL
|
|
442 |
// ==========================================================================
|
|
443 |
void CSvgMemoryManager::AllocateCssClrBlockL( )
|
|
444 |
{
|
|
445 |
//setup the new current block
|
|
446 |
iCurrentClrObjectIndex = 0;
|
|
447 |
|
|
448 |
iCClrCssValueImplArray = new ( ELeave ) CClrCssValueImpl[KCssClrBlockSize];
|
|
449 |
|
|
450 |
//put the new block into the larger tracking array.
|
|
451 |
iCClrCssValueImplArrays.AppendL(iCClrCssValueImplArray);
|
|
452 |
|
|
453 |
}
|
|
454 |
|
|
455 |
// ==========================================================================
|
|
456 |
// CSvgMemoryManager::GetCssClrObject
|
|
457 |
// MAIN allocation block
|
|
458 |
// ==========================================================================
|
|
459 |
CClrCssValueImpl* CSvgMemoryManager::GetCssClrObjectL( )
|
|
460 |
{
|
|
461 |
if ( !iCClrCssValueImplArray || iCurrentClrObjectIndex >= KCssClrBlockSize )
|
|
462 |
{
|
|
463 |
//we have used all of the objects in the current array
|
|
464 |
//and need to allocate another one
|
|
465 |
AllocateCssClrBlockL();
|
|
466 |
}
|
|
467 |
|
|
468 |
CClrCssValueImpl* lClrObject = &iCClrCssValueImplArray[iCurrentClrObjectIndex++];
|
|
469 |
return ( lClrObject );
|
|
470 |
}
|
|
471 |
|
|
472 |
// ==========================================================================
|
|
473 |
// CSvgMemoryManager::GetCssClrObject
|
|
474 |
// ==========================================================================
|
|
475 |
CClrCssValueImpl* CSvgMemoryManager::GetCssClrObjectL( const TDesC& aValueString )
|
|
476 |
{
|
|
477 |
CClrCssValueImpl* clrObject = GetCssClrObjectL();
|
|
478 |
|
|
479 |
clrObject->SetValueL(aValueString);
|
|
480 |
|
|
481 |
return clrObject;
|
|
482 |
|
|
483 |
}
|
|
484 |
// ==========================================================================
|
|
485 |
// END OF CClrCssValueImpl Memory Management
|
|
486 |
// ==========================================================================
|
|
487 |
|
|
488 |
// ==========================================================================
|
|
489 |
// BEGIN CStrCssValueImpl Memory Management
|
|
490 |
// ==========================================================================
|
|
491 |
// ==========================================================================
|
|
492 |
// CSvgMemoryManager::AllocateCssStrBlockL
|
|
493 |
// ==========================================================================
|
|
494 |
void CSvgMemoryManager::AllocateCssStrBlockL( )
|
|
495 |
{
|
|
496 |
//setup the new current block
|
|
497 |
iCurrentStrObjectIndex = 0;
|
|
498 |
|
|
499 |
iCStrCssValueImplArray = new ( ELeave ) CStrCssValueImpl[KCssStrBlockSize];
|
|
500 |
|
|
501 |
//may not need this as long as we always pass in initial values for string
|
|
502 |
Mem::FillZ( iCStrCssValueImplArray, sizeof(CStrCssValueImpl)*KCssStrBlockSize);
|
|
503 |
|
|
504 |
//put the new block into the larger tracking array.
|
|
505 |
iCStrCssValueImplArrays.AppendL(iCStrCssValueImplArray);
|
|
506 |
|
|
507 |
}
|
|
508 |
|
|
509 |
// ==========================================================================
|
|
510 |
// CSvgMemoryManager::GetCssStrObject
|
|
511 |
// MAIN allocation block
|
|
512 |
// ==========================================================================
|
|
513 |
CStrCssValueImpl* CSvgMemoryManager::GetCssStrObjectL( const TDesC& aValue )
|
|
514 |
{
|
|
515 |
if ( !iCStrCssValueImplArray || iCurrentStrObjectIndex >= KCssStrBlockSize )
|
|
516 |
{
|
|
517 |
//we have used all of the objects in the current array
|
|
518 |
//and need to allocate another one
|
|
519 |
AllocateCssStrBlockL();
|
|
520 |
}
|
|
521 |
|
|
522 |
CStrCssValueImpl* lStrObject = &iCStrCssValueImplArray[iCurrentStrObjectIndex++];
|
|
523 |
lStrObject->SetValueL(aValue);
|
|
524 |
return ( lStrObject );
|
|
525 |
}
|
|
526 |
// ==========================================================================
|
|
527 |
// END OF CStrCssValueImpl Memory Management
|
|
528 |
// ==========================================================================
|
|
529 |
|
|
530 |
// ==========================================================================
|
|
531 |
// BEGIN CVectorCssValueImpl Memory Management
|
|
532 |
// ==========================================================================
|
|
533 |
// ==========================================================================
|
|
534 |
// CSvgMemoryManager::AllocateCssVectorBlockL
|
|
535 |
// ==========================================================================
|
|
536 |
void CSvgMemoryManager::AllocateCssVectorBlockL( )
|
|
537 |
{
|
|
538 |
//setup the new current block
|
|
539 |
iCurrentVectorObjectIndex = 0;
|
|
540 |
|
|
541 |
iCVectorCssValueImplArray = new ( ELeave ) CVectorCssValueImpl[KCssVectorBlockSize];
|
|
542 |
|
|
543 |
Mem::FillZ( iCVectorCssValueImplArray, sizeof(CVectorCssValueImpl)*KCssVectorBlockSize);
|
|
544 |
|
|
545 |
//put the new block into the larger tracking array.
|
|
546 |
iCVectorCssValueImplArrays.AppendL(iCVectorCssValueImplArray);
|
|
547 |
|
|
548 |
}
|
|
549 |
|
|
550 |
// ==========================================================================
|
|
551 |
// CSvgMemoryManager::GetCssVectorObject
|
|
552 |
// MAIN allocation block
|
|
553 |
// ==========================================================================
|
|
554 |
CVectorCssValueImpl* CSvgMemoryManager::GetCssVectorObjectL( const TDesC& aValue )
|
|
555 |
{
|
|
556 |
if ( !iCVectorCssValueImplArray || iCurrentVectorObjectIndex >= KCssVectorBlockSize )
|
|
557 |
{
|
|
558 |
//we have used all of the objects in the current array
|
|
559 |
//and need to allocate another one
|
|
560 |
AllocateCssVectorBlockL();
|
|
561 |
}
|
|
562 |
|
|
563 |
CVectorCssValueImpl* lVectorObject = &iCVectorCssValueImplArray[iCurrentVectorObjectIndex++];
|
|
564 |
lVectorObject->SetValueL(aValue);
|
|
565 |
return ( lVectorObject );
|
|
566 |
}
|
|
567 |
|
|
568 |
// ==========================================================================
|
|
569 |
// CSvgMemoryManager::GetCssVectorObject
|
|
570 |
// MAIN allocation block
|
|
571 |
// ==========================================================================
|
|
572 |
CVectorCssValueImpl* CSvgMemoryManager::GetCssVectorObjectL( CArrayFix<TFloatFixPt>* aValue )
|
|
573 |
{
|
|
574 |
if ( !iCVectorCssValueImplArray || iCurrentVectorObjectIndex >= KCssVectorBlockSize )
|
|
575 |
{
|
|
576 |
//we have used all of the objects in the current array
|
|
577 |
//and need to allocate another one
|
|
578 |
AllocateCssVectorBlockL();
|
|
579 |
}
|
|
580 |
|
|
581 |
CVectorCssValueImpl* lVectorObject = &iCVectorCssValueImplArray[iCurrentVectorObjectIndex++];
|
|
582 |
lVectorObject->CloneValueL(aValue);
|
|
583 |
return ( lVectorObject );
|
|
584 |
}
|
|
585 |
|
|
586 |
// ==========================================================================
|
|
587 |
// END OF CVectorCssValueImpl Memory Management
|
|
588 |
// ==========================================================================
|
|
589 |
|
|
590 |
void CSvgMemoryManager::Print()
|
|
591 |
{
|
|
592 |
#ifdef _DEBUG
|
|
593 |
RDebug::Printf("CSvgMemoryManager:: iCPaintCssValueImplArrays objects: %d",
|
|
594 |
(iCPaintCssValueImplArrays.Count() - 1) * KCssPaintBlockSize + iCurrentPaintObjectIndex);
|
|
595 |
RDebug::Printf("CSvgMemoryManager:: iCFloatCssValueImplArrays objects: %d",
|
|
596 |
(iCFloatCssValueImplArrays.Count() - 1) * KCssFloatBlockSize + iCurrentFloatObjectIndex);
|
|
597 |
RDebug::Printf("CSvgMemoryManager:: iCClrCssValueImplArrays objects: %d",
|
|
598 |
(iCClrCssValueImplArrays.Count() - 1) * KCssClrBlockSize + iCurrentClrObjectIndex);
|
|
599 |
RDebug::Printf("CSvgMemoryManager:: iCIntCssValueImplArrays objects: %d",
|
|
600 |
(iCIntCssValueImplArrays.Count() - 1) * KCssIntBlockSize + iCurrentIntObjectIndex);
|
|
601 |
RDebug::Printf("CSvgMemoryManager:: iCStrCssValueImplArrays objects: %d",
|
|
602 |
(iCStrCssValueImplArrays.Count() - 1) * KCssStrBlockSize + iCurrentStrObjectIndex);
|
|
603 |
RDebug::Printf("CSvgMemoryManager:: iCVectorCssValueImplArrays objects: %d",
|
|
604 |
(iCVectorCssValueImplArrays.Count() - 1) * KCssVectorBlockSize + iCurrentVectorObjectIndex);
|
|
605 |
#endif
|
|
606 |
}
|
|
607 |
|
|
608 |
|