[Libreoffice-commits] core.git: 6 commits - officecfg/registry vcl/inc vcl/opengl vcl/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Sun Aug 2 19:09:08 PDT 2015


 officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu |    4 
 vcl/inc/image.h                                              |    4 
 vcl/inc/opengl/salbmp.hxx                                    |    2 
 vcl/opengl/program.cxx                                       |    1 
 vcl/opengl/salbmp.cxx                                        |    7 +
 vcl/opengl/scale.cxx                                         |   52 +++++++++--
 vcl/source/gdi/impimage.cxx                                  |   19 ++--
 vcl/source/outdev/bitmap.cxx                                 |    4 
 8 files changed, 71 insertions(+), 22 deletions(-)

New commits:
commit d97cc94a02c00b912bbcb430cde55ce0cfb0292c
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Mon Aug 3 10:13:38 2015 +0900

    Apply MVP matrix when drawing texture using OpenGLProgram
    
    Change-Id: I1dc34eee645b77537517e147b86599cfe74f09a9

diff --git a/vcl/opengl/program.cxx b/vcl/opengl/program.cxx
index 157243b..3bfa6c2 100644
--- a/vcl/opengl/program.cxx
+++ b/vcl/opengl/program.cxx
@@ -278,6 +278,7 @@ bool OpenGLProgram::DrawTexture( OpenGLTexture& rTexture )
     rTexture.GetWholeCoord( aTexCoord );
     SetVertices( aPosition );
     SetTextureCoord( aTexCoord );
+    ApplyMatrix(fWidth, fHeight);
     glDrawArrays( GL_TRIANGLE_FAN, 0, 4 );
     CHECK_GL_ERROR();
 
commit f73e1f50240208257964e28e0e65a56e323d86da
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Fri Jul 31 16:46:47 2015 +0900

    opengl: support reading 8bit texture (fixes icon corruption)
    
    Change-Id: Iba3fd58374a550f3411b02f029f12f4509fb6048

diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index 405428e..6b6f7bc 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -368,7 +368,7 @@ GLuint OpenGLSalBitmap::CreateTexture()
         else
         {
             // convert to 32 bits RGBA using palette
-            pData = new sal_uInt8[ mnBufHeight * (mnBufWidth << 2) ];
+            pData = new sal_uInt8[mnBufHeight * mnBufWidth * 4];
             bAllocated = true;
             nFormat = GL_RGBA;
             nType = GL_UNSIGNED_BYTE;
@@ -424,13 +424,16 @@ bool OpenGLSalBitmap::ReadTexture()
     if( pData == NULL )
         return false;
 
-    if( mnBits == 16 || mnBits == 24 || mnBits == 32 )
+    if (mnBits == 8 || mnBits == 16 || mnBits == 24 || mnBits == 32)
     {
         // no conversion needed for truecolor
         pData = maUserBuffer.get();
 
         switch( mnBits )
         {
+        case 8:     nFormat = GL_LUMINANCE;
+                    nType = GL_UNSIGNED_BYTE;
+                    break;
         case 16:    nFormat = GL_RGB;
                     nType = GL_UNSIGNED_SHORT_5_6_5;
                     break;
commit f82d57830918dc1023c9b7e30c75b9da2608b35c
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Fri Jul 31 16:52:06 2015 +0900

    enable "Table Design" for sidebar in Draw too..
    
    Change-Id: I66da1e93a65fc592c0827774da2388f9a82531e4

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
index 3485154..56a7ec3 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
@@ -728,7 +728,7 @@
         </prop>
         <prop oor:name="ContextList">
           <value oor:separator=";">
-            Impress, Table, visible   ;
+            DrawImpress, Table, visible   ;
           </value>
         </prop>
         <prop oor:name="ImplementationURL" oor:type="xs:string">
commit 6d9ddfb9c7a946e9b9cc58ae2cebcf3a21a5bf22
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Fri Jul 31 16:31:29 2015 +0900

    opengl: when scaling, create a new texture with equal settings
    
    Change-Id: Id0258fe0db89aa06b91233ae2052f018d606cc74

diff --git a/vcl/inc/opengl/salbmp.hxx b/vcl/inc/opengl/salbmp.hxx
index daefbe2..8baee94 100644
--- a/vcl/inc/opengl/salbmp.hxx
+++ b/vcl/inc/opengl/salbmp.hxx
@@ -102,6 +102,8 @@ private:
     bool ImplScaleConvolution(const double& rScaleX, const double& rScaleY, const vcl::Kernel& rKernel);
     bool ImplScaleArea( double rScaleX, double rScaleY );
 
+    bool getFormatAndType(GLenum& nFormat, GLenum& nType);
+
 public:
 
     bool ImplScale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag );
diff --git a/vcl/opengl/scale.cxx b/vcl/opengl/scale.cxx
index 22db644..0b2d5cf 100644
--- a/vcl/opengl/scale.cxx
+++ b/vcl/opengl/scale.cxx
@@ -51,6 +51,31 @@ public:
     void GetSize( Size& rSize ) const SAL_OVERRIDE;
 };
 
+bool OpenGLSalBitmap::getFormatAndType(GLenum& nFormat, GLenum& nType)
+{
+    switch(mnBits)
+    {
+    case  8:
+        nFormat = GL_LUMINANCE;
+        nType = GL_UNSIGNED_BYTE;
+        break;
+    case 16:
+        nFormat = GL_RGB;
+        nType = GL_UNSIGNED_SHORT_5_6_5;
+        break;
+    case 24:
+        nFormat = GL_RGB;
+        nType = GL_UNSIGNED_BYTE;
+        break;
+    case 32:
+    default:
+        nFormat = GL_RGBA;
+        nType = GL_UNSIGNED_BYTE;
+        break;
+    }
+    return true;
+}
+
 bool OpenGLSalBitmap::ImplScaleFilter(
     const double& rScaleX,
     const double& rScaleY,
@@ -67,7 +92,11 @@ bool OpenGLSalBitmap::ImplScaleFilter(
     if( !pProgram )
         return false;
 
-    OpenGLTexture aNewTex = OpenGLTexture( nNewWidth, nNewHeight );
+    GLenum nFormat;
+    GLenum nType;
+    getFormatAndType(nFormat, nType);
+
+    OpenGLTexture aNewTex = OpenGLTexture(nNewWidth, nNewHeight, nFormat, nType, nullptr);
     pFramebuffer = mpContext->AcquireFramebuffer( aNewTex );
 
     pProgram->SetTexture( "sampler", maTexture );
@@ -146,10 +175,15 @@ bool OpenGLSalBitmap::ImplScaleConvolution(
     if( pProgram == 0 )
         return false;
 
+    GLenum nFormat;
+    GLenum nType;
+    getFormatAndType(nFormat, nType);
+
     // horizontal scaling in scratch texture
     if( mnWidth != nNewWidth )
     {
-        OpenGLTexture aScratchTex = OpenGLTexture( nNewWidth, mnHeight );
+        OpenGLTexture aScratchTex = OpenGLTexture(nNewWidth, mnHeight, nFormat, nType, nullptr);
+
         pFramebuffer = mpContext->AcquireFramebuffer( aScratchTex );
 
         for( sal_uInt32 i = 0; i < 16; i++ )
@@ -171,7 +205,8 @@ bool OpenGLSalBitmap::ImplScaleConvolution(
     // vertical scaling in final texture
     if( mnHeight != nNewHeight )
     {
-        OpenGLTexture aScratchTex = OpenGLTexture( nNewWidth, nNewHeight );
+        OpenGLTexture aScratchTex = OpenGLTexture(nNewWidth, nNewHeight, nFormat, nType, nullptr);
+
         pFramebuffer = mpContext->AcquireFramebuffer( aScratchTex );
 
         for( sal_uInt32 i = 0; i < 16; i++ )
@@ -231,7 +266,12 @@ bool OpenGLSalBitmap::ImplScaleArea( double rScaleX, double rScaleY )
     if( pProgram == 0 )
         return false;
 
-    OpenGLTexture aScratchTex = OpenGLTexture( nNewWidth, nNewHeight );
+    GLenum nFormat;
+    GLenum nType;
+    getFormatAndType(nFormat, nType);
+
+    OpenGLTexture aScratchTex = OpenGLTexture(nNewWidth, nNewHeight, nFormat, nType, nullptr);
+
     OpenGLFramebuffer* pFramebuffer = mpContext->AcquireFramebuffer( aScratchTex );
 
     // NOTE: This setup is also done in OpenGLSalGraphicsImpl::DrawTransformedTexture().
@@ -333,7 +373,9 @@ void ScaleOp::GetSize( Size& rSize ) const
 
 bool OpenGLSalBitmap::Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag )
 {
-    SAL_INFO( "vcl.opengl", "::Scale " << static_cast<int>(nScaleFlag) );
+    SAL_INFO("vcl.opengl", "::Scale " << int(nScaleFlag)
+             << " from " << mnWidth << "x" << mnHeight
+             << " to " << (mnWidth * rScaleX) << "x" << (mnHeight * rScaleY) );
 
     if( nScaleFlag == BmpScaleFlag::Fast ||
         nScaleFlag == BmpScaleFlag::BiLinear ||
commit 21f128623292b3d90f3b736f3c5c268a677e18ff
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Fri Jul 31 16:23:35 2015 +0900

    ImplImageBmp::Draw - nPos parameter is always 0
    
    Change-Id: Icbf228809e17e4114049e563468dececba04edde

diff --git a/vcl/inc/image.h b/vcl/inc/image.h
index 3aa9424..bc14262 100644
--- a/vcl/inc/image.h
+++ b/vcl/inc/image.h
@@ -35,7 +35,7 @@ public:
 
     void        Create( const BitmapEx& rBmpEx, long nItemWidth, long nItemHeight,sal_uInt16 nInitSize );
     void        ColorTransform();
-    void        Draw( sal_uInt16 nPos, OutputDevice* pDev, const Point& rPos, DrawImageFlags nStyle, const Size* pSize = NULL );
+    void        Draw( OutputDevice* pDev, const Point& rPos, DrawImageFlags nStyle, const Size* pSize = NULL );
 
 private:
 
@@ -47,7 +47,7 @@ private:
     sal_uInt16      mnSize;
 
     void        ImplUpdateDisplayBmp( OutputDevice* pOutDev );
-    void        ImplUpdateDisabledBmpEx( int nPos );
+    void        ImplUpdateDisabledBmpEx();
 
 private:
     ImplImageBmp( const ImplImageBmp& ) SAL_DELETED_FUNCTION;
diff --git a/vcl/source/gdi/impimage.cxx b/vcl/source/gdi/impimage.cxx
index 87b9bce..ef4410d 100644
--- a/vcl/source/gdi/impimage.cxx
+++ b/vcl/source/gdi/impimage.cxx
@@ -169,20 +169,20 @@ void ImplImageBmp::Create( const BitmapEx& rBmpEx, long nItemWidth, long nItemHe
             mnSize );
 }
 
-void ImplImageBmp::Draw( sal_uInt16 nPos, OutputDevice* pOutDev,
+void ImplImageBmp::Draw( OutputDevice* pOutDev,
                          const Point& rPos, DrawImageFlags nStyle,
                          const Size* pSize )
 {
     if( pOutDev->IsDeviceOutputNecessary() )
     {
-        const Point aSrcPos( nPos * maSize.Width(), 0 );
+        const Point aSrcPos(0, 0);
         Size        aOutSize;
 
         aOutSize = ( pSize ? *pSize : pOutDev->PixelToLogic( maSize ) );
 
         if( nStyle & DrawImageFlags::Disable )
         {
-            ImplUpdateDisabledBmpEx( nPos);
+            ImplUpdateDisabledBmpEx();
             pOutDev->DrawBitmapEx( rPos, aOutSize, aSrcPos, maSize, maDisabledBmpEx );
         }
         else
@@ -193,7 +193,7 @@ void ImplImageBmp::Draw( sal_uInt16 nPos, OutputDevice* pOutDev,
                 BitmapEx        aTmpBmpEx;
                 const Rectangle aCropRect( aSrcPos, maSize );
 
-                if( mpInfoAry[ nPos ] & ( IMPSYSIMAGEITEM_MASK | IMPSYSIMAGEITEM_ALPHA ) )
+                if( mpInfoAry[0] & ( IMPSYSIMAGEITEM_MASK | IMPSYSIMAGEITEM_ALPHA ) )
                     aTmpBmpEx = maBmpEx;
                 else
                     aTmpBmpEx = maBmpEx.GetBitmap();
@@ -347,7 +347,7 @@ pOutDev
     }
 }
 
-void ImplImageBmp::ImplUpdateDisabledBmpEx( int nPos )
+void ImplImageBmp::ImplUpdateDisabledBmpEx()
 {
     const Size aTotalSize( maBmpEx.GetSizePixel() );
 
@@ -357,7 +357,6 @@ void ImplImageBmp::ImplUpdateDisabledBmpEx( int nPos )
         AlphaMask   aGreyAlphaMask( aTotalSize );
 
         maDisabledBmpEx = BitmapEx( aGrey, aGreyAlphaMask );
-        nPos = -1;
     }
 
     Bitmap              aBmp( maBmpEx.GetBitmap() );
@@ -373,9 +372,11 @@ void ImplImageBmp::ImplUpdateDisabledBmpEx( int nPos )
     {
         BitmapColor aGreyVal( 0 );
         BitmapColor aGreyAlphaMaskVal( 0 );
-        const Point aPos( ( nPos < 0 ) ? 0 : ( nPos * maSize.Width() ), 0 );
-        const int  nLeft = aPos.X(), nRight = nLeft + ( ( nPos < 0 ) ? aTotalSize.Width() : maSize.Width() );
-        const int  nTop = aPos.Y(), nBottom = nTop + maSize.Height();
+
+        const int nLeft = 0;
+        const int nRight = nLeft + maSize.Width();
+        const int nTop = 0;
+        const int nBottom = nTop + maSize.Height();
 
         for( int nY = nTop; nY < nBottom; ++nY )
         {
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index bb72a37..aebc7df 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -1381,9 +1381,9 @@ void OutputDevice::DrawImage( const Point& rPos, const Size& rSize,
                 }
 
                 if ( bIsSizeValid )
-                    pData->mpImageBitmap->Draw( 0, this, rPos, nStyle, &rSize );
+                    pData->mpImageBitmap->Draw( this, rPos, nStyle, &rSize );
                 else
-                    pData->mpImageBitmap->Draw( 0, this, rPos, nStyle );
+                    pData->mpImageBitmap->Draw( this, rPos, nStyle );
             }
             break;
 
commit 8a323729e5755a26fd1726b0ac3159050fce8fe6
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Tue Jul 28 18:03:50 2015 +0900

    Change "Design" sidebar deck icon
    
    Change-Id: Ibb4a308cfae3598e4d4e9759806c48f6a581bc83

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
index 01e184b..3485154 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
@@ -216,7 +216,7 @@
           <value>DesignDeck</value>
         </prop>
         <prop oor:name="IconURL" oor:type="xs:string">
-          <value>private:graphicrepository/sfx2/res/symphony/sidebar-property-large.png</value>
+          <value>private:graphicrepository/cmd/lc_designerdialog.png</value>
         </prop>
         <prop oor:name="ContextList">
           <value oor:separator=";">


More information about the Libreoffice-commits mailing list