[Libreoffice-commits] core.git: Branch 'feature/fixes14' - vcl/opengl vcl/source vcl/workben
Michael Meeks
michael.meeks at collabora.com
Mon Feb 8 23:26:57 UTC 2016
vcl/opengl/greyscaleFragmentShader.glsl | 2 +-
vcl/opengl/salbmp.cxx | 18 +++---------------
vcl/source/gdi/bitmap3.cxx | 2 --
vcl/workben/vcldemo.cxx | 13 +++++++++++++
4 files changed, 17 insertions(+), 18 deletions(-)
New commits:
commit 22f3c65eab410f0548904661948cf37f88a57eb6
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Mon Feb 8 23:09:13 2016 +0000
Convert cleanups - avoid converting already converted bitmaps.
Change-Id: I4cb79dc3b798e301c31c8440a1d1210d7bbdfc4b
diff --git a/vcl/opengl/greyscaleFragmentShader.glsl b/vcl/opengl/greyscaleFragmentShader.glsl
index 5117c488..758109e 100644
--- a/vcl/opengl/greyscaleFragmentShader.glsl
+++ b/vcl/opengl/greyscaleFragmentShader.glsl
@@ -12,7 +12,7 @@ uniform sampler2D sampler;
void main() {
vec4 texel = texture2D(sampler, tex_coord);
- gl_FragColor = vec4(vec3(dot(texel.rgb, vec3(0.302, 0.592, 0.109))), 1.0);
+ gl_FragColor = vec4(vec3(dot(texel.rgb, vec3(0.301, 0.591, 0.108))), 1.0);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index 6eaced6..30f1022 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -903,7 +903,8 @@ bool OpenGLSalBitmap::ConvertToGreyscale()
{
VCL_GL_INFO("::ConvertToGreyscale");
- if (false)
+ // avoid re-converting to 8bits.
+ if ( mnBits == 8 && maPalette == Bitmap::GetGreyPalette(256) )
return false;
OpenGLZone aZone;
@@ -920,7 +921,6 @@ bool OpenGLSalBitmap::ConvertToGreyscale()
OpenGLTexture aNewTex(mnWidth, mnHeight);
pFramebuffer = xContext->AcquireFramebuffer(aNewTex);
- pProgram->ApplyMatrix(mnWidth, mnHeight);
pProgram->SetTexture("sampler", maTexture);
pProgram->DrawTexture(maTexture);
pProgram->Clean();
@@ -928,19 +928,7 @@ bool OpenGLSalBitmap::ConvertToGreyscale()
OpenGLContext::ReleaseFramebuffer( pFramebuffer );
maTexture = aNewTex;
mnBits = 8;
-
- static BitmapPalette aGreyPalette256;
- if (!aGreyPalette256.GetEntryCount())
- {
- aGreyPalette256.SetEntryCount(256);
-
- for (sal_uInt16 i = 0; i < 256; i++)
- {
- sal_uInt8 nValue = sal_uInt8(i);
- aGreyPalette256[i] = BitmapColor(nValue, nValue, nValue);
- }
- }
- maPalette = aGreyPalette256;
+ maPalette = Bitmap::GetGreyPalette(256);
CHECK_GL_ERROR();
return true;
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 30a4f92..b4f1000 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -259,8 +259,6 @@ bool Bitmap::Convert( BmpConversion eConversion )
{
ImplSetImpBitmap(pImpBmp);
SAL_INFO( "vcl.opengl", "Ref count: " << mpImpBmp->ImplGetRefCount() );
- //maPrefMapMode = MapMode(MAP_PIXEL);
- //maPrefSize = pImpBmp->ImplGetSize();
return true;
}
else
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index bfd29e5..b112e17 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -1068,6 +1068,19 @@ public:
aBelow.Move(0,aResult.GetSizePixel().Height());
rDev.DrawBitmapEx(aBelow, aResult);
+ // mini convert test.
+ aBelow.Move(aResult.GetSizePixel().Width()+4,0);
+ rDev.DrawBitmapEx(aBelow, aResult);
+
+ Bitmap aGrey = aSrc.GetBitmap();
+ aGrey.Convert(BMP_CONVERSION_8BIT_GREYS);
+ rDev.DrawBitmap(aBelow, aGrey);
+
+ aBelow.Move(aGrey.GetSizePixel().Width(),0);
+ BitmapEx aGreyMask(aSrc.GetBitmap(),
+ AlphaMask(aSrc.GetMask()));
+ rDev.DrawBitmapEx(aBelow, aGreyMask);
+
aLocation.Move(aSrc.GetSizePixel().Width()*6,0);
if (aLocation.X() > r.Right())
aLocation = Point(0,aLocation.Y()+aSrc.GetSizePixel().Height()*3+4);
More information about the Libreoffice-commits
mailing list