TINYGL: Move function to GLContext

This commit is contained in:
Paweł Kołodziejski 2022-01-01 17:42:32 +01:00
parent c3a73efa8d
commit cf8b3cc1f9
2 changed files with 11 additions and 10 deletions

View file

@ -34,9 +34,8 @@ void GLContext::issueDrawCall(DrawCall *drawCall) {
_drawCallsQueue.push_back(drawCall);
}
static void debugDrawRectangle(Common::Rect rect, int r, int g, int b) {
GLContext *c = gl_get_context();
int fbWidth = c->fb->getPixelBufferWidth();
void GLContext::debugDrawRectangle(Common::Rect rect, int r, int g, int b) {
int fbWidth = fb->getPixelBufferWidth();
if (rect.left < 0)
rect.left = 0;
@ -44,16 +43,16 @@ static void debugDrawRectangle(Common::Rect rect, int r, int g, int b) {
rect.right = fbWidth - 1;
if (rect.top < 0)
rect.top = 0;
if (rect.bottom >= c->fb->getPixelBufferHeight())
rect.bottom = c->fb->getPixelBufferHeight() - 1;
if (rect.bottom >= fb->getPixelBufferHeight())
rect.bottom = fb->getPixelBufferHeight() - 1;
for (int x = rect.left; x < rect.right; x++) {
c->fb->writePixel(rect.top * fbWidth + x, 255, r, g, b);
c->fb->writePixel((rect.bottom - 1) * fbWidth + x, 255, r, g, b);
fb->writePixel(rect.top * fbWidth + x, 255, r, g, b);
fb->writePixel((rect.bottom - 1) * fbWidth + x, 255, r, g, b);
}
for (int y = rect.top; y < rect.bottom; y++) {
c->fb->writePixel(y * fbWidth + rect.left, 255, r, g, b);
c->fb->writePixel(y * fbWidth + rect.right - 1, 255, r, g, b);
fb->writePixel(y * fbWidth + rect.left, 255, r, g, b);
fb->writePixel(y * fbWidth + rect.right - 1, 255, r, g, b);
}
}

View file

@ -481,7 +481,9 @@ public:
void presentBufferDirtyRects(Common::List<Common::Rect> &dirtyAreas);
void presentBufferSimple(Common::List<Common::Rect> &dirtyAreas);
void debugDrawRectangle(Common::Rect rect, int r, int g, int b);
GLSpecBuf *specbuf_get_buffer(const int shininess_i, const float shininess);
void specbuf_cleanup();