diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2015-01-24 14:32:46 +1100 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2015-01-24 14:32:46 +1100 |
commit | 686e35567ac31eee5aa8412c8e6f94c26bbbfb23 (patch) | |
tree | 55c75693c35077c369a21c2e2a9818546e6ef74b /vcl/unx/generic | |
parent | fa4327421ebaaf562d8689b454117b101c5eee24 (diff) |
Revert "vcl: Reduce OpenGLX11CairoTextRender surface area to size of text bounds"
This reverts commit 35131df0ff833423809ea38621002322cf2d75b2.
Diffstat (limited to 'vcl/unx/generic')
-rw-r--r-- | vcl/unx/generic/gdi/cairotextrender.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/openglx11cairotextrender.cxx | 53 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/openglx11cairotextrender.hxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/x11cairotextrender.cxx | 3 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/x11cairotextrender.hxx | 3 |
5 files changed, 10 insertions, 53 deletions
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index 1ad59365e0af..7b0438ea49bf 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -204,7 +204,7 @@ void CairoTextRender::DrawServerFontLayout( const ServerFontLayout& rLayout ) if (cairo_glyphs.empty()) return; - cairo_surface_t *surface = getCairoSurface( rLayout ); + cairo_surface_t *surface = getCairoSurface(); DBG_ASSERT( surface!=NULL, "no cairo surface for text" ); if( !surface ) diff --git a/vcl/unx/generic/gdi/openglx11cairotextrender.cxx b/vcl/unx/generic/gdi/openglx11cairotextrender.cxx index 67024bf0f561..64bf196ef54c 100644 --- a/vcl/unx/generic/gdi/openglx11cairotextrender.cxx +++ b/vcl/unx/generic/gdi/openglx11cairotextrender.cxx @@ -20,64 +20,23 @@ OpenGLX11CairoTextRender::OpenGLX11CairoTextRender(bool bPrinter, X11SalGraphics { } -cairo_surface_t* OpenGLX11CairoTextRender::getCairoSurface( const ServerFontLayout& rLayout ) +cairo_surface_t* OpenGLX11CairoTextRender::getCairoSurface() { // static size_t id = 0; // OString aFileName = OString("/tmp/libo_logs/text_rendering") + OString::number(id++) + OString(".svg"); // cairo_surface_t* surface = cairo_svg_surface_create(aFileName.getStr(), GetWidth(), GetHeight()); cairo_surface_t* surface = NULL; - Rectangle aTextBoundRect; OpenGLSalGraphicsImpl *pImpl = dynamic_cast< OpenGLSalGraphicsImpl* >(mrParent.GetImpl()); - - if (pImpl) + if( pImpl ) { Rectangle aClipRect = pImpl->getClipRegion().GetBoundRect(); - - // no clipping area, we need to take the whole area - if ( aClipRect.IsEmpty() ) - { - aClipRect.setWidth(GetWidth()); - aClipRect.setHeight(GetHeight()); - } - - if (!rLayout.GetOrientation() ) - { - // GetBoundRect can fail! - if ( rLayout.GetBoundRect(mrParent, aTextBoundRect) ) - { - // we need to take into account SalLayout's drawing offset - int nOffsetX = rLayout.DrawOffset().X() - rLayout.DrawBase().X(); - int nOffsetY = rLayout.DrawOffset().Y() - rLayout.DrawBase().Y(); - - aTextBoundRect.Left() += nOffsetX; - aTextBoundRect.Top() += nOffsetY; - - aTextBoundRect = aTextBoundRect.Intersection(aClipRect); - } - else - { - SAL_WARN("vcl.layout", "GetBoundRect() failed"); - } - } - else + if( aClipRect.GetWidth() == 0 || aClipRect.GetHeight() == 0 ) { - aTextBoundRect = aClipRect; + aClipRect.setWidth( GetWidth() ); + aClipRect.setHeight( GetHeight() ); } + surface = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, aClipRect.GetWidth(), aClipRect.GetHeight() ); } - else - { - SAL_WARN("vcl.opengl", "No OpenGLSalGraphicsImpl!"); - return NULL; - } - - - double nDX=0, nDY=0; - getSurfaceOffset(nDX, nDY); - - // add cairo surface offsets to work out surface width and height - surface = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, aTextBoundRect.GetWidth() + nDX, - aTextBoundRect.GetHeight() + nDY ); - return surface; } diff --git a/vcl/unx/generic/gdi/openglx11cairotextrender.hxx b/vcl/unx/generic/gdi/openglx11cairotextrender.hxx index 4f8a0558a3eb..171949651635 100644 --- a/vcl/unx/generic/gdi/openglx11cairotextrender.hxx +++ b/vcl/unx/generic/gdi/openglx11cairotextrender.hxx @@ -17,7 +17,7 @@ class OpenGLX11CairoTextRender : public X11CairoTextRender public: OpenGLX11CairoTextRender(bool bPrinter, X11SalGraphics& rParent); - virtual cairo_surface_t* getCairoSurface( const ServerFontLayout& rLayout ) SAL_OVERRIDE; + virtual cairo_surface_t* getCairoSurface() SAL_OVERRIDE; virtual void getSurfaceOffset(double& nDX, double& nDY) SAL_OVERRIDE; virtual void drawSurface(cairo_t* cr) SAL_OVERRIDE; }; diff --git a/vcl/unx/generic/gdi/x11cairotextrender.cxx b/vcl/unx/generic/gdi/x11cairotextrender.cxx index 2519816298a0..f3aa47d07800 100644 --- a/vcl/unx/generic/gdi/x11cairotextrender.cxx +++ b/vcl/unx/generic/gdi/x11cairotextrender.cxx @@ -53,8 +53,7 @@ GlyphCache& X11CairoTextRender::getPlatformGlyphCache() return X11GlyphCache::GetInstance(); } - -cairo_surface_t* X11CairoTextRender::getCairoSurface( const ServerFontLayout& ) +cairo_surface_t* X11CairoTextRender::getCairoSurface() { // find a XRenderPictFormat compatible with the Drawable XRenderPictFormat* pVisualFormat = mrParent.GetXRenderFormat(); diff --git a/vcl/unx/generic/gdi/x11cairotextrender.hxx b/vcl/unx/generic/gdi/x11cairotextrender.hxx index 57c85696e0a6..1449b3aa0dc5 100644 --- a/vcl/unx/generic/gdi/x11cairotextrender.hxx +++ b/vcl/unx/generic/gdi/x11cairotextrender.hxx @@ -21,7 +21,6 @@ #define INCLUDED_VCL_UNX_GENERIC_GDI_X11CAIROTEXTRENDER_HXX value #include "cairotextrender.hxx" -#include "generic/glyphcache.hxx" #include "unx/saldata.hxx" #include "unx/saldisp.hxx" @@ -41,7 +40,7 @@ public: X11CairoTextRender(bool bPrinter, X11SalGraphics& rParent); virtual GlyphCache& getPlatformGlyphCache() SAL_OVERRIDE; - virtual cairo_surface_t* getCairoSurface( const ServerFontLayout &rLayout ) SAL_OVERRIDE; + virtual cairo_surface_t* getCairoSurface() SAL_OVERRIDE; virtual void getSurfaceOffset(double& nDX, double& nDY) SAL_OVERRIDE; virtual void clipRegion(cairo_t* cr) SAL_OVERRIDE; virtual void drawSurface(cairo_t* cr) SAL_OVERRIDE; |