|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalComponent |
|
19 */ |
|
20 |
|
21 #ifndef SGIMAGECOLLECTIONIMPL_H |
|
22 #define SGIMAGECOLLECTIONIMPL_H |
|
23 |
|
24 #include "sgimagecollectionadapter.h" |
|
25 #include "sgdriverimpl.h" |
|
26 |
|
27 |
|
28 /** |
|
29 @internalComponent |
|
30 |
|
31 An adapter object representing an image collection. Image collections are always |
|
32 stored as surfaces. All the images in a collection have the same metadata, which |
|
33 is stored at the beginning of the underlying memory chunk. |
|
34 |
|
35 If several image collections share a single memory chunk then the metadata is stored |
|
36 in an array with as many elements as image collections, while the pixel data of |
|
37 each image in any of the collections shares the surface buffer with the corresponding |
|
38 images in the other collections. |
|
39 */ |
|
40 class XSgImageCollectionImpl: public XSgBase, public MSgImageCollectionAdapter |
|
41 { |
|
42 public: |
|
43 static TInt New(XSgImageCollectionImpl*& aPtr, XSgDriverImpl& aDriverImpl, |
|
44 const TSgImageInfo& aInfo, TInt aImageCount, TBool aIsCached, |
|
45 TInt aStride, TInt aOffsetToFirstBuffer, TInt aOffsetBetweenBuffers, |
|
46 TInt aMetaDataIndex = 0, const XSgImageCollectionImpl* aCollection = NULL); |
|
47 ~XSgImageCollectionImpl(); |
|
48 // From MSgResourceAdapter |
|
49 void Close(); |
|
50 // From MSgImageCollectionAdapter |
|
51 const TSurfaceId& SurfaceId() const; |
|
52 TInt GetInfo(TSgImageInfo& aInfo) const; |
|
53 TInt Count() const; |
|
54 TInt OpenImage(TInt aIndex, MSgDrawableAdapter*& aResult); |
|
55 private: |
|
56 inline XSgImageCollectionImpl(XSgDriverImpl& aDriverImpl); |
|
57 TInt Construct(const TSgImageInfo& aInfo, TInt aImageCount, TBool aIsCached, |
|
58 TInt aStride, TInt aOffsetToFirstBuffer, TInt aOffsetBetweenBuffers, |
|
59 TInt aMetaDataIndex, const XSgImageCollectionImpl* aCollection); |
|
60 private: |
|
61 /** The surface identifier of the image collection. */ |
|
62 TSurfaceId iSurfaceId; |
|
63 /** The number of images in the collection. */ |
|
64 TInt iCount; |
|
65 /** Handle to the underlying memory chunk. */ |
|
66 RChunk iDataChunk; |
|
67 /** Index into the metadata array. */ |
|
68 TInt iMetaDataIndex; |
|
69 }; |
|
70 |
|
71 |
|
72 #include "sgimagecollectionimpl.inl" |
|
73 |
|
74 |
|
75 #endif // SGIMAGECOLLECTIONIMPL_H |