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

seperate headless textrendering into its own class

and forward calls to it from the SvpGraphics

Change-Id: I6d1fbc8919596d5f47661b3471570fcb7e14bc3e
üst 56580e90
......@@ -558,6 +558,7 @@ vcl_headless_code= \
vcl_headless_freetype_code=\
vcl/headless/svpprn \
vcl/headless/svptext \
vcl/headless/svptextrender \
ifeq ($(GUIBASE),unx)
$(eval $(call gb_Library_add_exception_objects,vcl,\
......
......@@ -25,6 +25,7 @@ $(eval $(call gb_StaticLibrary_add_exception_objects,headless,\
vcl/headless/svpframe \
vcl/headless/svpprn \
vcl/headless/svptext \
vcl/headless/svptextrender \
vcl/headless/svpvd \
))
......
......@@ -19,6 +19,7 @@
#include "headless/svpgdi.hxx"
#include "headless/svpbmp.hxx"
#include "headless/svptextrender.hxx"
#include "saldatabasic.hxx"
#include <vcl/sysdata.hxx>
......@@ -101,12 +102,9 @@ SvpSalGraphics::SvpSalGraphics() :
m_bUseFillColor( false ),
m_aFillColor( COL_WHITE ),
m_aDrawMode( basebmp::DrawMode_PAINT ),
m_aTextColor( COL_BLACK ),
m_eTextFmt( basebmp::FORMAT_EIGHT_BIT_GREY ),
m_bClipSetup( false )
{
for( int i = 0; i < MAX_FALLBACK; ++i )
m_pServerFont[i] = NULL;
m_xTextRenderImpl.reset(new SvpTextRender(*this));
}
SvpSalGraphics::~SvpSalGraphics()
......@@ -117,26 +115,7 @@ void SvpSalGraphics::setDevice( basebmp::BitmapDeviceSharedPtr& rDevice )
{
m_aOrigDevice = rDevice;
ResetClipRegion();
// determine matching bitmap format for masks
basebmp::Format nDeviceFmt = m_aDevice ? m_aDevice->getScanlineFormat() : basebmp::FORMAT_EIGHT_BIT_GREY;
switch( nDeviceFmt )
{
case basebmp::FORMAT_EIGHT_BIT_GREY:
case basebmp::FORMAT_SIXTEEN_BIT_LSB_TC_MASK:
case basebmp::FORMAT_SIXTEEN_BIT_MSB_TC_MASK:
case basebmp::FORMAT_TWENTYFOUR_BIT_TC_MASK:
case basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_BGRX:
case basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA:
case basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_ARGB:
case basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_ABGR:
case basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_RGBA:
m_eTextFmt = basebmp::FORMAT_EIGHT_BIT_GREY;
break;
default:
m_eTextFmt = basebmp::FORMAT_ONE_BIT_LSB_GREY;
break;
}
m_xTextRenderImpl->setDevice(rDevice);
}
#endif
......
This diff is collapsed.
This diff is collapsed.
/* -*- 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/.
*/
#ifndef INCLUDED_VCL_INC_DEVICETEXTRENDER_HXX
#define INCLUDED_VCL_INC_DEVICETEXTRENDER_HXX
#include <basebmp/bitmapdevice.hxx>
#include "textrender.hxx"
class VCL_DLLPUBLIC DeviceTextRenderImpl : public TextRenderImpl
{
public:
virtual void setDevice(basebmp::BitmapDeviceSharedPtr& rDevice) = 0;
};
#endif
/* vim:set tabstop=4 shiftwidth=4 softtabstop=4 expandtab: */
......@@ -27,6 +27,7 @@
#include "salgdi.hxx"
#include "sallayout.hxx"
#include "devicetextrender.hxx"
#ifdef IOS
#define SvpSalGraphics AquaSalGraphics
......@@ -48,15 +49,14 @@ class SvpSalGraphics : public SalGraphics
basebmp::DrawMode m_aDrawMode;
// These fields are used only when we use FreeType to draw into a
// headless backend, i.e. not on iOS.
basebmp::Color m_aTextColor;
ServerFont* m_pServerFont[ MAX_FALLBACK ];
basebmp::Format m_eTextFmt;
protected:
basegfx::B2IVector GetSize() { return m_aOrigDevice->getSize(); }
public:
void setDevice(basebmp::BitmapDeviceSharedPtr& rDevice);
void BlendTextColor(const basebmp::Color &rTextColor, const basebmp::BitmapDeviceSharedPtr &rAlphaMask,
const basegfx::B2IPoint &rDstPoint);
private:
bool m_bClipSetup;
struct ClipUndoHandle {
......@@ -68,11 +68,9 @@ private:
bool isClippedSetup( const basegfx::B2IBox &aRange, ClipUndoHandle &rUndo );
void ensureClip();
public:
void setDevice( basebmp::BitmapDeviceSharedPtr& rDevice );
protected:
vcl::Region m_aClipRegion;
vcl::Region m_aClipRegion;
std::unique_ptr<DeviceTextRenderImpl> m_xTextRenderImpl;
protected:
virtual bool blendBitmap( const SalTwoRect&, const SalBitmap& rBitmap ) SAL_OVERRIDE;
......
/* -*- 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/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_VCL_INC_HEADLESS_SVPTEXTRENDER_HXX
#define INCLUDED_VCL_INC_HEADLESS_SVPTEXTRENDER_HXX
#include "devicetextrender.hxx"
#include <vcl/region.hxx>
#include <deque>
class VCL_DLLPUBLIC SvpTextRender : public DeviceTextRenderImpl
{
private:
SvpSalGraphics& m_rParent;
// These fields are used only when we use FreeType to draw into a
// headless backend, i.e. not on iOS.
basebmp::Color m_aTextColor;
basebmp::Format m_eTextFmt;
ServerFont* m_pServerFont[ MAX_FALLBACK ];
public:
SvpTextRender(SvpSalGraphics& rParent);
virtual void setDevice(basebmp::BitmapDeviceSharedPtr& rDevice) SAL_OVERRIDE;
virtual void SetTextColor( SalColor nSalColor ) SAL_OVERRIDE;
virtual sal_uInt16 SetFont( FontSelectPattern*, int nFallbackLevel ) SAL_OVERRIDE;
virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ) SAL_OVERRIDE;
virtual const FontCharMapPtr GetFontCharMap() const SAL_OVERRIDE;
virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const SAL_OVERRIDE;
virtual void GetDevFontList( PhysicalFontCollection* ) SAL_OVERRIDE;
virtual void ClearDevFontCache() SAL_OVERRIDE;
virtual bool AddTempDevFont( PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) SAL_OVERRIDE;
virtual bool CreateFontSubset(
const OUString& rToFile,
const PhysicalFontFace*,
const sal_GlyphId* pGlyphIDs,
const sal_uInt8* pEncoding,
sal_Int32* pWidths,
int nGlyphs,
FontSubsetInfo& rInfo) SAL_OVERRIDE;
virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded, std::set<sal_Unicode> const**) SAL_OVERRIDE;
virtual const void* GetEmbedFontData(
const PhysicalFontFace*,
const sal_Ucs* pUnicodes,
sal_Int32* pWidths,
size_t nLen,
FontSubsetInfo& rInfo,
long* pDataLen ) SAL_OVERRIDE;
virtual void FreeEmbedFontData( const void* pData, long nDataLen ) SAL_OVERRIDE;
virtual void GetGlyphWidths(
const PhysicalFontFace*,
bool bVertical,
Int32Vector& rWidths,
Ucs2UIntMap& rUnicodeEnc ) SAL_OVERRIDE;
virtual bool GetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& ) SAL_OVERRIDE;
virtual bool GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& ) SAL_OVERRIDE;
virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) SAL_OVERRIDE;
virtual void DrawServerFontLayout( const ServerFontLayout& ) SAL_OVERRIDE;
virtual SystemFontData GetSysFontData( int nFallbackLevel ) const SAL_OVERRIDE;
};
#endif // INCLUDED_VCL_INC_HEADLESS_SVPTEXTRENDER_HXX
/* 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