Source operator not optimized in DrawTargetSkia when mask bounds larger than clip

RESOLVED FIXED in Firefox 51

Status

()

Core
Graphics
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: lsalzman, Assigned: lsalzman)

Tracking

unspecified
mozilla51
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox51 fixed)

Details

(Whiteboard: [gfx-noted])

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
Created attachment 8782463 [details] [diff] [review]
use getClipDeviceBounds instead of getClipBounds in DrawTargetSkia

With respect to the mask bounds optimization at: https://dxr.mozilla.org/mozilla-central/source/gfx/2d/DrawTargetSkia.cpp#441

This never gets triggered because the clip bounds are slightly inflated by Skia as done here: https://dxr.mozilla.org/mozilla-central/source/gfx/skia/skia/src/core/SkCanvas.cpp#1809

This causes us to always push a layer for unbounded operators, even when we shouldn't need one.

The simplest fix is just to use getClipDeviceBounds instead so we can skip this inflation.
Attachment #8782463 - Flags: review?(jmuizelaar)
Comment on attachment 8782463 [details] [diff] [review]
use getClipDeviceBounds instead of getClipBounds in DrawTargetSkia

Review of attachment 8782463 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/2d/DrawTargetSkia.cpp
@@ +398,5 @@
>  static inline Rect
>  GetClipBounds(SkCanvas *aCanvas)
>  {
> +  // Use getClipDeviceBounds instead of getClipBounds to avoid
> +  // inflation of the bounds rect.

// Use a manually transformed getClipDeviceBounds instead of
// getClipBounds because getClipBounds inflates the the bounds
// by a pixel in each direction to compensate for antialiasing.
Attachment #8782463 - Flags: review?(jmuizelaar) → review+
Great find and patch.

Comment 3

2 years ago
Pushed by lsalzman@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/91667ea2a01e
use getClipDeviceBounds instead of getClipBounds in DrawTargetSkia. r=jrmuizel

Comment 4

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/91667ea2a01e
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
status-firefox51: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla51

Updated

2 years ago
Blocks: 1297031
(Assignee)

Updated

2 years ago
Blocks: 1294337
You need to log in before you can comment on or make changes to this bug.