[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - 3 commits - vcl/headless vcl/inc vcl/opengl vcl/quartz vcl/source vcl/unx vcl/win

Louis-Francis Ratté-Boulianne lfrb at collabora.com
Mon Nov 3 19:56:26 PST 2014


 vcl/headless/svpbmp.cxx               |    5 +++
 vcl/inc/headless/svpbmp.hxx           |    2 +
 vcl/inc/impbmp.hxx                    |    3 +
 vcl/inc/opengl/salbmp.hxx             |    4 ++
 vcl/inc/openglgdiimpl.hxx             |   10 +++---
 vcl/inc/quartz/salbmp.h               |    2 +
 vcl/inc/salbmp.hxx                    |    2 +
 vcl/inc/unx/salbmp.h                  |    2 +
 vcl/inc/win/salbmp.h                  |    2 +
 vcl/opengl/gdiimpl.cxx                |   24 +++++++++------
 vcl/opengl/salbmp.cxx                 |   53 +++++++++++++++++++++++-----------
 vcl/opengl/textureFragmentShader.glsl |    4 +-
 vcl/opengl/textureVertexShader.glsl   |    2 -
 vcl/quartz/salbmp.cxx                 |    5 +++
 vcl/source/gdi/bitmap3.cxx            |    7 ++++
 vcl/source/gdi/impbmp.cxx             |    5 +++
 vcl/unx/generic/gdi/salbmp.cxx        |    5 +++
 vcl/win/source/gdi/salbmp.cxx         |    5 +++
 18 files changed, 108 insertions(+), 34 deletions(-)

New commits:
commit 169dfe186bb0a3fbb0148e07e8f751f2628edf56
Author: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
Date:   Mon Nov 3 22:52:43 2014 -0500

    vcl: Fix creation of textures and wrong format
    
    Change-Id: I9357b79b9f2e1e9506b83b40e35b882b4ee4cc37

diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index 391600a..12ef31c 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -34,7 +34,8 @@ static bool isValidBitCount( sal_uInt16 nBitCount )
 }
 
 OpenGLSalBitmap::OpenGLSalBitmap()
-: mnTexture(0)
+: mpContext(NULL)
+, mnTexture(0)
 , mbDirtyTexture(true)
 , mnBits(0)
 , mnBytesPerRow(0)
@@ -368,7 +369,12 @@ GLuint OpenGLSalBitmap::CreateTexture()
     if( !mnTexture )
         glGenTextures( 1, &mnTexture );
     glBindTexture( GL_TEXTURE_2D, mnTexture );
-    glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, mnWidth, mnHeight, 0, nFormat, nType, pData );
+    glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
+    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
+    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
+    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
+    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
+    glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, mnTexWidth, mnTexHeight, 0, nFormat, nType, pData );
     glBindTexture( GL_TEXTURE_2D, 0 );
 
     if( bAllocated )
@@ -473,12 +479,11 @@ BitmapBuffer* OpenGLSalBitmap::AcquireBuffer( bool /*bReadOnly*/ )
     case 16:    pBuffer->mnFormat = BMP_FORMAT_16BIT_TC_MSB_MASK;
                 pBuffer->maColorMask  = ColorMask( 0xf800, 0x07e0, 0x001f );
                 break;
-    case 24:    pBuffer->mnFormat = BMP_FORMAT_24BIT_TC_BGR; break;
-    case 32:    pBuffer->mnFormat = BMP_FORMAT_32BIT_TC_ARGB;
-                pBuffer->maColorMask  = ColorMask( 0x00ff0000, 0x0000ff00, 0x000000ff );
+    case 24:    pBuffer->mnFormat = BMP_FORMAT_24BIT_TC_RGB; break;
+    case 32:    pBuffer->mnFormat = BMP_FORMAT_32BIT_TC_RGBA;
+                pBuffer->maColorMask  = ColorMask( 0xff000000, 0x00ff0000, 0x0000ff00 );
                 break;
     }
-    // FIXME pBuffer->mnFormat |= BMP_FORMAT_BOTTOM_UP;
 
     return pBuffer;
 }
commit f98d18d22569b29e29380a8d3cd6ad367383006f
Author: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
Date:   Mon Nov 3 22:51:47 2014 -0500

    vcl: Remove some more extra colons
    
    Change-Id: Ic40607ae3cd96ebd9ad90bdbb4134cf80242c5cf

diff --git a/vcl/opengl/textureFragmentShader.glsl b/vcl/opengl/textureFragmentShader.glsl
index eb510d8..81d68c7 100644
--- a/vcl/opengl/textureFragmentShader.glsl
+++ b/vcl/opengl/textureFragmentShader.glsl
@@ -7,12 +7,12 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-precision mediump float;
+/* precision mediump float; */
 varying vec2 tex_coord;
 uniform sampler2D sampler;
 
 void main() {
    gl_FragColor = texture2D(sampler, tex_coord);
-};
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/opengl/textureVertexShader.glsl b/vcl/opengl/textureVertexShader.glsl
index 303ddec..99d7f37 100644
--- a/vcl/opengl/textureVertexShader.glsl
+++ b/vcl/opengl/textureVertexShader.glsl
@@ -14,6 +14,6 @@ varying vec2 tex_coord;
 void main() {
    gl_Position = position;
    tex_coord = tex_coord_in;
-};
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 9b799373b3cee92a086ed04dfba45d43b725987f
Author: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
Date:   Mon Nov 3 22:51:15 2014 -0500

    vcl: Allow SalBitmap implementation to do scaling
    
    Change-Id: If4431fb276c9c2629acbc95aeff2ef7c4a683d86

diff --git a/vcl/headless/svpbmp.cxx b/vcl/headless/svpbmp.cxx
index 3920aea..b5fcc24 100644
--- a/vcl/headless/svpbmp.cxx
+++ b/vcl/headless/svpbmp.cxx
@@ -339,6 +339,11 @@ bool SvpSalBitmap::GetSystemData( BitmapSystemData& )
     return false;
 }
 
+bool SvpSalBitmap::Scale( const double& /*rScaleX*/, const double& /*rScaleY*/, sal_uInt32 /*nScaleFlag*/ )
+{
+    return false;
+}
+
 sal_uInt32 SvpSalBitmap::getBitCountFromScanlineFormat( basebmp::Format nFormat )
 {
     sal_uInt32 nBitCount = 1;
diff --git a/vcl/inc/headless/svpbmp.hxx b/vcl/inc/headless/svpbmp.hxx
index aecf79c..3a0da2e 100644
--- a/vcl/inc/headless/svpbmp.hxx
+++ b/vcl/inc/headless/svpbmp.hxx
@@ -58,6 +58,8 @@ public:
     virtual void            ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ) SAL_OVERRIDE;
     virtual bool            GetSystemData( BitmapSystemData& rData ) SAL_OVERRIDE;
 
+    virtual bool            Scale( const double& rScaleX, const double& rScaleY, sal_uInt32 nScaleFlag ) SAL_OVERRIDE;
+
     static sal_uInt32 getBitCountFromScanlineFormat( basebmp::Format nFormat );
 };
 
diff --git a/vcl/inc/impbmp.hxx b/vcl/inc/impbmp.hxx
index c0eb805..f6663c5 100644
--- a/vcl/inc/impbmp.hxx
+++ b/vcl/inc/impbmp.hxx
@@ -60,6 +60,9 @@ public:
 
     inline void         ImplSetChecksum( sal_uLong nChecksum ) { mnChecksum = nChecksum; }
     inline sal_uLong    ImplGetChecksum() const { return mnChecksum; }
+
+
+    bool                ImplScale( const double& rScaleX, const double& rScaleY, sal_uInt32 nScaleFlag );
 };
 
 #endif // INCLUDED_VCL_INC_IMPBMP_HXX
diff --git a/vcl/inc/opengl/salbmp.hxx b/vcl/inc/opengl/salbmp.hxx
index 5661e56..74c0fda 100644
--- a/vcl/inc/opengl/salbmp.hxx
+++ b/vcl/inc/opengl/salbmp.hxx
@@ -44,6 +44,8 @@ private:
     sal_uInt16                      mnBytesPerRow;
     int                             mnWidth;
     int                             mnHeight;
+    int                             mnTexWidth;
+    int                             mnTexHeight;
 
 public:
     OpenGLSalBitmap();
@@ -70,6 +72,8 @@ public:
 
     bool            GetSystemData( BitmapSystemData& rData ) SAL_OVERRIDE;
 
+    bool            Scale( const double& rScaleX, const double& rScaleY, sal_uInt32 nScaleFlag ) SAL_OVERRIDE;
+
 public:
 
     bool            Create( OpenGLContext& rContext, long nX, long nY, long nWidth, long nHeight );
diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index 6643546..e8b8947 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -73,11 +73,11 @@ private:
     void DrawConvexPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry );
     void DrawRect( long nX, long nY, long nWidth, long nHeight );
     void DrawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry );
-    void DrawPolyPolygon( const basegfx::B2DPolyPolygon& pPolyPolygon );
-    void DrawTextureRect( const SalTwoRect& pPosAry );
-    void DrawTexture( GLuint nTexture, const SalTwoRect& pPosAry );
-    void DrawTextureWithMask( GLuint nTexture, GLuint nMask, const SalTwoRect& pPosAry );
-    void DrawMask( GLuint nMask, SalColor nMaskColor, const SalTwoRect& pPosAry );
+    void DrawPolyPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon );
+    void DrawTextureRect( const Size& rSize, const SalTwoRect& rPosAry );
+    void DrawTexture( GLuint nTexture, const Size& rSize, const SalTwoRect& rPosAry );
+    void DrawTextureWithMask( GLuint nTexture, GLuint nMask, const SalTwoRect& rPosAry );
+    void DrawMask( GLuint nMask, SalColor nMaskColor, const SalTwoRect& rPosAry );
 
 
 public:
diff --git a/vcl/inc/quartz/salbmp.h b/vcl/inc/quartz/salbmp.h
index cd94431..0bde5ad 100644
--- a/vcl/inc/quartz/salbmp.h
+++ b/vcl/inc/quartz/salbmp.h
@@ -79,6 +79,8 @@ public:
 
     bool            GetSystemData( BitmapSystemData& rData ) SAL_OVERRIDE;
 
+    bool            Scale( const double& rScaleX, const double& rScaleY, sal_uInt32 nScaleFlag ) SAL_OVERRIDE;
+
 private:
     // quartz helper
     bool            CreateContext();
diff --git a/vcl/inc/salbmp.hxx b/vcl/inc/salbmp.hxx
index d279715..227cc3f 100644
--- a/vcl/inc/salbmp.hxx
+++ b/vcl/inc/salbmp.hxx
@@ -54,6 +54,8 @@ public:
     virtual BitmapBuffer*   AcquireBuffer( bool bReadOnly ) = 0;
     virtual void            ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ) = 0;
     virtual bool            GetSystemData( BitmapSystemData& rData ) = 0;
+
+    virtual bool            Scale( const double& rScaleX, const double& rScaleY, sal_uInt32 nScaleFlag ) = 0;
 };
 
 #endif
diff --git a/vcl/inc/unx/salbmp.h b/vcl/inc/unx/salbmp.h
index f6cadaa..f3f0831 100644
--- a/vcl/inc/unx/salbmp.h
+++ b/vcl/inc/unx/salbmp.h
@@ -145,6 +145,8 @@ public:
     virtual BitmapBuffer*       AcquireBuffer( bool bReadOnly ) SAL_OVERRIDE;
     virtual void                ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ) SAL_OVERRIDE;
     virtual bool                GetSystemData( BitmapSystemData& rData ) SAL_OVERRIDE;
+
+    virtual bool                Scale( const double& rScaleX, const double& rScaleY, sal_uInt32 nScaleFlag ) SAL_OVERRIDE;
 };
 
 // - ImplSalDDB -
diff --git a/vcl/inc/win/salbmp.h b/vcl/inc/win/salbmp.h
index 0962fac..9038236 100644
--- a/vcl/inc/win/salbmp.h
+++ b/vcl/inc/win/salbmp.h
@@ -96,6 +96,8 @@ public:
     virtual BitmapBuffer*       AcquireBuffer( bool bReadOnly );
     virtual void                ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly );
     virtual bool                GetSystemData( BitmapSystemData& rData );
+
+    virtual bool                Scale( const double& rScaleX, const double& rScaleY, sal_uInt32 nScaleFlag );
 };
 
 #endif // INCLUDED_VCL_INC_WIN_SALBMP_H
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index d79bce0..4ee5f95 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -380,19 +380,24 @@ void OpenGLSalGraphicsImpl::DrawPolyPolygon( const basegfx::B2DPolyPolygon& pPol
     glDisableVertexAttribArray( GL_ATTRIB_POS );
 }
 
-void OpenGLSalGraphicsImpl::DrawTextureRect( const SalTwoRect& pPosAry )
+void OpenGLSalGraphicsImpl::DrawTextureRect( const Size& rSize, const SalTwoRect& rPosAry )
 {
-    GLushort aTexCoord[8];
+    GLfloat aTexCoord[8];
+
+    aTexCoord[0] = aTexCoord[2] = rPosAry.mnSrcX / (double) rSize.Width();
+    aTexCoord[4] = aTexCoord[6] = (rPosAry.mnSrcX + rPosAry.mnSrcWidth) / (double) rSize.Width();
+    aTexCoord[3] = aTexCoord[5] = rPosAry.mnSrcY / (double) rSize.Height();
+    aTexCoord[1] = aTexCoord[7] = (rPosAry.mnSrcY + rPosAry.mnSrcHeight) / (double) rSize.Height();
 
     glEnableVertexAttribArray( GL_ATTRIB_TEX );
-    glVertexAttribPointer( GL_ATTRIB_TEX, 2, GL_UNSIGNED_SHORT, GL_FALSE, 0, aTexCoord );
+    glVertexAttribPointer( GL_ATTRIB_TEX, 2, GL_FLOAT, GL_FALSE, 0, aTexCoord );
 
-    DrawRect( pPosAry.mnDestX, pPosAry.mnDestY, pPosAry.mnDestWidth, pPosAry.mnDestHeight );
+    DrawRect( rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnDestWidth, rPosAry.mnDestHeight );
 
     glDisableVertexAttribArray( GL_ATTRIB_TEX );
 }
 
-void OpenGLSalGraphicsImpl::DrawTexture( GLuint nTexture, const SalTwoRect& pPosAry )
+void OpenGLSalGraphicsImpl::DrawTexture( GLuint nTexture, const Size& rSize, const SalTwoRect& pPosAry )
 {
     if( mnTextureProgram == 0 )
     {
@@ -405,7 +410,7 @@ void OpenGLSalGraphicsImpl::DrawTexture( GLuint nTexture, const SalTwoRect& pPos
     glActiveTexture( GL_TEXTURE0 );
     glBindTexture( GL_TEXTURE_2D, nTexture );
 
-    DrawTextureRect( pPosAry );
+    DrawTextureRect( rSize, pPosAry );
 
     glBindTexture( GL_TEXTURE_2D, 0 );
     glUseProgram( 0 );
@@ -427,7 +432,7 @@ void OpenGLSalGraphicsImpl::DrawTextureWithMask( GLuint nTexture, GLuint nMask,
     glActiveTexture( GL_TEXTURE1 );
     glBindTexture( GL_TEXTURE_2D, nMask );
 
-    DrawTextureRect( pPosAry );
+    //DrawTextureRect( pPosAry );
 
     glActiveTexture( GL_TEXTURE1 );
     glBindTexture( GL_TEXTURE_2D, 0 );
@@ -450,7 +455,7 @@ void OpenGLSalGraphicsImpl::DrawMask( GLuint nMask, SalColor nMaskColor, const S
     glActiveTexture( GL_TEXTURE0 );
     glBindTexture( GL_TEXTURE_2D, nMask );
 
-    DrawTextureRect( pPosAry );
+    //DrawTextureRect( pPosAry );
 
     glActiveTexture( GL_TEXTURE0 );
     glBindTexture( GL_TEXTURE_2D, 0 );
@@ -665,10 +670,11 @@ void OpenGLSalGraphicsImpl::drawBitmap( const SalTwoRect& rPosAry, const SalBitm
 {
     const OpenGLSalBitmap& rBitmap = static_cast<const OpenGLSalBitmap&>(rSalBitmap);
     GLuint nTexture = rBitmap.GetTexture( maContext );
+    const Size aSize = rSalBitmap.GetSize();
 
     SAL_INFO( "vcl.opengl", "::drawBitmap" );
     maContext.makeCurrent();
-    DrawTexture( nTexture, rPosAry );
+    DrawTexture( nTexture, aSize, rPosAry );
 }
 
 void OpenGLSalGraphicsImpl::drawBitmap(
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index 5edeed8..391600a 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -40,6 +40,8 @@ OpenGLSalBitmap::OpenGLSalBitmap()
 , mnBytesPerRow(0)
 , mnWidth(0)
 , mnHeight(0)
+, mnTexWidth(0)
+, mnTexHeight(0)
 {
 }
 
@@ -56,8 +58,8 @@ bool OpenGLSalBitmap::Create( OpenGLContext& rContext, long nX, long nY, long nW
 
     mpContext = &rContext;
     mpContext->makeCurrent();
-    mnWidth = nWidth;
-    mnHeight = nHeight;
+    mnWidth = mnTexWidth = nWidth;
+    mnHeight = mnTexHeight = nHeight;
 
     // TODO Check the framebuffer configuration
     mnBits = 32;
@@ -79,8 +81,8 @@ bool OpenGLSalBitmap::Create( const Size& rSize, sal_uInt16 nBits, const BitmapP
         return false;
     maPalette = rBitmapPalette;
     mnBits = nBits;
-    mnWidth = rSize.Width();
-    mnHeight = rSize.Height();
+    mnWidth = mnTexWidth = rSize.Width();
+    mnHeight = mnTexHeight = rSize.Height();
     return false;
 }
 
@@ -101,6 +103,8 @@ bool OpenGLSalBitmap::Create( const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount
     if( isValidBitCount( nNewBitCount ) )
     {
         mnBits = nNewBitCount;
+        mnTexWidth = rSourceBitmap.mnTexWidth;
+        mnTexHeight = rSourceBitmap.mnTexHeight;
         mnWidth = rSourceBitmap.mnWidth;
         mnHeight = rSourceBitmap.mnHeight;
         maPalette = rSourceBitmap.maPalette;
@@ -330,7 +334,7 @@ GLuint OpenGLSalBitmap::CreateTexture()
         else
         {
             // convert to 32 bits RGBA using palette
-            pData = new sal_uInt8[ mnHeight * (mnWidth << 2) ];
+            pData = new sal_uInt8[ mnTexHeight * (mnTexWidth << 2) ];
             bAllocated = true;
             nFormat = GL_RGBA;
             nType = GL_UNSIGNED_BYTE;
@@ -339,12 +343,12 @@ GLuint OpenGLSalBitmap::CreateTexture()
             sal_uInt8* pSrcData = maUserBuffer.get();
             sal_uInt8* pDstData = pData;
 
-            sal_uInt32 nY = mnHeight;
+            sal_uInt32 nY = mnTexHeight;
             while( nY-- )
             {
                 pSrcFormat->StartLine( pSrcData );
 
-                sal_uInt32 nX = mnWidth;
+                sal_uInt32 nX = mnTexWidth;
                 while( nX-- )
                 {
                     const BitmapColor& c = pSrcFormat->ReadPixel();
@@ -416,18 +420,20 @@ bool OpenGLSalBitmap::ReadTexture()
     GLuint nFramebufferId, nRenderbufferDepthId, nRenderbufferColorId;
     sal_uInt8* pData = maUserBuffer.get();
 
+    // TODO Check mnTexWidth and mnTexHeight
+
     mpContext->makeCurrent();
-    OpenGLHelper::createFramebuffer( mnWidth, mnHeight, nFramebufferId,
+    OpenGLHelper::createFramebuffer( mnTexWidth, mnTexHeight, nFramebufferId,
         nRenderbufferDepthId, nRenderbufferColorId, true );
     glBindFramebuffer( GL_FRAMEBUFFER, nFramebufferId );
 
     aPosAry.mnSrcX = aPosAry.mnDestX = 0;
     aPosAry.mnSrcY = aPosAry.mnDestY = 0;
-    aPosAry.mnSrcWidth = aPosAry.mnDestWidth = mnWidth;
-    aPosAry.mnSrcHeight = aPosAry.mnDestHeight = mnHeight;
+    aPosAry.mnSrcWidth = aPosAry.mnDestWidth = mnTexWidth;
+    aPosAry.mnSrcHeight = aPosAry.mnDestHeight = mnTexHeight;
 
     DrawTexture( mnTexture, aPosAry );
-    glReadPixels( 0, 0, mnWidth, mnHeight, GL_RGBA, GL_UNSIGNED_BYTE, pData );
+    glReadPixels( 0, 0, mnTexWidth, mnTexHeight, GL_RGBA, GL_UNSIGNED_BYTE, pData );
 
     glBindFramebuffer( GL_FRAMEBUFFER, 0 );
     glDeleteFramebuffers( 1, &nFramebufferId );
@@ -518,4 +524,12 @@ bool OpenGLSalBitmap::GetSystemData( BitmapSystemData& /*rData*/ )
 #endif
 }
 
+bool OpenGLSalBitmap::Scale( const double& rScaleX, const double& rScaleY, sal_uInt32 nScaleFlag )
+{
+    SAL_INFO( "vcl.opengl", "::Scale" );
+    mnWidth *= rScaleX;
+    mnHeight *= rScaleY;
+    return true;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx
index a980510..c4cf2b0 100644
--- a/vcl/quartz/salbmp.cxx
+++ b/vcl/quartz/salbmp.cxx
@@ -963,4 +963,9 @@ bool QuartzSalBitmap::GetSystemData( BitmapSystemData& rData )
     return bRet;
 }
 
+bool QuartzSalBitmap::Scale( const double& /*rScaleX*/, const double& /*rScaleY*/, sal_uInt32 /*nScaleFlag*/ )
+{
+    return false;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index ece13a3..3437730 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -27,6 +27,7 @@
 
 #include <boost/scoped_array.hpp>
 
+#include <impbmp.hxx>
 #include <impoct.hxx>
 #include <impvect.hxx>
 
@@ -873,6 +874,12 @@ bool Bitmap::Scale( const double& rScaleX, const double& rScaleY, sal_uInt32 nSc
         bRetval = true;
     }
 
+    if( mpImpBmp && mpImpBmp->ImplScale( rScaleX, rScaleY, nScaleFlag ) )
+    {
+        // implementation specific scaling
+        return true;
+    }
+
     //fdo#33455
     //
     //If we start with a 1 bit image, then after scaling it in any mode except
diff --git a/vcl/source/gdi/impbmp.cxx b/vcl/source/gdi/impbmp.cxx
index 005a45e..1ee75d4 100644
--- a/vcl/source/gdi/impbmp.cxx
+++ b/vcl/source/gdi/impbmp.cxx
@@ -86,4 +86,9 @@ void ImpBitmap::ImplReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly )
         mnChecksum = 0;
 }
 
+bool ImpBitmap::ImplScale( const double& rScaleX, const double& rScaleY, sal_uInt32 nScaleFlag )
+{
+    return mpSalBitmap->Scale( rScaleX, rScaleY, nScaleFlag );
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index 8468b4d..9078de6 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -860,6 +860,11 @@ bool X11SalBitmap::GetSystemData( BitmapSystemData& rData )
     return false;
 }
 
+bool X11SalBitmap::Scale( const double& /*rScaleX*/, const double& /*rScaleY*/, sal_uInt32 /*nScaleFlag*/ )
+{
+    return false;
+}
+
 // - ImplSalDDB -
 
 ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable,
diff --git a/vcl/win/source/gdi/salbmp.cxx b/vcl/win/source/gdi/salbmp.cxx
index 9121444..0f8906c 100644
--- a/vcl/win/source/gdi/salbmp.cxx
+++ b/vcl/win/source/gdi/salbmp.cxx
@@ -1076,4 +1076,9 @@ bool WinSalBitmap::GetSystemData( BitmapSystemData& rData )
     return bRet;
 }
 
+bool WinSalBitmap::Scale( const double& /*rScaleX*/, const double& /*rScaleY*/, sal_uInt32 /*nScaleFlag*/ )
+{
+    return false;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list