diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2017-07-19 23:28:31 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2017-07-20 18:26:24 +0200 |
commit | 3fdc41af6370a53f7db4e52104cfd3328ee40563 (patch) | |
tree | 3d29c37e366f6e81dd65d0b8be650c67b119f94e /vcl/inc | |
parent | 37436815970b14f8940fc0c547862452a2dc3e1e (diff) |
tdf#107166 improve AA mode selection, retry, more checks
Major problem when setting the render mode and the text antialias
mode is that when you set the render mode to something that isn't
compatible with the text antialias mode, then every next call will
cause an error (invalid parameters). So we need to be sure that we
never set incompatible modes. Additionally we just need to set it
one time when we create the surface and not every time we draw.
If we get the D2DERR_RECREATE_TARGET we can create a new render
target and retry the whole call. Somethimes this is not possible
so we try 3 times and the give up.
We need to add more checks where we exit early or not continue with
some calls as any additional calls could taint the draw state and
some things wouldn't be drawn. For example if we calculate the
sizes of 0 glyphs we shouldn't continue with binding the hDC with
an "empty" rectangle. This will fail and cause some text that is
called afterwards to not draw.
Change-Id: Iabbdbd7956e90ea84aea96824c0d985ca9020c59
Reviewed-on: https://gerrit.libreoffice.org/40211
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/inc')
-rwxr-xr-x | vcl/inc/win/DWriteTextRenderer.hxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/vcl/inc/win/DWriteTextRenderer.hxx b/vcl/inc/win/DWriteTextRenderer.hxx index 611a134396f7..e87ef5fe977b 100755 --- a/vcl/inc/win/DWriteTextRenderer.hxx +++ b/vcl/inc/win/DWriteTextRenderer.hxx @@ -29,8 +29,9 @@ enum class D2DTextAntiAliasMode { Default, - ClearType, + Aliased, AntiAliased, + ClearType, }; class D2DWriteTextOutRenderer : public TextOutRenderer @@ -55,7 +56,7 @@ public: SalGraphics &rGraphics, HDC hDC) override; - bool BindDC(HDC hDC, tools::Rectangle const & rRect = tools::Rectangle(0, 0, 1, 1)); + HRESULT BindDC(HDC hDC, tools::Rectangle const & rRect = tools::Rectangle(0, 0, 1, 1)); bool BindFont(HDC hDC) /*override*/; bool ReleaseFont() /*override*/; @@ -70,10 +71,8 @@ public: bool Ready() const; void applyTextAntiAliasMode(); - void setTextAntiAliasMode(D2DTextAntiAliasMode eMode) - { - meTextAntiAliasMode = eMode; - } + void changeTextAntiAliasMode(D2DTextAntiAliasMode eMode); + private: static void CleanupModules(); @@ -82,6 +81,7 @@ private: D2DWriteTextOutRenderer & operator = (const D2DWriteTextOutRenderer &) = delete; bool GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** ppFontFace, float * lfSize) const; + bool performRender(CommonSalLayout const &rLayout, SalGraphics &rGraphics, HDC hDC, bool& bRetry); ID2D1Factory * mpD2DFactory; IDWriteFactory * mpDWriteFactory; @@ -93,7 +93,6 @@ private: float mlfEmHeight; HDC mhDC; D2DTextAntiAliasMode meTextAntiAliasMode; - IDWriteRenderingParams* mpRenderingParameters; }; #endif // INCLUDED_VCL_INC_WIN_DWRITERENDERER_HXX |