summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2016-03-20 12:23:41 +0100
committerJan Holesovsky <kendy@collabora.com>2016-03-23 10:05:05 +0000
commitdc1d837bdd7d006b1bc217d01e5cb4470037c67f (patch)
tree07c1eadb78e6828e10a0ee8200fcb1e8884dc032
parenta41b4325fc9ccd8c5d0f95ea669e543553712eaf (diff)
tdf#98324 - PNG prints as black block with OpenGL - fixed
Now the correct color palette is used. Change-Id: Ice532091713788c7c6b380550c65e26bc4b76c74 Reviewed-on: https://gerrit.libreoffice.org/23377 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> (cherry picked from commit d0cfcb6f1afe4022b322988627d8dccc9e05acc3) Reviewed-on: https://gerrit.libreoffice.org/23401 Reviewed-by: Toma┼ż Vajngerl <quikee@gmail.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--vcl/inc/opengl/salbmp.hxx1
-rw-r--r--vcl/win/source/gdi/salgdi2.cxx12
2 files changed, 10 insertions, 3 deletions
diff --git a/vcl/inc/opengl/salbmp.hxx b/vcl/inc/opengl/salbmp.hxx
index 8917a5a234d5..15c0832885d3 100644
--- a/vcl/inc/opengl/salbmp.hxx
+++ b/vcl/inc/opengl/salbmp.hxx
@@ -87,6 +87,7 @@ public:
bool Create( const OpenGLTexture& rTex, long nX, long nY, long nWidth, long nHeight );
OpenGLTexture& GetTexture() const;
static rtl::Reference<OpenGLContext> GetBitmapContext();
+ const BitmapPalette& GetBitmapPalette() const { return maPalette; }
private:
diff --git a/vcl/win/source/gdi/salgdi2.cxx b/vcl/win/source/gdi/salgdi2.cxx
index 6f0e5d4a1eb9..6433921835fd 100644
--- a/vcl/win/source/gdi/salgdi2.cxx
+++ b/vcl/win/source/gdi/salgdi2.cxx
@@ -29,6 +29,7 @@
#include <win/salids.hrc>
#include <win/salgdi.h>
#include <win/salframe.h>
+#include <opengl/salbmp.hxx>
#include "vcl/salbtype.hxx"
#include "vcl/bmpacc.hxx"
@@ -36,7 +37,6 @@
#include "salgdiimpl.hxx"
#include "opengl/win/gdiimpl.hxx"
-
bool WinSalGraphics::supportsOperation( OutDevSupportType eType ) const
{
static bool bAllowForTest(true);
@@ -76,9 +76,15 @@ namespace
void convertToWinSalBitmap(SalBitmap& rSalBitmap, WinSalBitmap& rWinSalBitmap)
{
- BitmapBuffer* pRead = rSalBitmap.AcquireBuffer(BITMAP_READ_ACCESS);
+ BitmapPalette aBitmapPalette;
+ OpenGLSalBitmap* pGLSalBitmap = dynamic_cast<OpenGLSalBitmap*>(&rSalBitmap);
+ if (pGLSalBitmap != nullptr)
+ {
+ aBitmapPalette = pGLSalBitmap->GetBitmapPalette();
+ }
- rWinSalBitmap.Create(rSalBitmap.GetSize(), rSalBitmap.GetBitCount(), BitmapPalette());
+ BitmapBuffer* pRead = rSalBitmap.AcquireBuffer(BITMAP_READ_ACCESS);
+ rWinSalBitmap.Create(rSalBitmap.GetSize(), rSalBitmap.GetBitCount(), aBitmapPalette);
BitmapBuffer* pWrite = rWinSalBitmap.AcquireBuffer(BITMAP_WRITE_ACCESS);
sal_uInt8* pSource(pRead->mpBits);