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

Method _setUVSet

MyGUIEngine/src/MyGUI_SubSkin.cpp:174–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172 }
173
174 void SubSkin::_setUVSet(const FloatRect& _rect)
175 {
176 if (mRectTexture == _rect)
177 return;
178 mRectTexture = _rect;
179
180 // если обрезаны, то просчитываем с учето обрезки
181 if (mIsMargin)
182 {
183 float UV_lft = mMargin.left / (float)mCoord.width;
184 float UV_top = mMargin.top / (float)mCoord.height;
185 float UV_rgt = (mCoord.width - mMargin.right) / (float)mCoord.width;
186 float UV_btm = (mCoord.height - mMargin.bottom) / (float)mCoord.height;
187
188 float UV_sizeX = mRectTexture.right - mRectTexture.left;
189 float UV_sizeY = mRectTexture.bottom - mRectTexture.top;
190
191 float UV_lft_total = mRectTexture.left + UV_lft * UV_sizeX;
192 float UV_top_total = mRectTexture.top + UV_top * UV_sizeY;
193 float UV_rgt_total = mRectTexture.right - (1 - UV_rgt) * UV_sizeX;
194 float UV_btm_total = mRectTexture.bottom - (1 - UV_btm) * UV_sizeY;
195
196 mCurrentTexture.set(UV_lft_total, UV_top_total, UV_rgt_total, UV_btm_total);
197 }
198 // мы не обрезаны, базовые координаты
199 else
200 {
201 mCurrentTexture = mRectTexture;
202 }
203
204 if (nullptr != mNode)
205 mNode->outOfDate(mRenderItem);
206 }
207
208 void SubSkin::doRender()
209 {

Callers

nothing calls this directly

Calls 2

setMethod · 0.45
outOfDateMethod · 0.45

Tested by

no test coverage detected