[Libreoffice-commits] core.git: include/vcl vcl/headless vcl/source

2021-04-08 Thread Mike Kaganski (via logerrit)
 include/vcl/BitmapTools.hxx   |6 +--
 vcl/headless/svpgdi.cxx   |9 ++---
 vcl/source/bitmap/BitmapTools.cxx |   65 +-
 3 files changed, 51 insertions(+), 29 deletions(-)

New commits:
commit 0766f7a6a976ec23c4aa0ab9dc9207e441b71be1
Author: Mike Kaganski 
AuthorDate: Mon Apr 5 00:06:02 2021 +0300
Commit: Stephan Bergmann 
CommitDate: Thu Apr 8 08:17:49 2021 +0200

Revert "Revert "Compute (un-)premultiply_table at compile time""

This reverts commit c2374d702b0e4b7a1828964faa528344a5a9ee17, since
VS 2019 is now the baseline.

Change-Id: I3790ba3046910de2fffd7584a589c70cee56de0f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113569
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/include/vcl/BitmapTools.hxx b/include/vcl/BitmapTools.hxx
index d7ce4be9e90f..fa7a43bc99a6 100644
--- a/include/vcl/BitmapTools.hxx
+++ b/include/vcl/BitmapTools.hxx
@@ -26,10 +26,10 @@ namespace com::sun::star::geometry { struct 
IntegerRectangle2D; }
 
 namespace vcl::bitmap {
 
-typedef sal_uInt8 (*lookup_table)[256];
+typedef std::array, 256> lookup_table;
 
-lookup_table VCL_DLLPUBLIC get_premultiply_table();
-lookup_table VCL_DLLPUBLIC get_unpremultiply_table();
+VCL_DLLPUBLIC lookup_table const & get_premultiply_table();
+VCL_DLLPUBLIC lookup_table const & get_unpremultiply_table();
 
 sal_uInt8 unpremultiply(sal_uInt8 c, sal_uInt8 a);
 sal_uInt8 premultiply(sal_uInt8 c, sal_uInt8 a);
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 9995d5a3b916..24eb3c9af741 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -2202,7 +2202,7 @@ void SvpSalGraphics::drawMask( const SalTwoRect& rTR,
 }
 sal_Int32 nStride;
 unsigned char *mask_data = aSurface.getBits(nStride);
-vcl::bitmap::lookup_table unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
+vcl::bitmap::lookup_table const & unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
 for (tools::Long y = rTR.mnSrcY ; y < rTR.mnSrcY + rTR.mnSrcHeight; ++y)
 {
 unsigned char *row = mask_data + (nStride*y);
@@ -2315,7 +2315,7 @@ Color SvpSalGraphics::getPixel( tools::Long nX, 
tools::Long nY )
 cairo_destroy(cr);
 
 cairo_surface_flush(target);
-vcl::bitmap::lookup_table unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
+vcl::bitmap::lookup_table const & unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
 unsigned char *data = cairo_image_surface_get_data(target);
 sal_uInt8 a = data[SVP_CAIRO_ALPHA];
 sal_uInt8 b = unpremultiply_table[a][data[SVP_CAIRO_BLUE]];
@@ -2582,8 +2582,9 @@ void SvpSalGraphics::releaseCairoContext(cairo_t* cr, 
bool bXorModeAllowed, cons
 sal_Int32 nUnscaledExtentsRight = nExtentsRight * m_fScale;
 sal_Int32 nUnscaledExtentsTop = nExtentsTop * m_fScale;
 sal_Int32 nUnscaledExtentsBottom = nExtentsBottom * m_fScale;
-vcl::bitmap::lookup_table unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
-vcl::bitmap::lookup_table premultiply_table = 
vcl::bitmap::get_premultiply_table();
+vcl::bitmap::lookup_table const & unpremultiply_table
+= vcl::bitmap::get_unpremultiply_table();
+vcl::bitmap::lookup_table const & premultiply_table = 
vcl::bitmap::get_premultiply_table();
 for (sal_Int32 y = nUnscaledExtentsTop; y < nUnscaledExtentsBottom; 
++y)
 {
 unsigned char *true_row = target_surface_data + (nStride*y);
diff --git a/vcl/source/bitmap/BitmapTools.cxx 
b/vcl/source/bitmap/BitmapTools.cxx
index 8bd24f1d5706..d963bb3bb85b 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -8,6 +8,11 @@
  *
  */
 
+#include 
+
+#include 
+#include 
+
 #include 
 
 #include 
@@ -284,7 +289,7 @@ BitmapEx* CreateFromCairoSurface(Size aSize, 
cairo_surface_t * pSurface)
 cairo_surface_flush(pPixels);
 unsigned char *pSrc = cairo_image_surface_get_data( pPixels );
 unsigned int nStride = cairo_image_surface_get_stride( pPixels );
-vcl::bitmap::lookup_table unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
+vcl::bitmap::lookup_table const & unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
 for( tools::Long y = 0; y < aSize.Height(); y++ )
 {
 sal_uInt32 *pPix = reinterpret_cast(pSrc + nStride * y);
@@ -716,7 +721,7 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, 
Bitmap & aBitmap, un
 ::Color aColor;
 unsigned int nAlpha = 255;
 
-vcl::bitmap::lookup_table premultiply_table = 
vcl::bitmap::get_premultiply_table();
+vcl::bitmap::lookup_table const & premultiply_table = 
vcl::bitmap::get_premultiply_table();
 for( nY = 0; nY < nHeight; nY++ )
 {
 ::Scanline pReadScan;
@@ -1036,44 +1041,60 @@ void CanvasCairoExtractBitmapData( BitmapEx const & 
aBmpEx, Bitmap & aBitmap, un
 }

[Libreoffice-commits] core.git: include/vcl vcl/headless vcl/source

2018-12-05 Thread Libreoffice Gerrit user
 include/vcl/BitmapTools.hxx   |6 +--
 vcl/headless/svpgdi.cxx   |9 ++---
 vcl/source/bitmap/BitmapTools.cxx |   59 +++---
 3 files changed, 31 insertions(+), 43 deletions(-)

New commits:
commit c2374d702b0e4b7a1828964faa528344a5a9ee17
Author: Stephan Bergmann 
AuthorDate: Wed Dec 5 13:09:46 2018 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Dec 5 17:06:00 2018 +0100

Revert "Compute (un-)premultiply_table at compile time"

This reverts commit 644188bf7f3a07222f2b58a3794348197fb8ad24.  It has been 
found
to cause compilation failure ("vcl/source/bitmap/BitmapTools.cxx(1078): 
error
C2131: expression did not evaluate to a constant") with Visual Studio 2017
version 15.9, as discussed in the mail thread starting at


"Windows build failure - C2131: expression did not evaluate to a constant" 
(and
Mike thankfully filed a bug upstream,
).  Also, Jenkins 
node
tb39 which runs the "Gerrit Windows" sub-job of Jenkins' "Gerrit for master"
job apparently has such a Visual Studio 2017 version 15.9 installed, so 
keeps
failing that job.

Change-Id: I87d25863f2e07474fbb2df3c8f72cd2bcc89582e
Reviewed-on: https://gerrit.libreoffice.org/64618
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/include/vcl/BitmapTools.hxx b/include/vcl/BitmapTools.hxx
index c952498c5c58..ff431783ad24 100644
--- a/include/vcl/BitmapTools.hxx
+++ b/include/vcl/BitmapTools.hxx
@@ -28,10 +28,10 @@ namespace com { namespace sun { namespace star { namespace 
geometry { struct Int
 namespace vcl {
 namespace bitmap {
 
-typedef std::array, 256> lookup_table;
+typedef sal_uInt8 (*lookup_table)[256];
 
-VCL_DLLPUBLIC lookup_table const & get_premultiply_table();
-VCL_DLLPUBLIC lookup_table const & get_unpremultiply_table();
+lookup_table VCL_DLLPUBLIC get_premultiply_table();
+lookup_table VCL_DLLPUBLIC get_unpremultiply_table();
 
 /**
  * Intended to be used to feed into CreateFromData to create a BitmapEx. RGB 
data format.
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 0a428545f8b3..0b4bd8d377ea 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -1654,7 +1654,7 @@ void SvpSalGraphics::drawMask( const SalTwoRect& rTR,
 }
 sal_Int32 nStride;
 unsigned char *mask_data = aSurface.getBits(nStride);
-vcl::bitmap::lookup_table const & unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
+vcl::bitmap::lookup_table unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
 for (long y = rTR.mnSrcY ; y < rTR.mnSrcY + rTR.mnSrcHeight; ++y)
 {
 unsigned char *row = mask_data + (nStride*y);
@@ -1762,7 +1762,7 @@ Color SvpSalGraphics::getPixel( long nX, long nY )
 cairo_destroy(cr);
 
 cairo_surface_flush(target);
-vcl::bitmap::lookup_table const & unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
+vcl::bitmap::lookup_table unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
 unsigned char *data = cairo_image_surface_get_data(target);
 sal_uInt8 a = data[SVP_CAIRO_ALPHA];
 sal_uInt8 b = unpremultiply_table[a][data[SVP_CAIRO_BLUE]];
@@ -2096,9 +2096,8 @@ void SvpSalGraphics::releaseCairoContext(cairo_t* cr, 
bool bXorModeAllowed, cons
 sal_Int32 nUnscaledExtentsRight = nExtentsRight * m_fScale;
 sal_Int32 nUnscaledExtentsTop = nExtentsTop * m_fScale;
 sal_Int32 nUnscaledExtentsBottom = nExtentsBottom * m_fScale;
-vcl::bitmap::lookup_table const & unpremultiply_table
-= vcl::bitmap::get_unpremultiply_table();
-vcl::bitmap::lookup_table const & premultiply_table = 
vcl::bitmap::get_premultiply_table();
+vcl::bitmap::lookup_table unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
+vcl::bitmap::lookup_table premultiply_table = 
vcl::bitmap::get_premultiply_table();
 for (sal_Int32 y = nUnscaledExtentsTop; y < nUnscaledExtentsBottom; 
++y)
 {
 unsigned char *true_row = target_surface_data + (nStride*y);
diff --git a/vcl/source/bitmap/BitmapTools.cxx 
b/vcl/source/bitmap/BitmapTools.cxx
index f9095a86f541..4bac9745795e 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -8,11 +8,6 @@
  *
  */
 
-#include 
-
-#include 
-#include 
-
 #include 
 
 #include 
@@ -273,7 +268,7 @@ BitmapEx* CreateFromCairoSurface(Size aSize, 
cairo_surface_t * pSurface)
 cairo_surface_flush(pPixels);
 unsigned char *pSrc = cairo_image_surface_get_data( pPixels );
 unsigned int nStride = cairo_image_surface_get_stride( pPixels );
-vcl::bitmap::lookup_table const & unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
+

[Libreoffice-commits] core.git: include/vcl vcl/headless vcl/source

2018-12-02 Thread Libreoffice Gerrit user
 include/vcl/BitmapTools.hxx   |6 +--
 vcl/headless/svpgdi.cxx   |9 +++--
 vcl/source/bitmap/BitmapTools.cxx |   59 ++
 3 files changed, 43 insertions(+), 31 deletions(-)

New commits:
commit 644188bf7f3a07222f2b58a3794348197fb8ad24
Author: Stephan Bergmann 
AuthorDate: Sun Dec 2 16:50:22 2018 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Dec 3 07:53:30 2018 +0100

Compute (un-)premultiply_table at compile time

Change-Id: I34e624fcd5d11d02c26e775f5acdddec1fca9d87
Reviewed-on: https://gerrit.libreoffice.org/64428
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/include/vcl/BitmapTools.hxx b/include/vcl/BitmapTools.hxx
index ff431783ad24..c952498c5c58 100644
--- a/include/vcl/BitmapTools.hxx
+++ b/include/vcl/BitmapTools.hxx
@@ -28,10 +28,10 @@ namespace com { namespace sun { namespace star { namespace 
geometry { struct Int
 namespace vcl {
 namespace bitmap {
 
-typedef sal_uInt8 (*lookup_table)[256];
+typedef std::array, 256> lookup_table;
 
-lookup_table VCL_DLLPUBLIC get_premultiply_table();
-lookup_table VCL_DLLPUBLIC get_unpremultiply_table();
+VCL_DLLPUBLIC lookup_table const & get_premultiply_table();
+VCL_DLLPUBLIC lookup_table const & get_unpremultiply_table();
 
 /**
  * Intended to be used to feed into CreateFromData to create a BitmapEx. RGB 
data format.
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index c936b0e1cbbe..848d2e0f2b04 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -1654,7 +1654,7 @@ void SvpSalGraphics::drawMask( const SalTwoRect& rTR,
 }
 sal_Int32 nStride;
 unsigned char *mask_data = aSurface.getBits(nStride);
-vcl::bitmap::lookup_table unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
+vcl::bitmap::lookup_table const & unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
 for (long y = rTR.mnSrcY ; y < rTR.mnSrcY + rTR.mnSrcHeight; ++y)
 {
 unsigned char *row = mask_data + (nStride*y);
@@ -1762,7 +1762,7 @@ Color SvpSalGraphics::getPixel( long nX, long nY )
 cairo_destroy(cr);
 
 cairo_surface_flush(target);
-vcl::bitmap::lookup_table unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
+vcl::bitmap::lookup_table const & unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
 unsigned char *data = cairo_image_surface_get_data(target);
 sal_uInt8 a = data[SVP_CAIRO_ALPHA];
 sal_uInt8 b = unpremultiply_table[a][data[SVP_CAIRO_BLUE]];
@@ -2096,8 +2096,9 @@ void SvpSalGraphics::releaseCairoContext(cairo_t* cr, 
bool bXorModeAllowed, cons
 sal_Int32 nUnscaledExtentsRight = nExtentsRight * m_fScale;
 sal_Int32 nUnscaledExtentsTop = nExtentsTop * m_fScale;
 sal_Int32 nUnscaledExtentsBottom = nExtentsBottom * m_fScale;
-vcl::bitmap::lookup_table unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
-vcl::bitmap::lookup_table premultiply_table = 
vcl::bitmap::get_premultiply_table();
+vcl::bitmap::lookup_table const & unpremultiply_table
+= vcl::bitmap::get_unpremultiply_table();
+vcl::bitmap::lookup_table const & premultiply_table = 
vcl::bitmap::get_premultiply_table();
 for (sal_Int32 y = nUnscaledExtentsTop; y < nUnscaledExtentsBottom; 
++y)
 {
 unsigned char *true_row = target_surface_data + (nStride*y);
diff --git a/vcl/source/bitmap/BitmapTools.cxx 
b/vcl/source/bitmap/BitmapTools.cxx
index 4bac9745795e..f9095a86f541 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -8,6 +8,11 @@
  *
  */
 
+#include 
+
+#include 
+#include 
+
 #include 
 
 #include 
@@ -268,7 +273,7 @@ BitmapEx* CreateFromCairoSurface(Size aSize, 
cairo_surface_t * pSurface)
 cairo_surface_flush(pPixels);
 unsigned char *pSrc = cairo_image_surface_get_data( pPixels );
 unsigned int nStride = cairo_image_surface_get_stride( pPixels );
-vcl::bitmap::lookup_table unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
+vcl::bitmap::lookup_table const & unpremultiply_table = 
vcl::bitmap::get_unpremultiply_table();
 for( unsigned long y = 0; y < static_cast(aSize.Height()); 
y++ )
 {
 sal_uInt32 *pPix = reinterpret_cast(pSrc + nStride * y);
@@ -727,7 +732,7 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, 
Bitmap & aBitmap, un
 ::Color aColor;
 unsigned int nAlpha = 255;
 
-vcl::bitmap::lookup_table premultiply_table = 
vcl::bitmap::get_premultiply_table();
+vcl::bitmap::lookup_table const & premultiply_table = 
vcl::bitmap::get_premultiply_table();
 for( nY = 0; nY < nHeight; nY++ )
 {
 ::Scanline pReadScan;
@@ -1046,45 +1051,51 @@ void CanvasCairoExtractBitmapData( BitmapEx const & 
aBmpEx, Bitmap & aBitmap, un
 return bRet;
 }
 
-static sal_uInt8 unpremultiply(sal_uInt8 c, sal_uInt8 a)
+static constexpr sal_uInt8 

[Libreoffice-commits] core.git: include/vcl vcl/headless vcl/source

2017-11-15 Thread Pranav Kant
 include/vcl/dialog.hxx   |1 +
 vcl/headless/svpinst.cxx |2 +-
 vcl/source/control/edit.cxx  |   14 ++
 vcl/source/window/dialog.cxx |   10 ++
 4 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit a088f9e729084f950ee58afb8f80e64d4d134144
Author: Pranav Kant 
Date:   Tue Nov 14 16:00:57 2017 +0530

lokdialog: Callback for dialog cursor invalidation

Change-Id: Iecadb68737ed7b1a425d9ea633976fb24d1055c6
Reviewed-on: https://gerrit.libreoffice.org/44721
Tested-by: Jenkins 
Reviewed-by: pranavk 

diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index 92d9138e3e8f..48ae4fec43fd 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -97,6 +97,7 @@ public:
 
 void LOKKeyInput(const KeyEvent& rKeyEvent);
 void LOKKeyUp(const KeyEvent& rKeyEvent);
+void LOKCursorInvalidate(const tools::Rectangle& rRect);
 
 protected:
 explicitDialog( WindowType nType );
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index e20592b51b67..9912186c729c 100644
--- a/vcl/headless/svpinst.cxx
+++ b/vcl/headless/svpinst.cxx
@@ -266,7 +266,7 @@ bool SvpSalInstance::DoYield(bool bWait, bool 
bHandleAllCurrentEvents)
 {
 // first, process current user events
 bool bEvent = DispatchUserEvents( bHandleAllCurrentEvents );
-if ( !bHandleAllCurrentEvents & )
+if ( !bHandleAllCurrentEvents && bEvent )
 return true;
 
 bEvent = CheckTimeout() || bEvent;
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 8edf98b274e1..cf8a153ee256 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -17,6 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
+
 #include 
 #include 
 #include 
@@ -1143,6 +1145,18 @@ void Edit::ImplShowCursor( bool bOnlyIfVisible )
 pCursor->SetSize( Size( nCursorWidth, nTextHeight ) );
 pCursor->Show();
 }
+
+if (comphelper::LibreOfficeKit::isActive())
+{
+const long X = GetOutOffXPixel() + pCursor->GetPos().X();
+const long Y = GetOutOffYPixel() + pCursor->GetPos().Y();
+if (nCursorWidth == 0)
+nCursorWidth = 2;
+const tools::Rectangle aRect(Point(X, Y), Size(nCursorWidth, 
pCursor->GetHeight()));
+Dialog* pParentDlg = GetParentDialog();
+if (pParentDlg)
+pParentDlg->LOKCursorInvalidate(aRect);
+}
 }
 
 void Edit::ImplAlign()
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index a409bdc6e126..8e6d5f101012 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1015,6 +1015,16 @@ void Dialog::LOKKeyUp(const KeyEvent& rKeyEvent)
 ImplWindowFrameProc(this, SalEvent::ExternalKeyUp, );
 }
 
+void Dialog::LOKCursorInvalidate(const tools::Rectangle& aRect)
+{
+assert(comphelper::LibreOfficeKit::isActive());
+
+if (!comphelper::LibreOfficeKit::isDialogPainting() && mpDialogRenderable 
&& !maID.isEmpty())
+{
+mpDialogRenderable->notifyDialog(maID, "cursor_invalidate", );
+}
+}
+
 void Dialog::ensureRepaint()
 {
 // ensure repaint
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits