[Libreoffice-commits] core.git: cui/source

Caolán McNamara caolanm at redhat.com
Thu Mar 8 20:33:47 UTC 2018


 cui/source/dialogs/colorpicker.cxx |   46 ++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

New commits:
commit b18e2d80d7ed102645f7d6df75f521cd584c8a71
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 8 17:35:21 2018 +0000

    color picker behaviour changed
    
    since...
    
    commit db42098d99bd8648fcd7b6f669e3e5ad4142670a
    Date:   Fri Feb 9 10:47:48 2018 +0200
    
        use VirtualDevice in ColorFieldControl
    
        as part of moving use of BitmapWriteAccess inside of vcl/
    
    changing the radiobutton selected used to change the
    contents of the color picker widget, after that point it
    got locked to the original contents.
    
    Change-Id: I94c730f1868efc388cba7720364bc04a666d4fbd
    Reviewed-on: https://gerrit.libreoffice.org/50969
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx
index 2619fa1c6f3a..3557e1401f54 100644
--- a/cui/source/dialogs/colorpicker.cxx
+++ b/cui/source/dialogs/colorpicker.cxx
@@ -265,41 +265,41 @@ void ColorFieldControl::UpdateBitmap()
 {
     const Size aSize(GetOutputSizePixel());
 
+    if (mxBitmap && mxBitmap->GetOutputSizePixel() != aSize)
+        mxBitmap.disposeAndClear();
+
     const sal_Int32 nWidth = aSize.Width();
     const sal_Int32 nHeight = aSize.Height();
 
     if (nWidth == 0 || nHeight == 0)
         return;
 
-    if (mxBitmap && mxBitmap->GetOutputSizePixel() == aSize)
-        return;
-
-    mxBitmap.disposeAndClear();
-    mxBitmap = VclPtr<VirtualDevice>::Create();
-    mxBitmap->SetOutputSizePixel(aSize);
+    if (!mxBitmap)
+    {
+        mxBitmap = VclPtr<VirtualDevice>::Create();
+        mxBitmap->SetOutputSizePixel(aSize);
 
-    maRGB_Horiz.resize( nWidth );
-    maGrad_Horiz.resize( nWidth );
-    maPercent_Horiz.resize( nWidth );
+        maRGB_Horiz.resize( nWidth );
+        maGrad_Horiz.resize( nWidth );
+        maPercent_Horiz.resize( nWidth );
 
-    sal_uInt8* pRGB = maRGB_Horiz.data();
-    sal_uInt16* pGrad = maGrad_Horiz.data();
-    sal_uInt16* pPercent = maPercent_Horiz.data();
+        sal_uInt8* pRGB = maRGB_Horiz.data();
+        sal_uInt16* pGrad = maGrad_Horiz.data();
+        sal_uInt16* pPercent = maPercent_Horiz.data();
 
-    for( sal_Int32 x = 0; x < nWidth; x++ )
-    {
-        *pRGB++ = static_cast<sal_uInt8>((x * 256) / nWidth);
-        *pGrad++ = static_cast<sal_uInt16>((x * 359) / nWidth);
-        *pPercent++ = static_cast<sal_uInt16>((x * 100) / nWidth);
-    }
+        for( sal_Int32 x = 0; x < nWidth; x++ )
+        {
+            *pRGB++ = static_cast<sal_uInt8>((x * 256) / nWidth);
+            *pGrad++ = static_cast<sal_uInt16>((x * 359) / nWidth);
+            *pPercent++ = static_cast<sal_uInt16>((x * 100) / nWidth);
+        }
 
-    maRGB_Vert.resize(nHeight);
-    maPercent_Vert.resize(nHeight);
+        maRGB_Vert.resize(nHeight);
+        maPercent_Vert.resize(nHeight);
 
-    pRGB = maRGB_Vert.data();
-    pPercent = maPercent_Vert.data();
+        pRGB = maRGB_Vert.data();
+        pPercent = maPercent_Vert.data();
 
-    {
         sal_Int32 y = nHeight;
         while (y--)
         {


More information about the Libreoffice-commits mailing list