MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / PushScissor

Method PushScissor

ogsr_engine/xrGame/ui_base.cpp:161–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161void ui_core::PushScissor(const Frect& r_tgt, bool overlapped)
162{
163 if (UI()->m_currentPointType == IUIRender::pttLIT)
164 return;
165
166 Frect r_top = ScreenRect();
167 Frect result = r_tgt;
168 if (!m_Scissors.empty() && !overlapped)
169 {
170 r_top = m_Scissors.top();
171 }
172 if (!result.intersection(r_top, r_tgt))
173 result.set(0.0f, 0.0f, 0.0f, 0.0f);
174
175 if (!(result.x1 >= 0 && result.y1 >= 0 && result.x2 <= UI_BASE_WIDTH && result.y2 <= UI_BASE_HEIGHT))
176 {
177 Msg("! r_tgt [%.3f][%.3f][%.3f][%.3f]", r_tgt.x1, r_tgt.y1, r_tgt.x2, r_tgt.y2);
178 Msg("! result [%.3f][%.3f][%.3f][%.3f]", result.x1, result.y1, result.x2, result.y2);
179 VERIFY(result.x1 >= 0 && result.y1 >= 0 && result.x2 <= UI_BASE_WIDTH && result.y2 <= UI_BASE_HEIGHT);
180 }
181 m_Scissors.push(result);
182
183 result.lt.x = ClientToScreenScaledX(result.lt.x);
184 result.lt.y = ClientToScreenScaledY(result.lt.y);
185 result.rb.x = ClientToScreenScaledX(result.rb.x);
186 result.rb.y = ClientToScreenScaledY(result.rb.y);
187
188 Irect r;
189 r.x1 = iFloor(result.x1);
190 r.x2 = iFloor(result.x2 + 0.5f);
191 r.y1 = iFloor(result.y1);
192 r.y2 = iFloor(result.y2 + 0.5f);
193 UIRender->SetScissor(&r);
194}
195
196void ui_core::PopScissor()
197{

Callers 7

RenderMethod · 0.80
DrawMethod · 0.80
DrawMethod · 0.80
DrawMethod · 0.80
DrawMethod · 0.80
DrawMethod · 0.80
DrawMethod · 0.80

Calls 7

UIFunction · 0.85
MsgFunction · 0.85
intersectionMethod · 0.80
SetScissorMethod · 0.80
emptyMethod · 0.45
setMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected