|
1 /* |
|
2 * Copyright (c) 2004-2008 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: Bitmap store. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include <fbs.h> |
|
22 |
|
23 #include "AknsSrvBitmapStore.h" |
|
24 #include "AknsDebug.h" |
|
25 |
|
26 // ============================ MEMBER FUNCTIONS =============================== |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 // Destructor. |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 CAknsSrvBitmapStore::~CAknsSrvBitmapStore() |
|
33 { |
|
34 iBitmapArray.ResetAndDestroy(); |
|
35 #if defined(_DEBUG) |
|
36 iCacheSize = 0; |
|
37 #endif |
|
38 } |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // C++ default constructor. |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 CAknsSrvBitmapStore::CAknsSrvBitmapStore() |
|
45 { |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // Store bitmap. |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 void CAknsSrvBitmapStore::StoreBitmap(const CFbsBitmap* aBitmap) |
|
53 { |
|
54 iBitmapArray.Append(aBitmap); |
|
55 #if defined(_DEBUG) |
|
56 iCacheSize+=aBitmap->Header().iBitmapSize; |
|
57 AKNS_TRACE_INFO2("Scalable gfx cache size after STORE: %d bytes, itemcount (incl. masks): %d", |
|
58 iCacheSize, iBitmapArray.Count()); |
|
59 #endif |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // Destroy bitmap. |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 void CAknsSrvBitmapStore::DestroyBitmaps() |
|
67 { |
|
68 iBitmapArray.ResetAndDestroy(); |
|
69 #if defined(_DEBUG) |
|
70 iCacheSize = 0; |
|
71 #endif |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // Remove stored bitmap. |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 void CAknsSrvBitmapStore::RemoveStoredBitmap(const TInt aBmpHandle) |
|
79 { |
|
80 if (aBmpHandle) |
|
81 { |
|
82 CFbsBitmap* bmp = NULL; |
|
83 for (TInt bodycount = 0; bodycount < iBitmapArray.Count(); bodycount++) |
|
84 { |
|
85 bmp = iBitmapArray[bodycount]; |
|
86 if (bmp->Handle() == aBmpHandle) |
|
87 { |
|
88 #if defined(_DEBUG) |
|
89 iCacheSize-=bmp->Header().iBitmapSize; |
|
90 AKNS_TRACE_INFO2("Scalable gfx cache size after REMOVE: %d bytes, itemcount (incl. masks): %d", |
|
91 iCacheSize, iBitmapArray.Count()-1); |
|
92 #endif |
|
93 iBitmapArray.Remove(bodycount); |
|
94 bodycount--; |
|
95 delete bmp; |
|
96 } |
|
97 } |
|
98 } |
|
99 } |
|
100 |
|
101 // End of File |