Skip to content

Commit

Permalink
Use GraphicsContextStateSaver::SaveIfNeeded in a few places
Browse files Browse the repository at this point in the history
In TextPainterBase::UpdateGraphicsContext() there are two instances that
exactly matches the SaveIfNeeded() pattern. Replace.

Change-Id: I107a6db5880d7592560b0c759a677ce133ce4403
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2240858
Commit-Queue: Stephen Chenney <schenney@chromium.org>
Auto-Submit: Fredrik Söderquist <fs@opera.com>
Reviewed-by: Stephen Chenney <schenney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#777395}
  • Loading branch information
Fredrik Söderqvist authored and Commit Bot committed Jun 11, 2020
1 parent 815f649 commit 2addf1f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions third_party/blink/renderer/core/paint/text_painter_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ void TextPainterBase::UpdateGraphicsContext(
if (text_style.stroke_width > 0) {
TextDrawingModeFlags new_mode = mode | kTextModeStroke;
if (mode != new_mode) {
if (!state_saver.Saved())
state_saver.Save();
state_saver.SaveIfNeeded();
context.SetTextDrawingMode(new_mode);
mode = new_mode;
}
Expand All @@ -96,8 +95,7 @@ void TextPainterBase::UpdateGraphicsContext(
}

if (text_style.shadow) {
if (!state_saver.Saved())
state_saver.Save();
state_saver.SaveIfNeeded();
context.SetDrawLooper(text_style.shadow->CreateDrawLooper(
DrawLooperBuilder::kShadowIgnoresAlpha, text_style.current_color,
horizontal));
Expand Down

0 comments on commit 2addf1f

Please sign in to comment.