[Libreoffice-commits] core.git: vcl/inc vcl/unx
Chris Sherlock
chris.sherlock79 at gmail.com
Fri Jan 23 19:33:34 PST 2015
vcl/inc/cairotextrender.hxx | 2
vcl/unx/generic/gdi/cairotextrender.cxx | 2
vcl/unx/generic/gdi/openglx11cairotextrender.cxx | 53 ++---------------------
vcl/unx/generic/gdi/openglx11cairotextrender.hxx | 2
vcl/unx/generic/gdi/x11cairotextrender.cxx | 3 -
vcl/unx/generic/gdi/x11cairotextrender.hxx | 3 -
6 files changed, 11 insertions(+), 54 deletions(-)
New commits:
commit 686e35567ac31eee5aa8412c8e6f94c26bbbfb23
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date: Sat Jan 24 14:32:46 2015 +1100
Revert "vcl: Reduce OpenGLX11CairoTextRender surface area to size of text bounds"
This reverts commit 35131df0ff833423809ea38621002322cf2d75b2.
diff --git a/vcl/inc/cairotextrender.hxx b/vcl/inc/cairotextrender.hxx
index 6eb887d..d59d75c 100644
--- a/vcl/inc/cairotextrender.hxx
+++ b/vcl/inc/cairotextrender.hxx
@@ -80,7 +80,7 @@ class CairoTextRender : public TextRenderImpl
protected:
virtual GlyphCache& getPlatformGlyphCache() = 0;
- virtual cairo_surface_t* getCairoSurface( const ServerFontLayout &rLayout ) = 0;
+ virtual cairo_surface_t* getCairoSurface() = 0;
virtual void getSurfaceOffset(double& nDX, double& nDY) = 0;
virtual void drawSurface(cairo_t* cr) = 0;
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index 1ad5936..7b0438e 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 67024bf..64bf196 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 4f8a055..1719496 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 2519816..f3aa47d 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 57c85696..1449b3a 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;
More information about the Libreoffice-commits
mailing list