• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

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.

変更サマリ

差分

--- a/src/tb/tb_bitmap_fragment.cpp
+++ b/src/tb/tb_bitmap_fragment.cpp
@@ -261,6 +261,7 @@ TBBitmapFragment *TBBitmapFragmentMap::CreateNewFragment(int frag_w, int frag_h,
261261 frag->m_row = best_row;
262262 frag->m_space = space;
263263 frag->m_rect.Set(space->x + border, best_row->y + border, frag_w, frag_h);
264+ frag->m_row_height = best_row->height;
264265 frag->m_batch_id = 0xffffffff;
265266 CopyData(frag, data_stride, frag_data, border);
266267 m_need_update = true;
@@ -293,6 +294,7 @@ void TBBitmapFragmentMap::FreeFragmentSpace(TBBitmapFragment *frag)
293294
294295 m_allocated_pixels -= frag->m_space->width * frag->m_row->height;
295296 frag->m_row->FreeSpace(frag->m_space);
297+ frag->m_row_height = 0;
296298 }
297299
298300 void TBBitmapFragmentMap::CopyData(TBBitmapFragment *frag, int data_stride, uint32 *frag_data, int border)
--- a/src/tb/tb_bitmap_fragment.h
+++ b/src/tb/tb_bitmap_fragment.h
@@ -141,20 +141,25 @@ class TBBitmapFragment
141141 {
142142 public:
143143 /** Return the width of the bitmap fragment. */
144- int Width() { return m_rect.w; }
144+ int Width() const { return m_rect.w; }
145145
146146 /** Return the height of the bitmap fragment. */
147- int Height() { return m_rect.h; }
147+ int Height() const { return m_rect.h; }
148148
149149 /** Return the bitmap for this fragment.
150150 By default, the bitmap is validated if needed before returning (See TB_VALIDATE_TYPE) */
151151 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; }
152156 public:
153157 TBBitmapFragmentMap *m_map;
154158 TBRect m_rect;
155159 TBFragmentSpaceAllocator *m_row;
156160 TBFragmentSpaceAllocator::Space *m_space;
157161 TBID m_id;
162+ int m_row_height;
158163
159164 /** This uint32 is reserved for batching renderer backends. It's not used
160165 internally, but always initialized to 0xffffffff for all new fragments. */