Commit c4fb2a86 authored by Mario Bianucci's avatar Mario Bianucci Committed by Commit Bot

Use clipRect instead of saveLayer for drawing ink trail

Calling saveLayer() on the canvas before drawing the delegated ink
trail is unnecessarily expensive - it allocates a temporary buffer for
the path to be drawn into for resolving and layer blending that may
need to occur. However, since there is only one trail, this isn't
required, and we can instead just use clipRect to ensure the trail is
clipped to the bounds of the presentation area.

Bug: 1148533
Change-Id: Id60d1def6215616f65838aae05658317c8fcd372
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2536086Reviewed-by: default avatarMichael Ludwig <michaelludwig@google.com>
Reviewed-by: default avatarweiliangc <weiliangc@chromium.org>
Commit-Queue: Mario Bianucci <mabian@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#827882}
parent 1d419178
......@@ -21,8 +21,10 @@ void DelegatedInkPointRendererSkia::DrawDelegatedInkTrail(SkCanvas* canvas) {
return;
if (!path_.isEmpty() && canvas) {
canvas->save();
SkRect bounds = gfx::RectFToSkRect(metadata_->presentation_area());
canvas->saveLayer(SkCanvas::SaveLayerRec(&bounds, nullptr));
canvas->clipRect(bounds);
SkPaint paint;
paint.setAntiAlias(true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment