Small footprint UI library for hardware accelerated games & applications
リビジョン | 776dc5bba6f02a82f97a1350e7125fb0f430a0b1 (tree) |
---|---|
日時 | 2014-05-03 19:49:42 |
作者 | Emil Segerås <emilsegers@gmai...> |
コミッター | Emil Segerås |
Added TBBitmapFragment GetAllocatedHeight.
@@ -261,6 +261,7 @@ TBBitmapFragment *TBBitmapFragmentMap::CreateNewFragment(int frag_w, int frag_h, | ||
261 | 261 | frag->m_row = best_row; |
262 | 262 | frag->m_space = space; |
263 | 263 | frag->m_rect.Set(space->x + border, best_row->y + border, frag_w, frag_h); |
264 | + frag->m_row_height = best_row->height; | |
264 | 265 | frag->m_batch_id = 0xffffffff; |
265 | 266 | CopyData(frag, data_stride, frag_data, border); |
266 | 267 | m_need_update = true; |
@@ -293,6 +294,7 @@ void TBBitmapFragmentMap::FreeFragmentSpace(TBBitmapFragment *frag) | ||
293 | 294 | |
294 | 295 | m_allocated_pixels -= frag->m_space->width * frag->m_row->height; |
295 | 296 | frag->m_row->FreeSpace(frag->m_space); |
297 | + frag->m_row_height = 0; | |
296 | 298 | } |
297 | 299 | |
298 | 300 | void TBBitmapFragmentMap::CopyData(TBBitmapFragment *frag, int data_stride, uint32 *frag_data, int border) |
@@ -141,20 +141,25 @@ class TBBitmapFragment | ||
141 | 141 | { |
142 | 142 | public: |
143 | 143 | /** Return the width of the bitmap fragment. */ |
144 | - int Width() { return m_rect.w; } | |
144 | + int Width() const { return m_rect.w; } | |
145 | 145 | |
146 | 146 | /** Return the height of the bitmap fragment. */ |
147 | - int Height() { return m_rect.h; } | |
147 | + int Height() const { return m_rect.h; } | |
148 | 148 | |
149 | 149 | /** Return the bitmap for this fragment. |
150 | 150 | By default, the bitmap is validated if needed before returning (See TB_VALIDATE_TYPE) */ |
151 | 151 | TBBitmap *GetBitmap(TB_VALIDATE_TYPE validate_type = TB_VALIDATE_ALWAYS) { return m_map->GetBitmap(validate_type); } |
152 | + | |
153 | + /** Return the height allocated to this fragment. This may be larger than Height() depending | |
154 | + of the internal allocation of fragments in a map. It should rarely be used. */ | |
155 | + int GetAllocatedHeight() const { return m_row_height; } | |
152 | 156 | public: |
153 | 157 | TBBitmapFragmentMap *m_map; |
154 | 158 | TBRect m_rect; |
155 | 159 | TBFragmentSpaceAllocator *m_row; |
156 | 160 | TBFragmentSpaceAllocator::Space *m_space; |
157 | 161 | TBID m_id; |
162 | + int m_row_height; | |
158 | 163 | |
159 | 164 | /** This uint32 is reserved for batching renderer backends. It's not used |
160 | 165 | internally, but always initialized to 0xffffffff for all new fragments. */ |