diff options
Diffstat (limited to 'canvas/source/opengl/ogl_textlayout.cxx')
-rw-r--r-- | canvas/source/opengl/ogl_textlayout.cxx | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/canvas/source/opengl/ogl_textlayout.cxx b/canvas/source/opengl/ogl_textlayout.cxx index 41962c8b1ea0..a87365275436 100644 --- a/canvas/source/opengl/ogl_textlayout.cxx +++ b/canvas/source/opengl/ogl_textlayout.cxx @@ -9,8 +9,9 @@ #include <sal/config.h> #include <sal/log.hxx> +#include <utility> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include "ogl_textlayout.hxx" @@ -18,18 +19,17 @@ using namespace ::com::sun::star; namespace oglcanvas { - TextLayout::TextLayout( const rendering::StringContext& aText, - sal_Int8 nDirection, - sal_Int64 /*nRandomSeed*/, - const CanvasFont::ImplRef& rFont ) : - TextLayoutBaseT( m_aMutex ), - maText( aText ), - mpFont( rFont ), + TextLayout::TextLayout( rendering::StringContext aText, + sal_Int8 nDirection, + sal_Int64 /*nRandomSeed*/, + CanvasFont::ImplRef rFont ) : + maText(std::move( aText )), + mpFont(std::move( rFont )), mnTextDirection( nDirection ) { } - void SAL_CALL TextLayout::disposing() + void TextLayout::disposing(std::unique_lock<std::mutex>& /*rGuard*/) { mpFont.clear(); } @@ -55,14 +55,14 @@ namespace oglcanvas uno::Sequence< double > SAL_CALL TextLayout::queryLogicalAdvancements( ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return maLogicalAdvancements; } void SAL_CALL TextLayout::applyLogicalAdvancements( const uno::Sequence< double >& aAdvancements ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); if( aAdvancements.getLength() != maText.Length ) { @@ -73,9 +73,29 @@ namespace oglcanvas maLogicalAdvancements = aAdvancements; } + uno::Sequence< sal_Bool > SAL_CALL TextLayout::queryKashidaPositions( ) + { + std::unique_lock aGuard( m_aMutex ); + + return maKashidaPositions; + } + + void SAL_CALL TextLayout::applyKashidaPositions( const uno::Sequence< sal_Bool >& aPositions ) + { + std::unique_lock aGuard( m_aMutex ); + + if( aPositions.hasElements() && aPositions.getLength() != maText.Length ) + { + SAL_WARN("canvas.ogl", "TextLayout::applyKashidaPositions(): mismatching number of positions" ); + throw lang::IllegalArgumentException("mismatching number of positions", getXWeak(), 1); + } + + maKashidaPositions = aPositions; + } + geometry::RealRectangle2D SAL_CALL TextLayout::queryTextBounds( ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); ENSURE_OR_THROW( mpFont, "TextLayout::queryTextBounds(): invalid font" ); @@ -155,22 +175,18 @@ namespace oglcanvas sal_Int8 SAL_CALL TextLayout::getMainTextDirection( ) { - ::osl::MutexGuard aGuard( m_aMutex ); - return mnTextDirection; } uno::Reference< rendering::XCanvasFont > SAL_CALL TextLayout::getFont( ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return mpFont; } rendering::StringContext SAL_CALL TextLayout::getText( ) { - ::osl::MutexGuard aGuard( m_aMutex ); - return maText; } |