Kaydet (Commit) 1a1ee2f6 authored tarafından Caolán McNamara's avatar Caolán McNamara

move CairoTextRender cleanup to callers

so releaseCairoContext is a mirror of getCairoContext, so callers that don't
need to flush can drop that explicit call

Not sure, now that I see it, how there's been no sign of any problem with no
damage of the affected text area under gtk3

Change-Id: I8e508160be4102c64a0ecdf5591b6999f9171c36
üst 11389cff
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "headless/svpcairotextrender.hxx" #include "headless/svpcairotextrender.hxx"
#include "headless/svpgdi.hxx" #include "headless/svpgdi.hxx"
#include <cairo.h>
SvpCairoTextRender::SvpCairoTextRender(SvpSalGraphics& rParent) SvpCairoTextRender::SvpCairoTextRender(SvpSalGraphics& rParent)
: mrParent(rParent) : mrParent(rParent)
...@@ -36,8 +37,9 @@ void SvpCairoTextRender::clipRegion(cairo_t* cr) ...@@ -36,8 +37,9 @@ void SvpCairoTextRender::clipRegion(cairo_t* cr)
mrParent.clipRegion(cr); mrParent.clipRegion(cr);
} }
void SvpCairoTextRender::releaseCairoContext(cairo_t*) void SvpCairoTextRender::releaseCairoContext(cairo_t* cr)
{ {
mrParent.releaseCairoContext(cr, false, basegfx::B2DRange());
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -344,9 +344,7 @@ void CairoTextRender::DrawServerFontLayout( const ServerFontLayout& rLayout ) ...@@ -344,9 +344,7 @@ void CairoTextRender::DrawServerFontLayout( const ServerFontLayout& rLayout )
aI = aNext; aI = aNext;
} }
cairo_surface_flush(cairo_get_target(cr));
releaseCairoContext(cr); releaseCairoContext(cr);
cairo_destroy(cr);
} }
const FontCharMapPtr CairoTextRender::GetFontCharMap() const const FontCharMapPtr CairoTextRender::GetFontCharMap() const
......
...@@ -60,11 +60,15 @@ void OpenGLX11CairoTextRender::releaseCairoContext(cairo_t* cr) ...@@ -60,11 +60,15 @@ void OpenGLX11CairoTextRender::releaseCairoContext(cairo_t* cr)
// XXX: lfrb: GLES 2.0 doesn't support GL_UNSIGNED_INT_8_8_8_8_REV // XXX: lfrb: GLES 2.0 doesn't support GL_UNSIGNED_INT_8_8_8_8_REV
OpenGLSalGraphicsImpl *pImpl = dynamic_cast< OpenGLSalGraphicsImpl* >(mrParent.GetImpl()); OpenGLSalGraphicsImpl *pImpl = dynamic_cast< OpenGLSalGraphicsImpl* >(mrParent.GetImpl());
if(!pImpl) if(!pImpl)
{
cairo_destroy(cr);
return; return;
}
cairo_surface_t* pSurface = cairo_get_target(cr); cairo_surface_t* pSurface = cairo_get_target(cr);
int nWidth = cairo_image_surface_get_width( pSurface ); int nWidth = cairo_image_surface_get_width( pSurface );
int nHeight = cairo_image_surface_get_height( pSurface ); int nHeight = cairo_image_surface_get_height( pSurface );
cairo_surface_flush(pSurface);
unsigned char *pSrc = cairo_image_surface_get_data( pSurface ); unsigned char *pSrc = cairo_image_surface_get_data( pSurface );
// XXX: lfrb: GLES 2.0 doesn't support GL_UNSIGNED_INT_8_8_8_8_REV // XXX: lfrb: GLES 2.0 doesn't support GL_UNSIGNED_INT_8_8_8_8_REV
...@@ -78,6 +82,8 @@ void OpenGLX11CairoTextRender::releaseCairoContext(cairo_t* cr) ...@@ -78,6 +82,8 @@ void OpenGLX11CairoTextRender::releaseCairoContext(cairo_t* cr)
pImpl->PreDraw(); pImpl->PreDraw();
pImpl->DrawAlphaTexture( aTexture, aRect, true, true ); pImpl->DrawAlphaTexture( aTexture, aRect, true, true );
pImpl->PostDraw(); pImpl->PostDraw();
cairo_destroy(cr);
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -146,8 +146,9 @@ size_t X11CairoTextRender::GetHeight() const ...@@ -146,8 +146,9 @@ size_t X11CairoTextRender::GetHeight() const
return 1; return 1;
} }
void X11CairoTextRender::releaseCairoContext(cairo_t* /*cr*/) void X11CairoTextRender::releaseCairoContext(cairo_t* cr)
{ {
cairo_destroy(cr);
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment