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

Method _updateView

MyGUIEngine/src/MyGUI_SubSkin.cpp:91–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89 }
90
91 void SubSkin::_updateView()
92 {
93 //mAbsolutePosition = mCroppedParent->getAbsolutePosition() + mCoord.point();
94 bool margin = _checkMargin();
95
96 mEmptyView = ((0 >= _getViewWidth()) || (0 >= _getViewHeight()));
97
98 mCurrentCoord.left = mCoord.left + mMargin.left;
99 mCurrentCoord.top = mCoord.top + mMargin.top;
100
101 // вьюпорт стал битым
102 if (margin)
103 {
104 // проверка на полный выход за границу
105 if (_checkOutside())
106 {
107 // запоминаем текущее состояние
108 mIsMargin = margin;
109
110 // обновить перед выходом
111 if (nullptr != mNode)
112 mNode->outOfDate(mRenderItem);
113 return;
114 }
115 }
116
117 // мы обрезаны или были обрезаны
118 if (mIsMargin || margin)
119 {
120 mCurrentCoord.width = _getViewWidth();
121 mCurrentCoord.height = _getViewHeight();
122
123 if ((mCurrentCoord.width > 0) && (mCurrentCoord.height > 0))
124 {
125 // теперь смещаем текстуру
126 float UV_lft = mMargin.left / (float)mCoord.width;
127 float UV_top = mMargin.top / (float)mCoord.height;
128 float UV_rgt = (mCoord.width - mMargin.right) / (float)mCoord.width;
129 float UV_btm = (mCoord.height - mMargin.bottom) / (float)mCoord.height;
130
131 float UV_sizeX = mRectTexture.right - mRectTexture.left;
132 float UV_sizeY = mRectTexture.bottom - mRectTexture.top;
133
134 float UV_lft_total = mRectTexture.left + UV_lft * UV_sizeX;
135 float UV_top_total = mRectTexture.top + UV_top * UV_sizeY;
136 float UV_rgt_total = mRectTexture.right - (1 - UV_rgt) * UV_sizeX;
137 float UV_btm_total = mRectTexture.bottom - (1 - UV_btm) * UV_sizeY;
138
139 mCurrentTexture.set(UV_lft_total, UV_top_total, UV_rgt_total, UV_btm_total);
140 }
141 }
142
143 if (mIsMargin && !margin)
144 {
145 // мы не обрезаны, но были, ставим базовые координаты
146 mCurrentTexture = mRectTexture;
147 }
148

Callers

nothing calls this directly

Calls 5

_getViewWidthFunction · 0.85
_getViewHeightFunction · 0.85
_checkOutsideFunction · 0.85
outOfDateMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected