1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
26 #include <systools/win32/comtools.hxx>
28 #include <win/winlayout.hxx>
30 class D2DWriteTextOutRenderer
: public TextOutRenderer
33 using MODE
= std::pair
<D2D1_TEXT_ANTIALIAS_MODE
, DWRITE_RENDERING_MODE
>;
35 explicit D2DWriteTextOutRenderer(MODE mode
);
37 bool operator()(GenericSalLayout
const &rLayout
,
38 SalGraphics
&rGraphics
,
41 HRESULT
BindDC(HDC hDC
, tools::Rectangle
const & rRect
= tools::Rectangle(0, 0, 1, 1));
43 HRESULT
CreateRenderTarget();
47 void applyTextAntiAliasMode();
49 MODE
GetRenderingMode() const { return maRenderingMode
; }
51 static MODE
GetMode(bool bRenderingModeNatural
, bool bAntiAlias
);
54 // This is a singleton object disable copy ctor and assignment operator
55 D2DWriteTextOutRenderer(const D2DWriteTextOutRenderer
&) = delete;
56 D2DWriteTextOutRenderer
& operator = (const D2DWriteTextOutRenderer
&) = delete;
58 IDWriteFontFace
* GetDWriteFace(const WinFontInstance
& rWinFont
, float * lfSize
) const;
59 bool performRender(GenericSalLayout
const &rLayout
, SalGraphics
&rGraphics
, HDC hDC
, bool& bRetry
);
61 sal::systools::COMReference
<ID2D1Factory
> mpD2DFactory
;
62 sal::systools::COMReference
<ID2D1DCRenderTarget
> mpRT
;
63 const D2D1_RENDER_TARGET_PROPERTIES mRTProps
;
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */