From d82a7e7c0bbffb683fd18d084da483d8f0a03c90 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 5 Dec 2017 17:16:17 +0000 Subject: [PATCH] Removed the unncessary rescale to power of two, and added clear of image to prevent previous image data corrupting the rendered image --- src/osgPlugins/svg/ReaderWriterSVG.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/osgPlugins/svg/ReaderWriterSVG.cpp b/src/osgPlugins/svg/ReaderWriterSVG.cpp index 5bc63514f..f69284f79 100644 --- a/src/osgPlugins/svg/ReaderWriterSVG.cpp +++ b/src/osgPlugins/svg/ReaderWriterSVG.cpp @@ -110,12 +110,15 @@ class ReaderWriterSVG : public osgDB::ReaderWriter // I don't know why, but we check the size... if (width < 128) width = 128; if (height < 128) height = 128; - width = osg::Image::computeNearestPowerOfTwo(width); - height = osg::Image::computeNearestPowerOfTwo(height); + //width = osg::Image::computeNearestPowerOfTwo(width); + //height = osg::Image::computeNearestPowerOfTwo(height); osg::Image *image = new osg::Image(); image->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE); image->setPixelFormat(GL_BGRA); + // make sure the image data is cleared before we write to it. + memset(image->data(), 0, image->getTotalSizeInBytesIncludingMipmaps()); + cairo_surface_t *cairo_surface = cairo_image_surface_create_for_data(image->data(), CAIRO_FORMAT_ARGB32, width, height, image->getRowSizeInBytes()); cairo_t *cr = cairo_create(cairo_surface);