MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / getGraphics

Method getGraphics

src/ui/widget.cpp:1126–1147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1124};
1125
1126GraphicsPtr Widget::getGraphics(const gfx::Rect& clip)
1127{
1128 GraphicsPtr graphics;
1129 she::Surface* surface;
1130 she::Surface* defaultSurface = she::instance()->defaultDisplay()->getSurface();
1131
1132 // In case of double-buffering, we need to create the temporary
1133 // buffer only if the default surface is the screen.
1134 if (isDoubleBuffered() && defaultSurface->isDirectToScreen()) {
1135 surface = she::instance()->createSurface(clip.w, clip.h);
1136 graphics.reset(new Graphics(surface, -clip.x, -clip.y),
1137 DeleteGraphicsAndSurface(clip, surface));
1138 }
1139 // In other case, we can draw directly onto the screen.
1140 else {
1141 surface = defaultSurface;
1142 graphics.reset(new Graphics(surface, bounds().x, bounds().y));
1143 }
1144
1145 graphics->setFont(font());
1146 return graphics;
1147}
1148
1149// ===============================================================
1150// GUI MANAGER

Callers

nothing calls this directly

Calls 8

instanceFunction · 0.85
defaultDisplayMethod · 0.80
isDirectToScreenMethod · 0.80
createSurfaceMethod · 0.80
setFontMethod · 0.80
getSurfaceMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected