diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-11-13 15:54:00 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-11-23 14:25:58 +0000 |
commit | b0f5416d7ee7c988d316df7ffa0318fa6514e4de (patch) | |
tree | c196c9966ee53499559806050bb2f01195d91c23 /vcl/headless/svpcairotextrender.cxx | |
parent | e34f290eec4f3c8d42724f1602029f5680aecde6 (diff) |
Do all svp text rendering with cairo
enabling us to delete a whole pile of foo
For android we patch cairo, which is internal in that case, to swap the rgb
components so that cairo then matches the OpenGL GL_RGBA format so we can use
it there where we don't have GL_BGRA support.
Change-Id: I25e34889c7b7263438b143dd2a2ad882fb0f190a
Diffstat (limited to 'vcl/headless/svpcairotextrender.cxx')
-rw-r--r-- | vcl/headless/svpcairotextrender.cxx | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/vcl/headless/svpcairotextrender.cxx b/vcl/headless/svpcairotextrender.cxx new file mode 100644 index 000000000000..06abf0ccc48a --- /dev/null +++ b/vcl/headless/svpcairotextrender.cxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "svpcairotextrender.hxx" +#include "headless/svpgdi.hxx" + +SvpCairoTextRender::SvpCairoTextRender(SvpSalGraphics& rParent) + : mrParent(rParent) +{ +} + +GlyphCache& SvpCairoTextRender::getPlatformGlyphCache() +{ + return SvpSalGraphics::getPlatformGlyphCache(); +} + +cairo_t* SvpCairoTextRender::getCairoContext() +{ + cairo_t* pRet = mrParent.getCairoContext(); + if (!pRet) + { + mxTmpSurface = mrParent.createSimpleMask(); + pRet = SvpSalGraphics::createCairoContext(mxTmpSurface); + } + return pRet; +} + +void SvpCairoTextRender::getSurfaceOffset(double& nDX, double& nDY) +{ + nDX = 0; + nDY = 0; +} + +void SvpCairoTextRender::clipRegion(cairo_t* cr) +{ + mrParent.clipRegion(cr); +} + +basebmp::BitmapDeviceSharedPtr SvpCairoTextRender::createSimpleMask() +{ + return mrParent.createSimpleMask(); +} + +void SvpCairoTextRender::drawSurface(cairo_t*) +{ + //typically we have drawn directly to the real surface, in edge-cases of + //strange surface depths, we'll have drawn into a tmp surface, so flush + //it + if (mxTmpSurface) + { + // blend text color into target using the glyph's mask + mrParent.BlendTextColor(basebmp::Color(GetTextColor()), mxTmpSurface, basegfx::B2IPoint(0, 0)); + mxTmpSurface.reset(); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |