Browse files

Bug 765845: Reduce calling frequency of SetTextRenderingParams. r=jrm…

…uizel a=lsblakk
  • Loading branch information...
1 parent 99bf02d commit 86efe22b11d6e35485aefabc6eceb56fafed593f Bas Schouten committed Jul 31, 2012
Showing with 12 additions and 4 deletions.
  1. +9 −4 gfx/2d/DrawTargetD2D.cpp
  2. +3 −0 gfx/2d/DrawTargetD2D.h
View
13 gfx/2d/DrawTargetD2D.cpp
@@ -857,9 +857,9 @@ DrawTargetD2D::FillGlyphs(ScaledFont *aFont,
IDWriteRenderingParams *params = NULL;
if (aRenderOptions) {
if (aRenderOptions->GetType() != FONT_DWRITE) {
- gfxDebug() << *this << ": Ignoring incompatible GlyphRenderingOptions.";
- // This should never happen.
- MOZ_ASSERT(false);
+ gfxDebug() << *this << ": Ignoring incompatible GlyphRenderingOptions.";
+ // This should never happen.
+ MOZ_ASSERT(false);
} else {
params = static_cast<const GlyphRenderingOptionsDWrite*>(aRenderOptions)->mParams;
}
@@ -878,7 +878,12 @@ DrawTargetD2D::FillGlyphs(ScaledFont *aFont,
PrepareForDrawing(rt);
- rt->SetTextRenderingParams(params);
+ if (rt != mRT || params != mTextRenderingParams) {
+ rt->SetTextRenderingParams(params);
+ if (rt == mRT) {
+ mTextRenderingParams = params;
+ }
+ }
RefPtr<ID2D1Brush> brush = CreateBrushForPattern(aPattern, aOptions.mAlpha);
View
3 gfx/2d/DrawTargetD2D.h
@@ -198,6 +198,9 @@ class DrawTargetD2D : public DrawTarget
RefPtr<ID2D1PathGeometry> mCurrentClippedGeometry;
mutable RefPtr<ID2D1RenderTarget> mRT;
+ // We store this to prevent excessive SetTextRenderingParams calls.
+ RefPtr<IDWriteRenderingParams> mTextRenderingParams;
+
// Temporary texture and render target used for supporting alternative operators.
RefPtr<ID3D10Texture2D> mTempTexture;
RefPtr<ID3D10RenderTargetView> mRTView;

0 comments on commit 86efe22

Please sign in to comment.