MCPcopy Create free account
hub / github.com/DISTRHO/DPF / drawRectangle

Function drawRectangle

dgl/src/OpenGL2.cpp:264–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262
263template<typename T>
264static void drawRectangle(const Rectangle<T>& rect, const bool outline)
265{
266 DISTRHO_SAFE_ASSERT_RETURN(rect.isValid(),);
267
268 glBegin(outline ? GL_LINE_LOOP : GL_QUADS);
269
270 {
271 const T x = rect.getX();
272 const T y = rect.getY();
273 const T w = rect.getWidth();
274 const T h = rect.getHeight();
275
276 glTexCoord2f(0.0f, 0.0f);
277 glVertex2d(x, y);
278
279 glTexCoord2f(1.0f, 0.0f);
280 glVertex2d(x+w, y);
281
282 glTexCoord2f(1.0f, 1.0f);
283 glVertex2d(x+w, y+h);
284
285 glTexCoord2f(0.0f, 1.0f);
286 glVertex2d(x, y+h);
287 }
288
289 glEnd();
290}
291
292template<typename T>
293void Rectangle<T>::draw(const GraphicsContext& context)

Callers

nothing calls this directly

Calls 3

isValidMethod · 0.45
getWidthMethod · 0.45
getHeightMethod · 0.45

Tested by

no test coverage detected