Merge "Follow the include-order coding conventions" into tizen
[platform/core/uifw/dali-core.git] / dali / internal / common / bitmap-upload.h
1 #ifndef __DALI_INTERNAL_BITMAP_UPLOAD_H__
2 #define __DALI_INTERNAL_BITMAP_UPLOAD_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/common/vector-wrapper.h>
23
24 namespace Dali
25 {
26
27 namespace Internal
28 {
29
30 /**
31  * Holds a bitmap and a x,y pixel position of where the bitmap
32  * should be uploaded to in a texture.
33  *
34  */
35 struct BitmapUpload
36 {
37
38   enum DiscardMode
39   {
40     DISCARD_PIXEL_DATA,       ///< Delete the pixel data after upload
41     DONT_DISCARD_PIXEL_DATA  ///< Don't delete the pixel data after upload
42   };
43
44   typedef unsigned char      PixelData;  ///< pixel data type
45
46   /**
47    * Constructor
48    * @param data pixel data
49    * @param xPos x position of where to place the bitmap in a texture
50    * @param yPos y position of where to place the bitmap in a texture
51    * @param width bitmap width in pixels
52    * @param height bitmap height in pixels
53    * @param discardMode whether to delete the pixel data after the upload or not
54    */
55   BitmapUpload(PixelData*   data,
56                unsigned int xPos,
57                unsigned int yPos,
58                unsigned int width,
59                unsigned int height,
60                DiscardMode discardMode = DISCARD_PIXEL_DATA)
61   :mPixelData(data),
62    mXpos(xPos),
63    mYpos(yPos),
64    mWidth(width),
65    mHeight(height),
66    mDiscard(discardMode)
67   {
68   }
69
70
71   PixelData*   mPixelData;         ///< bitmap data to upload
72   unsigned int mXpos;              ///< x position to place the bitmap in the texture
73   unsigned int mYpos;              ///< y position to place the bitmap in the texture
74   unsigned int mWidth;             ///< width of the bitmap to upload
75   unsigned int mHeight;            ///< height of the bitmap to upload
76   DiscardMode  mDiscard;           ///< whether the pixel data should be discarded after the upload
77 };
78
79 typedef std::vector<BitmapUpload> BitmapUploadArray; ///< typedef for a array of uploads
80
81
82 /**
83  * Structure is used for clearing areas of the atlas prior to loading glyphs
84  */
85 typedef std::vector<Vector2> BitmapClearArray;
86
87 }  //namespace Internal
88
89 } //namespace Dali
90
91 #endif