Closed Bug 990357 Opened 6 years ago Closed 6 years ago

Avoid creating a temporary surface for operator source

Categories

(Core :: Graphics, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: mattwoodrow, Assigned: mattwoodrow)

Details

Attachments

(2 files)

Most Moz2D backends create a temporary surface when using OPERATOR_SOURCE to get the required unbounded behaviour.

We can avoid doing this if the source image already covers the entire clip bounds.

DrawTargetCairo does this already, we should fix the others.
Attached patch Fix DrawTargetCGSplinter Review
Attachment #8399773 - Flags: review?(jmuizelaar)
Attachment #8399775 - Flags: review?(gwright)
Comment on attachment 8399773 [details] [diff] [review]
Fix DrawTargetCG

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

::: gfx/2d/DrawTargetCG.cpp
@@ +244,5 @@
>      CGContextRef mCg;
>    public:
>      UnboundnessFixer() : mCg(nullptr) {}
>  
> +    CGContextRef Check(CGContextRef baseCg, CompositionOp blend, const Rect* dest = nullptr)

dest = maskBounds

@@ +249,5 @@
>      {
>        if (!IsOperatorBoundByMask(blend)) {
>          mClipBounds = CGContextGetClipBoundingBox(baseCg);
> +        if (CGRectIsEmpty(mClipBounds) ||
> +            (dest && dest->Contains(Rect(mClipBounds.origin.x, mClipBounds.origin.y, mClipBounds.size.width, mClipBounds.size.height)))) {

CGRectToRect()
Attachment #8399773 - Flags: review?(jmuizelaar) → review+
Attachment #8399775 - Flags: review?(gwright) → review+
https://hg.mozilla.org/mozilla-central/rev/9c5560a9472c
https://hg.mozilla.org/mozilla-central/rev/1b9580d120cc
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
The following changesets are now in Firefox Nightly:

> 9c5560a9472c Bug 990357 - Don't push layer for OPERATOR_SOURCE when the drawing operation covers the entire clip for DrawTargetCG. r=jrmuizel
> 1b9580d120cc Bug 990357 - Don't push layer for OPERATOR_SOURCE when the drawing operation covers the entire clip for DrawTargetSkia. r=gw280

Nightly Build Information:

        ID: 20140402030201
 Changeset: 4941a2ac0786109b08856738019b016a6c5a66a6
   Version: 31.0a1
      TBPL: https://tbpl.mozilla.org/?rev=4941a2ac0786
       URL: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central

Download Links:

>         Linux x86: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.linux-i686.tar.bz2
>      Linux x86_64: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.linux-x86_64.tar.bz2
> Linux x86_64 ASAN: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.linux-x86_64-asan.tar.bz2
>               Mac: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.mac.dmg
>             Win32: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.win32.installer.exe
>             Win64: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.win64-x86_64.installer.exe

Previous Nightly Build Information:

        ID: 20140401030203
 Changeset: 1417d180a1d8665b1a91b897d1cc4cc31e7980d4
   Version: 31.0a1
      TBPL: https://tbpl.mozilla.org/?rev=1417d180a1d8
       URL: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-01-03-02-03-mozilla-central
You need to log in before you can comment on or make changes to this bug.