From 1172d5b8369179cb6b02a0ed292a003f3a5f17fd Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Tue, 12 Mar 2013 20:52:24 -0300 Subject: [PATCH] love.graphics.newScreenshot now uses the size of the current canvas (if applicable), instead of adding transparency or clipping to match the screen size --- src/modules/graphics/opengl/Graphics.cpp | 11 +++++++++-- src/modules/graphics/opengl/Graphics.h | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index b581cef79..5e6825c78 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -243,6 +243,13 @@ int Graphics::getHeight() const return currentWindow->getHeight(); } +int Graphics::getRenderWidth() const +{ + if (Canvas::current) + return Canvas::current->getWidth(); + return getWidth(); +} + int Graphics::getRenderHeight() const { if (Canvas::current) @@ -1072,8 +1079,8 @@ void Graphics::polygon(DrawMode mode, const float *coords, size_t count) love::image::ImageData *Graphics::newScreenshot(love::image::Image *image, bool copyAlpha) { - int w = getWidth(); - int h = getHeight(); + int w = getRenderWidth(); + int h = getRenderHeight(); int row = 4*w; diff --git a/src/modules/graphics/opengl/Graphics.h b/src/modules/graphics/opengl/Graphics.h index 6b5925d10..ff5a43a36 100644 --- a/src/modules/graphics/opengl/Graphics.h +++ b/src/modules/graphics/opengl/Graphics.h @@ -483,7 +483,9 @@ private: GLint matrixLimit; GLint userMatrices; + int getRenderWidth() const; int getRenderHeight() const; + }; // Graphics } // opengl