Closed Bug 719631 Opened 12 years ago Closed 12 years ago

Support creating offscreen DrawTargets for the Cairo backend

Categories

(Core :: Graphics, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla12

People

(Reporter: joe, Assigned: joe)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

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+
(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.
https://hg.mozilla.org/integration/mozilla-inbound/rev/2567134e9924
Assignee: nobody → joe
Target Milestone: --- → mozilla12
https://hg.mozilla.org/mozilla-central/rev/2567134e9924
Status: NEW → RESOLVED
Closed: 12 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.

Attachment

General

Created:
Updated:
Size: