MCPcopy Create free account
hub / github.com/MyGUI/mygui / recalcIndexes

Method recalcIndexes

MyGUIEngine/src/MyGUI_ImageBox.cpp:101–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99 }
100
101 void ImageBox::recalcIndexes()
102 {
103 mItems.clear();
104
105 if ((mRectImage.right <= mRectImage.left) || (mRectImage.bottom <= mRectImage.top))
106 return;
107 if ((mSizeTile.width <= 0) || (mSizeTile.height <= 0))
108 return;
109
110 size_t count_h = (size_t)(mRectImage.width() / mSizeTile.width);
111 size_t count_v = (size_t)(mRectImage.height() / mSizeTile.height);
112
113 if ((count_h * count_v) > IMAGE_MAX_INDEX)
114 {
115 MYGUI_LOG(
116 Warning,
117 "Tile count very mach, rect : "
118 << mRectImage.print() << " tile : " << mSizeTile.print() << " texture : " << _getTextureName()
119 << " indexes : " << (count_h * count_v) << " max : " << IMAGE_MAX_INDEX);
120 return;
121 }
122
123 int pos_h = mRectImage.left;
124 int pos_v = mRectImage.top;
125
126 for (size_t v = 0; v < count_v; ++v)
127 {
128 for (size_t h = 0; h < count_h; ++h)
129 {
130 addItem(IntCoord(pos_h, pos_v, mSizeTile.width, mSizeTile.height));
131 pos_h += mSizeTile.width;
132 }
133 pos_v += mSizeTile.height;
134 pos_h = mRectImage.left;
135 }
136 }
137
138 void ImageBox::updateSelectIndex(size_t _index)
139 {

Callers

nothing calls this directly

Calls 5

IntCoordFunction · 0.50
clearMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected