Use Slim Reader/Writer lock to replace CRITICAL_SECTION (better performance).
[gdipp.git] / gdipp_server / dw_renderer.h
blob16a990a9bef976389eb42b1a65b439fdd3053c92
1 #pragma once
3 #include "gdipp_server/renderer.h"
5 class dw_renderer : public renderer, public IDWriteTextRenderer
7 public:
8 dw_renderer();
10 bool begin(const dc_context *context, FT_Render_Mode render_mode);
12 private:
13 bool make_glyph_texture(FLOAT x, FLOAT y, const DWRITE_GLYPH_RUN *dw_glyph_run, glyph_run *a_glyph_run);
14 bool render_glyph(LPCWSTR lpString, UINT c, glyph_run &new_glyph_run);
15 bool render_text(LPCWSTR lpString, UINT c, glyph_run &new_glyph_run);
16 bool render(bool is_glyph_index, bool is_pdy, LPCWSTR lpString, UINT c, CONST INT *lpDx, glyph_run &new_glyph_run);
18 //////////////////////////////////////////////////////////////////////////
20 IFACEMETHOD(QueryInterface)(
21 /* [in] */ REFIID riid,
22 /* [iid_is][out] */ __RPC__deref_out void __RPC_FAR *__RPC_FAR *ppvObject);
23 IFACEMETHOD_(ULONG, AddRef)( void);
24 IFACEMETHOD_(ULONG, Release)( void);
26 //////////////////////////////////////////////////////////////////////////
28 IFACEMETHOD(IsPixelSnappingDisabled)(
29 __maybenull void* clientDrawingContext,
30 __out BOOL* isDisabled
32 IFACEMETHOD(GetCurrentTransform)(
33 __maybenull void* clientDrawingContext,
34 __out DWRITE_MATRIX* transform
36 IFACEMETHOD(GetPixelsPerDip)(
37 __maybenull void* clientDrawingContext,
38 __out FLOAT* pixelsPerDip
41 //////////////////////////////////////////////////////////////////////////
43 IFACEMETHOD(DrawGlyphRun)(
44 __maybenull void* clientDrawingContext,
45 FLOAT baselineOriginX,
46 FLOAT baselineOriginY,
47 DWRITE_MEASURING_MODE measuringMode,
48 __in DWRITE_GLYPH_RUN const* glyphRun,
49 __in DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription,
50 __maybenull IUnknown* clientDrawingEffect
52 IFACEMETHOD(DrawUnderline)(
53 __maybenull void* clientDrawingContext,
54 FLOAT baselineOriginX,
55 FLOAT baselineOriginY,
56 __in DWRITE_UNDERLINE const* underline,
57 __maybenull IUnknown* clientDrawingEffect
59 IFACEMETHOD(DrawStrikethrough)(
60 __maybenull void* clientDrawingContext,
61 FLOAT baselineOriginX,
62 FLOAT baselineOriginY,
63 __in DWRITE_STRIKETHROUGH const* strikethrough,
64 __maybenull IUnknown* clientDrawingEffect
66 IFACEMETHOD(DrawInlineObject)(
67 __maybenull void* clientDrawingContext,
68 FLOAT originX,
69 FLOAT originY,
70 IDWriteInlineObject* inlineObject,
71 BOOL isSideways,
72 BOOL isRightToLeft,
73 __maybenull IUnknown* clientDrawingEffect
76 static IDWriteFactory *_dw_factory;
77 static IDWriteGdiInterop *_dw_gdi_interop;
79 std::vector<FLOAT> _advances;
80 DWRITE_MEASURING_MODE _dw_measuring_mode;
81 FLOAT _em_size;
82 FLOAT _pixels_per_dip;
83 bool _use_gdi_natural;