|
1 /* |
|
2 * Copyright (c) 2008-2009 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: Thumbnail Info |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <fbs.h> |
|
21 |
|
22 // --------------------------------------------------------------------------- |
|
23 // GlxFullThumbnailAttributeId |
|
24 // --------------------------------------------------------------------------- |
|
25 // |
|
26 inline TUint GlxFullThumbnailAttributeId(TBool aHighQuality, |
|
27 TInt aWidth, TInt aHeight) |
|
28 { |
|
29 return ((aHighQuality ? 0xA0000000u : 0x80000000u) |
|
30 | ((aWidth & 0x7FFFu) << 15) | (aHeight & 0x7FFFu)); |
|
31 } |
|
32 |
|
33 // --------------------------------------------------------------------------- |
|
34 // GlxZoomedThumbnailAttributeId |
|
35 // --------------------------------------------------------------------------- |
|
36 // |
|
37 inline TUint GlxZoomedThumbnailAttributeId(TInt aZoomLevel, |
|
38 TInt aXIndex, TInt aYIndex) |
|
39 { |
|
40 return (((aZoomLevel & 0x7u) << 28) |
|
41 | ((aXIndex & 0xFFFu) << 12) | (aYIndex & 0xFFFu)); |
|
42 } |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // GlxIsFullThumbnailAttribute |
|
46 // --------------------------------------------------------------------------- |
|
47 // |
|
48 inline TBool GlxIsFullThumbnailAttribute(TUint aAttributeId) |
|
49 { |
|
50 return (aAttributeId & 0x80000000u); |
|
51 } |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // GlxZoomedThumbnailZoomLevel |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 inline TInt GlxZoomedThumbnailZoomLevel(TUint aAttributeId) |
|
58 { |
|
59 return (aAttributeId >> 28) & 0x7u; |
|
60 } |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // C++ default constructor can NOT contain any code that might leave. |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 inline CGlxThumbnailAttribute::CGlxThumbnailAttribute() |
|
67 { |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // Destructor |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 inline CGlxThumbnailAttribute::~CGlxThumbnailAttribute() |
|
75 { |
|
76 delete iBitmap; |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // ExternalizeL |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 inline void CGlxThumbnailAttribute::ExternalizeL(RWriteStream& aStream) const |
|
84 { |
|
85 aStream.WriteInt32L(iThumbnailQuality); |
|
86 aStream.WriteInt32L(iCroppingRect.iTl.iX); |
|
87 aStream.WriteInt32L(iCroppingRect.iTl.iY); |
|
88 aStream.WriteInt32L(iCroppingRect.iBr.iX); |
|
89 aStream.WriteInt32L(iCroppingRect.iBr.iY); |
|
90 aStream.WriteInt32L(iDimensions.iWidth); |
|
91 aStream.WriteInt32L(iDimensions.iHeight); |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // InternalizeL |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 void CGlxThumbnailAttribute::InternalizeL(RReadStream& aStream) |
|
99 { |
|
100 iThumbnailQuality=aStream.ReadInt32L(); |
|
101 iCroppingRect.iTl.iX=aStream.ReadInt32L(); |
|
102 iCroppingRect.iTl.iY=aStream.ReadInt32L(); |
|
103 iCroppingRect.iBr.iX=aStream.ReadInt32L(); |
|
104 iCroppingRect.iBr.iY=aStream.ReadInt32L(); |
|
105 iDimensions.iWidth=aStream.ReadInt32L(); |
|
106 iDimensions.iHeight=aStream.ReadInt32L(); |
|
107 } |