[Libreoffice-commits] core.git: vcl/README.vars vcl/source

2017-05-24 Thread Miklos Vajna
 vcl/README.vars |1 
 vcl/source/filter/graphicfilter.cxx |   43 +---
 2 files changed, 41 insertions(+), 3 deletions(-)

New commits:
commit 0d860007d692f9fb15b5699b49c314eb72eae79b
Author: Miklos Vajna 
Date:   Wed May 24 10:08:25 2017 +0200

vcl: parallelize JPEG import from ImportGraphics()

Just the expensive, pixel reading part, not the bitmap creation, which
isn't thread-safe.

Change-Id: I3723d80aa29ee5f2e604800cb2061c59b0b0324d
Reviewed-on: https://gerrit.libreoffice.org/37978
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/README.vars b/vcl/README.vars
index e97cf0d80697..e5b6f7b1c0f8 100644
--- a/vcl/README.vars
+++ b/vcl/README.vars
@@ -20,6 +20,7 @@ VCL_DEBUG_DISABLE_PDFCOMPRESSION - disable compression in the 
PDF writer
 Bitmap
 --
 VCL_NO_THREAD_SCALE - disable threaded bitmap scale
+VCL_NO_THREAD_IMPORT - disable threaded bitmap import
 EMF_PLUS_DISABLE - use EMF rendering and ignore EMF+ specifics
 
 OpenGL
diff --git a/vcl/source/filter/graphicfilter.cxx 
b/vcl/source/filter/graphicfilter.cxx
index c5bab5cd8891..d7eb5d7f7a4b 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1336,10 +1337,44 @@ struct GraphicImportContext
 GraphicFilterImportFlags m_nImportFlags = GraphicFilterImportFlags::NONE;
 };
 
+/// Graphic import worker that gets executed on a thread.
+class GraphicImportTask : public comphelper::ThreadTask
+{
+GraphicImportContext& m_rContext;
+public:
+GraphicImportTask(const std::shared_ptr& pTag, 
GraphicImportContext& rContext);
+void doWork() override;
+/// Shared code between threaded and non-threaded version.
+static void doImport(GraphicImportContext& rContext);
+};
+
+GraphicImportTask::GraphicImportTask(const 
std::shared_ptr& pTag, GraphicImportContext& 
rContext)
+: comphelper::ThreadTask(pTag),
+  m_rContext(rContext)
+{
+}
+
+void GraphicImportTask::doWork()
+{
+GraphicImportTask::doImport(m_rContext);
+}
+
+void GraphicImportTask::doImport(GraphicImportContext& rContext)
+{
+if (!ImportJPEG(*rContext.m_pStream, *rContext.m_pGraphic, 
rContext.m_nImportFlags | GraphicFilterImportFlags::UseExistingBitmap, 
rContext.m_pAccess.get()))
+rContext.m_nStatus = GRFILTER_FILTERERROR;
+else
+rContext.m_eLinkType = GfxLinkType::NativeJpg;
+}
+
 void GraphicFilter::ImportGraphics(std::vector< std::shared_ptr >& 
rGraphics, const std::vector< std::shared_ptr >& rStreams)
 {
+static bool bThreads = !getenv("VCL_NO_THREAD_IMPORT");
 std::vector aContexts;
 aContexts.reserve(rStreams.size());
+comphelper::ThreadPool& rSharedPool = 
comphelper::ThreadPool::getSharedOptimalPool();
+std::shared_ptr pTag = 
comphelper::ThreadPool::createThreadTaskTag();
+
 for (const auto& pStream : rStreams)
 {
 aContexts.push_back(GraphicImportContext());
@@ -1374,10 +1409,10 @@ void GraphicFilter::ImportGraphics(std::vector< 
std::shared_ptr >& rGra
 Bitmap& rBitmap = 
const_cast(rContext.m_pGraphic->GetBitmapExRef().GetBitmapRef());
 rContext.m_pAccess = 
o3tl::make_unique(rBitmap);
 pStream->Seek(rContext.m_nStreamBegin);
-if (!ImportJPEG(*pStream, *rContext.m_pGraphic, 
rContext.m_nImportFlags | GraphicFilterImportFlags::UseExistingBitmap, 
rContext.m_pAccess.get()))
-rContext.m_nStatus = GRFILTER_FILTERERROR;
+if (bThreads)
+rSharedPool.pushTask(new GraphicImportTask(pTag, 
rContext));
 else
-rContext.m_eLinkType = GfxLinkType::NativeJpg;
+GraphicImportTask::doImport(rContext);
 }
 }
 else
@@ -1386,6 +1421,8 @@ void GraphicFilter::ImportGraphics(std::vector< 
std::shared_ptr >& rGra
 }
 }
 
+rSharedPool.waitUntilDone(pTag);
+
 // Process data after import.
 for (auto& rContext : aContexts)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/README.vars vcl/source

2017-02-01 Thread Khaled Hosny
 vcl/README.vars|2 ++
 vcl/source/font/PhysicalFontCollection.cxx |   11 +++
 2 files changed, 13 insertions(+)

New commits:
commit 55916dfc59f05537c4e6fece77aef3cc1dbef34c
Author: Khaled Hosny 
Date:   Wed Feb 1 10:32:32 2017 +0200

An env var to disable font lookup

To be used in layout tests.

Change-Id: I551b87786a4ad4ab34a22c458561109270fb4a31

diff --git a/vcl/README.vars b/vcl/README.vars
index e97d85d..e97cf0d 100644
--- a/vcl/README.vars
+++ b/vcl/README.vars
@@ -7,6 +7,8 @@ SAL_NO_NWF - disable native widgets
 SAL_FORCEDPI - force a specific DPI (gtk & gtk3 plugins only)
 SAL_FORCE_HC - force high-contrast mode
 
+SAL_NO_FONT_LOOKUP - disable font search and fallback and always use a 
hard-coded font name (for some unit tests)
+
 VCL_DOUBLEBUFFERING_AVOID_PAINT - don't paint the buffer, useful to see where 
we do direct painting
 VCL_DOUBLEBUFFERING_FORCE_ENABLE - enable double buffered painting
 VCL_DOUBLEBUFFERING_ENABLE - enable a safe subset of double buffered painting 
(currently in Writer, not in any other applications)
diff --git a/vcl/source/font/PhysicalFontCollection.cxx 
b/vcl/source/font/PhysicalFontCollection.cxx
index 49082a1..7682bc5 100644
--- a/vcl/source/font/PhysicalFontCollection.cxx
+++ b/vcl/source/font/PhysicalFontCollection.cxx
@@ -1003,6 +1003,17 @@ PhysicalFontFamily* 
PhysicalFontCollection::FindFontFamily( FontSelectPattern& r
 if( !Count() )
 return nullptr;
 
+if (getenv("SAL_NO_FONT_LOOKUP") != nullptr)
+{
+// Hard code the use of Liberation Sans and skip font search.
+sal_Int32 nIndex = 0;
+rFSD.maTargetName = GetNextFontToken(rFSD.GetFamilyName(), nIndex);
+rFSD.maSearchName = "liberationsans";
+PhysicalFontFamily* pFont = 
ImplFindFontFamilyBySearchName(rFSD.maSearchName);
+assert(pFont);
+return pFont;
+}
+
 bool bMultiToken = false;
 sal_Int32 nTokenPos = 0;
 OUString& aSearchName = rFSD.maSearchName; // TODO: get rid of reference
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/README.vars vcl/source

2016-11-02 Thread Khaled Hosny
 vcl/README.vars  |2 +-
 vcl/source/gdi/sallayout.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 8f2dd1df1d6cc94ebbc1149de72bc6d6dffa6533
Author: Khaled Hosny 
Date:   Wed Nov 2 23:52:06 2016 +0200

Revert "Revert "Enable the new text layout engine by default""

This reverts commit 3950166877bf1308f9e449992e20b558342af825.

Change-Id: Ie22a99885a23d44a9870fcd286bee4ccf10c53ac
Reviewed-on: https://gerrit.libreoffice.org/30505
Tested-by: Jenkins 
Reviewed-by: Khaled Hosny 

diff --git a/vcl/README.vars b/vcl/README.vars
index 10e6356..d50a03b 100644
--- a/vcl/README.vars
+++ b/vcl/README.vars
@@ -6,7 +6,7 @@ SAL_USE_VCLPLUGIN - use a VCL plugin
 SAL_NO_NWF - disable native widgets
 SAL_FORCEDPI - force a specific DPI (gtk & gtk3 plugins only)
 SAL_FORCE_HC - force high-contrast mode
-SAL_USE_COMMON_LAYOUT - use CommonSalLayout layout engine for text layout
+SAL_NO_COMMON_LAYOUT - disable CommonSalLayout layout engine for text layout
 
 VCL_DOUBLEBUFFERING_AVOID_PAINT - don't paint the buffer, useful to see where 
we do direct painting
 VCL_DOUBLEBUFFERING_FORCE_ENABLE - enable double buffered painting
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index b865ff9..2e09aaf 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -770,7 +770,7 @@ bool SalLayout::IsSpacingGlyph( sal_GlyphId nGlyph )
 
 bool SalLayout::UseCommonLayout()
 {
-static bool bUse = getenv("SAL_USE_COMMON_LAYOUT") != nullptr;
+static bool bUse = getenv("SAL_NO_COMMON_LAYOUT") == nullptr;
 return bUse;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/README.vars vcl/source

2016-10-31 Thread Khaled Hosny
 vcl/README.vars  |2 +-
 vcl/source/gdi/sallayout.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 3950166877bf1308f9e449992e20b558342af825
Author: Khaled Hosny 
Date:   Tue Nov 1 02:25:10 2016 +0200

Revert "Enable the new text layout engine by default"

This reverts commit d79f43d0bebbe7b1f8d68d50734737aea9fe839d.

Breaks MacOSX tinderbox, need to figure out why a totally unrelated test
is broken.

diff --git a/vcl/README.vars b/vcl/README.vars
index d50a03b..10e6356 100644
--- a/vcl/README.vars
+++ b/vcl/README.vars
@@ -6,7 +6,7 @@ SAL_USE_VCLPLUGIN - use a VCL plugin
 SAL_NO_NWF - disable native widgets
 SAL_FORCEDPI - force a specific DPI (gtk & gtk3 plugins only)
 SAL_FORCE_HC - force high-contrast mode
-SAL_NO_COMMON_LAYOUT - disable CommonSalLayout layout engine for text layout
+SAL_USE_COMMON_LAYOUT - use CommonSalLayout layout engine for text layout
 
 VCL_DOUBLEBUFFERING_AVOID_PAINT - don't paint the buffer, useful to see where 
we do direct painting
 VCL_DOUBLEBUFFERING_FORCE_ENABLE - enable double buffered painting
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 2e09aaf..b865ff9 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -770,7 +770,7 @@ bool SalLayout::IsSpacingGlyph( sal_GlyphId nGlyph )
 
 bool SalLayout::UseCommonLayout()
 {
-static bool bUse = getenv("SAL_NO_COMMON_LAYOUT") == nullptr;
+static bool bUse = getenv("SAL_USE_COMMON_LAYOUT") != nullptr;
 return bUse;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/README.vars vcl/source

2016-10-31 Thread Khaled Hosny
 vcl/README.vars  |2 +-
 vcl/source/gdi/sallayout.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit d79f43d0bebbe7b1f8d68d50734737aea9fe839d
Author: Khaled Hosny 
Date:   Mon Oct 31 16:53:50 2016 +0200

Enable the new text layout engine by default

The handful of bugs reported so far have been fixed, and I think it had
enough basic testing to show that it is usable and can be switched on
for wider testing.

We can always revert back to the old engine if needed before or even
during 5.3 series.

The environment variable SAL_NO_COMMON_LAYOUT can be set to disable it
at runtime.

Change-Id: If319a0161897ec676d3123595944a0401c67b63f
Reviewed-on: https://gerrit.libreoffice.org/30443
Reviewed-by: Khaled Hosny 
Tested-by: Khaled Hosny 

diff --git a/vcl/README.vars b/vcl/README.vars
index 10e6356..d50a03b 100644
--- a/vcl/README.vars
+++ b/vcl/README.vars
@@ -6,7 +6,7 @@ SAL_USE_VCLPLUGIN - use a VCL plugin
 SAL_NO_NWF - disable native widgets
 SAL_FORCEDPI - force a specific DPI (gtk & gtk3 plugins only)
 SAL_FORCE_HC - force high-contrast mode
-SAL_USE_COMMON_LAYOUT - use CommonSalLayout layout engine for text layout
+SAL_NO_COMMON_LAYOUT - disable CommonSalLayout layout engine for text layout
 
 VCL_DOUBLEBUFFERING_AVOID_PAINT - don't paint the buffer, useful to see where 
we do direct painting
 VCL_DOUBLEBUFFERING_FORCE_ENABLE - enable double buffered painting
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index b865ff9..2e09aaf 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -770,7 +770,7 @@ bool SalLayout::IsSpacingGlyph( sal_GlyphId nGlyph )
 
 bool SalLayout::UseCommonLayout()
 {
-static bool bUse = getenv("SAL_USE_COMMON_LAYOUT") != nullptr;
+static bool bUse = getenv("SAL_NO_COMMON_LAYOUT") == nullptr;
 return bUse;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/README.vars vcl/source

2016-10-06 Thread Miklos Vajna
 vcl/README.vars   |2 
 vcl/source/gdi/pdfwriter_impl.cxx |  187 +++---
 2 files changed, 97 insertions(+), 92 deletions(-)

New commits:
commit 4dfa3161896a0e045da3b5cf656ebd8f40044a46
Author: Miklos Vajna 
Date:   Thu Oct 6 14:12:02 2016 +0200

vcl: allow runtime disable/enable of pdf writer compression

Replace the DEBUG_DISABLE_PDFCOMPRESSION ifdef with a
VCL_DEBUG_DISABLE_PDFCOMPRESSION environment variable. The less build
configurations we have, the better, I guess.

Also remove the COMPRESS_PAGES define, which was exactly defined when
DEBUG_DISABLE_PDFCOMPRESSION wasn't.

Change-Id: Iaa5530317432e59dee0d3ea2cb606661e8283835

diff --git a/vcl/README.vars b/vcl/README.vars
index bf85485..e97d85d 100644
--- a/vcl/README.vars
+++ b/vcl/README.vars
@@ -13,6 +13,8 @@ VCL_DOUBLEBUFFERING_ENABLE - enable a safe subset of double 
buffered painting (c
 
 VCL_HIDE_WINDOWS - don't draw windows
 
+VCL_DEBUG_DISABLE_PDFCOMPRESSION - disable compression in the PDF writer
+
 Bitmap
 --
 VCL_NO_THREAD_SCALE - disable threaded bitmap scale
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 8a662bc..0d886e0 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -105,11 +105,7 @@
 
 using namespace vcl;
 
-#if (OSL_DEBUG_LEVEL < 3)
-#define COMPRESS_PAGES
-#else
-#define DEBUG_DISABLE_PDFCOMPRESSION // also do not compress streams
-#endif
+static bool g_bDebugDisableCompression = 
getenv("VCL_DEBUG_DISABLE_PDFCOMPRESSION");
 
 #if !defined(ANDROID) && !defined(IOS)
 // Is this length truly the maximum possible, or just a number that
@@ -1161,9 +1157,8 @@ void PDFWriterImpl::PDFPage::beginStream()
 aLine.append( " 0 obj\n<>\nstream\n" );
 if( ! m_pWriter->writeBuffer( aLine.getStr(), aLine.getLength() ) )
 return;
@@ -1172,17 +1167,15 @@ void PDFWriterImpl::PDFPage::beginStream()
 m_pWriter->m_aFile.close();
 m_pWriter->m_bOpen = false;
 }
-#if defined ( COMPRESS_PAGES ) && !defined ( DEBUG_DISABLE_PDFCOMPRESSION )
-m_pWriter->beginCompression();
-#endif
+if (!g_bDebugDisableCompression)
+m_pWriter->beginCompression();
 m_pWriter->checkAndEnableStreamEncryption( m_aStreamObjects.back() );
 }
 
 void PDFWriterImpl::PDFPage::endStream()
 {
-#if defined ( COMPRESS_PAGES ) && !defined ( DEBUG_DISABLE_PDFCOMPRESSION )
-m_pWriter->endCompression();
-#endif
+if (!g_bDebugDisableCompression)
+m_pWriter->endCompression();
 sal_uInt64 nEndStreamPos;
 if (osl::File::E_None != m_pWriter->m_aFile.getPos(nEndStreamPos))
 {
@@ -2094,40 +2087,40 @@ void PDFWriterImpl::emitComment( const char* pComment )
 
 bool PDFWriterImpl::compressStream( SvMemoryStream* pStream )
 {
-#ifndef DEBUG_DISABLE_PDFCOMPRESSION
-pStream->Seek( STREAM_SEEK_TO_END );
-sal_uLong nEndPos = pStream->Tell();
-pStream->Seek( STREAM_SEEK_TO_BEGIN );
-ZCodec aCodec( 0x4000, 0x4000 );
-SvMemoryStream aStream;
-aCodec.BeginCompression();
-aCodec.Write( aStream, static_cast(pStream->GetData()), 
nEndPos );
-aCodec.EndCompression();
-nEndPos = aStream.Tell();
-pStream->Seek( STREAM_SEEK_TO_BEGIN );
-aStream.Seek( STREAM_SEEK_TO_BEGIN );
-pStream->SetStreamSize( nEndPos );
-pStream->WriteBytes( aStream.GetData(), nEndPos );
-return true;
-#else
-(void)pStream;
-return false;
-#endif
+if (!g_bDebugDisableCompression)
+{
+pStream->Seek( STREAM_SEEK_TO_END );
+sal_uLong nEndPos = pStream->Tell();
+pStream->Seek( STREAM_SEEK_TO_BEGIN );
+ZCodec aCodec( 0x4000, 0x4000 );
+SvMemoryStream aStream;
+aCodec.BeginCompression();
+aCodec.Write( aStream, static_cast(pStream->GetData()), nEndPos );
+aCodec.EndCompression();
+nEndPos = aStream.Tell();
+pStream->Seek( STREAM_SEEK_TO_BEGIN );
+aStream.Seek( STREAM_SEEK_TO_BEGIN );
+pStream->SetStreamSize( nEndPos );
+pStream->WriteBytes( aStream.GetData(), nEndPos );
+return true;
+}
+else
+return false;
 }
 
 void PDFWriterImpl::beginCompression()
 {
-#ifndef DEBUG_DISABLE_PDFCOMPRESSION
-m_pCodec = new ZCodec( 0x4000, 0x4000 );
-m_pMemStream = new SvMemoryStream();
-m_pCodec->BeginCompression();
-#endif
+if (!g_bDebugDisableCompression)
+{
+m_pCodec = new ZCodec( 0x4000, 0x4000 );
+m_pMemStream = new SvMemoryStream();
+m_pCodec->BeginCompression();
+}
 }
 
 void PDFWriterImpl::endCompression()
 {
-#ifndef DEBUG_DISABLE_PDFCOMPRESSION
-if( m_pCodec )
+if (!g_bDebugDisableCompression && m_pCodec)
 {
 m_pCodec->EndCompression();
 delete m_pCodec;
@@ -2138,7 +2131,6 @@ void PDFWriterImpl::endCompression()
 delete m_pMemStream;
 m_pMemStream = nullptr;
 }
-#endif
 }
 
 bool 

[Libreoffice-commits] core.git: vcl/README.vars vcl/source

2015-09-02 Thread Michael Meeks
 vcl/README.vars|1 +
 vcl/source/opengl/OpenGLHelper.cxx |3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 998c64eaad98639654535229faf0e499336852d9
Author: Michael Meeks 
Date:   Wed Sep 2 16:08:11 2015 +0100

Add SAL_DISABLE_GL_WATCHDOG env. var for obvious reasons.

Change-Id: Iec7cb6504a389972d8187954d5ed7aff94f2e01c

diff --git a/vcl/README.vars b/vcl/README.vars
index 0cc8576..9285f87 100644
--- a/vcl/README.vars
+++ b/vcl/README.vars
@@ -22,3 +22,4 @@ OpenGL
 SAL_FORCEGL - force enable OpenGL
 SAL_WITHOUT_WIDGET_CACHE - disable LRU caching of native widget texutres
 SAL_DISABLE_GLYPH_CACHING - don't render glyphs through OpenGL textures
+SAL_DISABLE_GL_WATCHDOG - don't start the thread that watches for broken GL 
drivers
\ No newline at end of file
diff --git a/vcl/source/opengl/OpenGLHelper.cxx 
b/vcl/source/opengl/OpenGLHelper.cxx
index 6288849..4065ce0 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -668,7 +668,8 @@ bool OpenGLHelper::isVCLOpenGLEnabled()
 }
 if (bRet)
 {
-OpenGLWatchdogThread::start();
+if (!getenv("SAL_DISABLE_GL_WATCHDOG"))
+OpenGLWatchdogThread::start();
 ImplGetSVData()->maWinData.mbNoSaveBackground = true;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits