Last Comment Bug 719631 - Support creating offscreen DrawTargets for the Cairo backend
: Support creating offscreen DrawTargets for the Cairo backend
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Graphics (show other bugs)
: Trunk
: x86 Mac OS X
: -- normal (vote)
: mozilla12
Assigned To: Joe Drew (not getting mail)
:
Mentors:
Depends on:
Blocks: 694351
  Show dependency treegraph
 
Reported: 2012-01-19 15:32 PST by Joe Drew (not getting mail)
Modified: 2012-10-23 11:44 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Support creating offscreen DrawTargets (5.69 KB, patch)
2012-01-19 15:32 PST, Joe Drew (not getting mail)
jmuizelaar: review+
Details | Diff | Review

Description Joe Drew (not getting mail) 2012-01-19 15:32:07 PST
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.
Comment 1 Jeff Muizelaar [:jrmuizel] 2012-01-23 13:11:28 PST
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.
Comment 2 Joe Drew (not getting mail) 2012-01-26 14:44:38 PST
(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.
Comment 3 Joe Drew (not getting mail) 2012-01-27 12:07:46 PST
https://hg.mozilla.org/integration/mozilla-inbound/rev/2567134e9924
Comment 4 Joe Drew (not getting mail) 2012-01-28 19:13:06 PST
https://hg.mozilla.org/mozilla-central/rev/2567134e9924

Note You need to log in before you can comment on or make changes to this bug.