From cf8b3cc1f9971f8ff89ed441dd9b74192f41df6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Ko=C5=82odziejski?= Date: Sat, 1 Jan 2022 17:42:32 +0100 Subject: [PATCH] TINYGL: Move function to GLContext --- graphics/tinygl/zdirtyrect.cpp | 17 ++++++++--------- graphics/tinygl/zgl.h | 4 +++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/graphics/tinygl/zdirtyrect.cpp b/graphics/tinygl/zdirtyrect.cpp index 4dea70e3cc5..cb753f4d5ef 100644 --- a/graphics/tinygl/zdirtyrect.cpp +++ b/graphics/tinygl/zdirtyrect.cpp @@ -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); } } diff --git a/graphics/tinygl/zgl.h b/graphics/tinygl/zgl.h index 493fa86e6e5..9a3b36bc626 100644 --- a/graphics/tinygl/zgl.h +++ b/graphics/tinygl/zgl.h @@ -481,7 +481,9 @@ public: void presentBufferDirtyRects(Common::List &dirtyAreas); void presentBufferSimple(Common::List &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();