From ce9e694acc9705fd42a341b2c248e128a52addba Mon Sep 17 00:00:00 2001 From: vrld Date: Mon, 10 Oct 2011 12:16:28 +0200 Subject: [PATCH] Make setDefaultImageFilter() not break image:setFilter() (thanks adrix89!) --- src/modules/graphics/opengl/Graphics.cpp | 4 +++- src/modules/graphics/opengl/Image.cpp | 7 ++++--- src/modules/graphics/opengl/Image.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index aab365f54..15b21a64d 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -476,7 +476,7 @@ namespace opengl Image * Graphics::newImage(love::image::ImageData * data) { // Create the image. - Image * image = new Image(data, currentImageFilter); + Image * image = new Image(data); bool success; try { success = image->load(); @@ -489,6 +489,8 @@ namespace opengl return 0; } + image->setFilter(currentImageFilter); + return image; } diff --git a/src/modules/graphics/opengl/Image.cpp b/src/modules/graphics/opengl/Image.cpp index 19a1a91bd..06f572a21 100644 --- a/src/modules/graphics/opengl/Image.cpp +++ b/src/modules/graphics/opengl/Image.cpp @@ -23,13 +23,16 @@ // STD #include // For memcpy +#include +using namespace std; + namespace love { namespace graphics { namespace opengl { - Image::Image(love::image::ImageData * data, const Image::Filter& filter) + Image::Image(love::image::ImageData * data) : width((float)(data->getWidth())), height((float)(data->getHeight())), texture(0) { data->retain(); @@ -46,8 +49,6 @@ namespace opengl vertices[1].s = 0; vertices[1].t = 1; vertices[2].s = 1; vertices[2].t = 1; vertices[3].s = 1; vertices[3].t = 0; - - setFilter(filter); } Image::~Image() diff --git a/src/modules/graphics/opengl/Image.h b/src/modules/graphics/opengl/Image.h index 1e0dbefff..f3118b44a 100644 --- a/src/modules/graphics/opengl/Image.h +++ b/src/modules/graphics/opengl/Image.h @@ -78,7 +78,7 @@ namespace opengl * * @param file The file from which to load the image. **/ - Image(love::image::ImageData * data, const Image::Filter& f = Image::Filter()); + Image(love::image::ImageData * data); /** * Destructor. Deletes the hardware texture and other resources.