Support creating offscreen DrawTargets for the Cairo backend

RESOLVED FIXED in mozilla12

Status

()

Core
Graphics
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: Joe Drew (not getting mail), Assigned: Joe Drew (not getting mail))

Tracking

(Blocks: 1 bug)

Trunk
mozilla12
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
Created attachment 590019 [details] [diff] [review]
Support creating offscreen DrawTargets

There's a lot of knowledge in gfxPlatform, and it's silly for us not to use it, at least for the Cairo backend. This patch usees gfxPlatform::CreateOffscreenSurface(), and then wraps that surface in a DrawTarget.
Attachment #590019 - Flags: review?(jmuizelaar)
Attachment #590019 - Flags: review?(bas.schouten)
Comment on attachment 590019 [details] [diff] [review]
Support creating offscreen DrawTargets

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

::: gfx/2d/DrawTargetCairo.cpp
@@ +122,1 @@
>      }

Why this change?

::: gfx/thebes/gfxPlatform.cpp
@@ +533,5 @@
>  }
>  
> +// The semantics of this function are sort of weird. If we don't have direct
> +// support for the backend, We snapshot the first time and then return the
> +// snapshotted surface for the lifetime of the draw target

Move this comment into the crazy part, so it doesn't look like CAIRO semantics are crazy.

@@ +597,5 @@
> +  if (backend == BACKEND_CAIRO) {
> +    nsRefPtr<gfxASurface> surf = CreateOffscreenSurface(ThebesIntSize(aSize),
> +                                                        ContentForFormat(aFormat));
> +
> +    return CreateDrawTargetForSurface(surf);

This is nice.
Attachment #590019 - Flags: review?(jmuizelaar) → review+
(Assignee)

Comment 2

5 years ago
(In reply to Jeff Muizelaar [:jrmuizel] from comment #1)
> ::: gfx/2d/DrawTargetCairo.cpp
> @@ +122,1 @@
> >      }
> 
> Why this change?

We create fully-valid 0x0 (or 0xn) surfaces; treating them as invalid was causing problems.
(Assignee)

Comment 3

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/2567134e9924
Assignee: nobody → joe
Target Milestone: --- → mozilla12
(Assignee)

Comment 4

5 years ago
https://hg.mozilla.org/mozilla-central/rev/2567134e9924
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Attachment #590019 - Flags: review?(bas)
You need to log in before you can comment on or make changes to this bug.