[Libreoffice-commits] core.git: Branch 'libreoffice-5-1-1' - 4 commits - vcl/opengl

Michael Meeks michael.meeks at collabora.com
Wed Feb 17 22:36:49 UTC 2016


 vcl/opengl/gdiimpl.cxx |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 751d6cbc16a010e3f8712da26bb8a1edaf93034b
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Wed Feb 17 21:28:17 2016 +0000

    Revert bits pushed to wrong branch.
    
    This reverts commit d60bbf190dd993827cda86862af6c58fdbb36e84.
    This reverts commit 17d91c85fe91b21cb77afa343c4f1217ea8081ed.

diff --git a/include/vcl/salnativewidgets.hxx b/include/vcl/salnativewidgets.hxx
index 0789270..8c1176a 100644
--- a/include/vcl/salnativewidgets.hxx
+++ b/include/vcl/salnativewidgets.hxx
@@ -288,12 +288,6 @@ public:
             case CTRL_RADIOBUTTON:
             case CTRL_LISTNODE:
             case CTRL_SLIDER:
-            // FIXME: these guys have complex state hidden in ImplControlValue
-            // structs which affects rendering, needs to be a and needs to be
-            // part of the key to our cache.
-            case CTRL_SPINBOX:
-            case CTRL_SPINBUTTONS:
-            case CTRL_TAB_ITEM:
                 return false;
 
             case CTRL_MENUBAR:
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index 11958cd..12a0b70 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -155,8 +155,7 @@ public:
     using Window::ImplInit;
 private:
     SAL_DLLPRIVATE void InvalidateItem(sal_uInt16 nPosition);
-    SAL_DLLPRIVATE void InvalidateSpin(bool bInvalidateUpper = true,
-                                       bool bInvalidateLower = true);
+    SAL_DLLPRIVATE void InvalidateSpin(bool bUpperIn, bool bLowerIn);
     SAL_DLLPRIVATE void InvalidateMenuButton();
 
     SAL_DLLPRIVATE void            ImplInit( vcl::Window* pParent, WinBits nStyle );
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index daf4b5f..5f86629 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -142,9 +142,8 @@ bool ImplDrawNativeSpinbuttons(vcl::RenderContext& rRenderContext, const Spinbut
 
     if (rRenderContext.IsNativeControlSupported(CTRL_SPINBUTTONS, PART_ENTIRE_CONTROL))
     {
-        Rectangle aArea = rSpinbuttonValue.maUpperRect.GetUnion(rSpinbuttonValue.maLowerRect);
         // only paint the standalone spin buttons, all buttons are painted at once
-        bNativeOK = rRenderContext.DrawNativeControl(CTRL_SPINBUTTONS, PART_ALL_BUTTONS, aArea,
+        bNativeOK = rRenderContext.DrawNativeControl(CTRL_SPINBUTTONS, PART_ALL_BUTTONS, Rectangle(),
                                                      ControlState::ENABLED, rSpinbuttonValue, OUString());
     }
     return bNativeOK;
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 62140e4..e0e8492 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -3455,7 +3455,8 @@ bool ToolBox::ImplHandleMouseMove( const MouseEvent& rMEvt, bool bRepeat )
         if ( bNewIn != mbIn )
         {
             mbIn = bNewIn;
-            InvalidateSpin(true, false);
+            Invalidate();
+            InvalidateSpin(mbIn, false);
         }
         return true;
     }
@@ -3466,7 +3467,7 @@ bool ToolBox::ImplHandleMouseMove( const MouseEvent& rMEvt, bool bRepeat )
         if ( bNewIn != mbIn )
         {
             mbIn = bNewIn;
-            InvalidateSpin(false, true);
+            InvalidateSpin(false, mbIn);
         }
         return true;
     }
@@ -3581,7 +3582,7 @@ bool ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, bool bCancel )
         mbUpper = false;
         mbLower = false;
         mbIn    = false;
-        InvalidateSpin();
+        InvalidateSpin(false, false);
         return true;
     }
 
@@ -4483,7 +4484,7 @@ void ToolBox::Command( const CommandEvent& rCEvt )
                     ShowLine( false );
                 else if ( (mnCurLine+mnVisLines-1 < mnCurLines) && (pData->GetDelta() < 0) )
                     ShowLine( true );
-                InvalidateSpin();
+                InvalidateSpin(false, false);
                 return;
             }
         }
@@ -5192,7 +5193,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt )
                     mnCurLine = 1;
                 mbFormat = true;
                 ImplFormat();
-                InvalidateSpin();
+                InvalidateSpin(false, false);
                 ImplChangeHighlight( ImplGetFirstValidItem( mnCurLine ) );
             }
         break;
@@ -5205,7 +5206,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt )
                     mnCurLine = mnCurLines;
                 mbFormat = true;
                 ImplFormat();
-                InvalidateSpin();
+                InvalidateSpin(false, false);
                 ImplChangeHighlight( ImplGetFirstValidItem( mnCurLine ) );
             }
         break;
commit 17d91c85fe91b21cb77afa343c4f1217ea8081ed
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Wed Feb 17 21:05:50 2016 +0000

    tdf#97922 - Mend nonsensical spin invalidation to improve rendering.
    
    InvalidateSpin(false,false) - did exactly nothing; but now re-renders
    the toolbox up/down spin buttons for a much cleaner effect.
    
    Change-Id: I3a398c47c69cc292a681ebe2414d844c224f3e3e

diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index 12a0b70..11958cd 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -155,7 +155,8 @@ public:
     using Window::ImplInit;
 private:
     SAL_DLLPRIVATE void InvalidateItem(sal_uInt16 nPosition);
-    SAL_DLLPRIVATE void InvalidateSpin(bool bUpperIn, bool bLowerIn);
+    SAL_DLLPRIVATE void InvalidateSpin(bool bInvalidateUpper = true,
+                                       bool bInvalidateLower = true);
     SAL_DLLPRIVATE void InvalidateMenuButton();
 
     SAL_DLLPRIVATE void            ImplInit( vcl::Window* pParent, WinBits nStyle );
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index e0e8492..62140e4 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -3455,8 +3455,7 @@ bool ToolBox::ImplHandleMouseMove( const MouseEvent& rMEvt, bool bRepeat )
         if ( bNewIn != mbIn )
         {
             mbIn = bNewIn;
-            Invalidate();
-            InvalidateSpin(mbIn, false);
+            InvalidateSpin(true, false);
         }
         return true;
     }
@@ -3467,7 +3466,7 @@ bool ToolBox::ImplHandleMouseMove( const MouseEvent& rMEvt, bool bRepeat )
         if ( bNewIn != mbIn )
         {
             mbIn = bNewIn;
-            InvalidateSpin(false, mbIn);
+            InvalidateSpin(false, true);
         }
         return true;
     }
@@ -3582,7 +3581,7 @@ bool ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, bool bCancel )
         mbUpper = false;
         mbLower = false;
         mbIn    = false;
-        InvalidateSpin(false, false);
+        InvalidateSpin();
         return true;
     }
 
@@ -4484,7 +4483,7 @@ void ToolBox::Command( const CommandEvent& rCEvt )
                     ShowLine( false );
                 else if ( (mnCurLine+mnVisLines-1 < mnCurLines) && (pData->GetDelta() < 0) )
                     ShowLine( true );
-                InvalidateSpin(false, false);
+                InvalidateSpin();
                 return;
             }
         }
@@ -5193,7 +5192,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt )
                     mnCurLine = 1;
                 mbFormat = true;
                 ImplFormat();
-                InvalidateSpin(false, false);
+                InvalidateSpin();
                 ImplChangeHighlight( ImplGetFirstValidItem( mnCurLine ) );
             }
         break;
@@ -5206,7 +5205,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt )
                     mnCurLine = mnCurLines;
                 mbFormat = true;
                 ImplFormat();
-                InvalidateSpin(false, false);
+                InvalidateSpin();
                 ImplChangeHighlight( ImplGetFirstValidItem( mnCurLine ) );
             }
         break;
commit d60bbf190dd993827cda86862af6c58fdbb36e84
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Wed Feb 17 20:42:52 2016 +0000

    tdf#97922 - get control area right for spinbuttons.
    
    Also avoid caching both spin-buttons and some other complex types.
    The cache key needs to be able to include more state.
    
    Change-Id: I8eff6b1c5c51d27afb796cae66b45390433138b4

diff --git a/include/vcl/salnativewidgets.hxx b/include/vcl/salnativewidgets.hxx
index 8c1176a..0789270 100644
--- a/include/vcl/salnativewidgets.hxx
+++ b/include/vcl/salnativewidgets.hxx
@@ -288,6 +288,12 @@ public:
             case CTRL_RADIOBUTTON:
             case CTRL_LISTNODE:
             case CTRL_SLIDER:
+            // FIXME: these guys have complex state hidden in ImplControlValue
+            // structs which affects rendering, needs to be a and needs to be
+            // part of the key to our cache.
+            case CTRL_SPINBOX:
+            case CTRL_SPINBUTTONS:
+            case CTRL_TAB_ITEM:
                 return false;
 
             case CTRL_MENUBAR:
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 5f86629..daf4b5f 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -142,8 +142,9 @@ bool ImplDrawNativeSpinbuttons(vcl::RenderContext& rRenderContext, const Spinbut
 
     if (rRenderContext.IsNativeControlSupported(CTRL_SPINBUTTONS, PART_ENTIRE_CONTROL))
     {
+        Rectangle aArea = rSpinbuttonValue.maUpperRect.GetUnion(rSpinbuttonValue.maLowerRect);
         // only paint the standalone spin buttons, all buttons are painted at once
-        bNativeOK = rRenderContext.DrawNativeControl(CTRL_SPINBUTTONS, PART_ALL_BUTTONS, Rectangle(),
+        bNativeOK = rRenderContext.DrawNativeControl(CTRL_SPINBUTTONS, PART_ALL_BUTTONS, aArea,
                                                      ControlState::ENABLED, rSpinbuttonValue, OUString());
     }
     return bNativeOK;
commit 758d20d2ab1664116101362a5cb6a5d02ba55ce8
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Thu Feb 11 15:57:27 2016 +0100

    tdf#97715 fix inv. scale calculation in DrawTransformedTexture
    
    When image was rotated towards 90 degree the ixscale and iyscale
    went towards infinity. That caused problems in fragment shader
    areaScaleFastFragmentShader. The problem was with calculation
    of destination width and height which didn't take rotation
    into account correctly. This commit takes this calculation
    from WinSalGraphicsImpl::drawTransformedBitmap.
    
    also:
    
    tdf#97763 - avoid divide by zero for scaling images to tiny dimensions.
    
    Change-Id: I30f14a1ecda21ef167e58eda8e2fcef00bdfa2b7
    Reviewed-on: https://gerrit.libreoffice.org/22289
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 7bb2ae2..1480e2c 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -1069,8 +1069,17 @@ void OpenGLSalGraphicsImpl::DrawTransformedTexture(
     // If downscaling at a higher scale ratio, use the area scaling algorithm rather
     // than plain OpenGL's scaling, for better results.
     // See OpenGLSalBitmap::ImplScaleArea().
-    double ixscale = rTexture.GetWidth() / fabs( rX.getX() - rNull.getX());
-    double iyscale = rTexture.GetHeight() / fabs( rY.getY() - rNull.getY());
+
+    const long nDestWidth = basegfx::fround(basegfx::B2DVector(rX - rNull).getLength());
+    const long nDestHeight = basegfx::fround(basegfx::B2DVector(rY - rNull).getLength());
+
+    // Invisibly small images shouldn't divide by zero.
+    if( nDestHeight == 0 || nDestWidth == 0 )
+        return;
+
+    const double ixscale = rTexture.GetWidth()  / nDestWidth;
+    const double iyscale = rTexture.GetHeight() / nDestHeight;
+
     bool areaScaling = false;
     bool fastAreaScaling = false;
     OUString textureFragmentShader;


More information about the Libreoffice-commits mailing list