Closed Bug 1381973 Opened 7 years ago Closed 7 years ago

Lazily create the reference DT in DrawTargetCapture

Categories

(Core :: Graphics, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: mchang, Assigned: mchang)

References

Details

Attachments

(1 file, 1 obsolete file)

Right now we already create a reference DrawTarget which DrawTargetCapture uses to snapshot things if need be. Let's lazily create it since not every PaintedLayer will have to snapshot.

The ugly spot here is that some of the methods that use the RefDT are all const, but if we want to lazily create the ref dt, we need to hold the ref to the DT and modify the internal state of the DrawTargetCapture instance. Terrible mutable C++ keyword, unless you can think of something else.
Attachment #8887646 - Flags: review?(dvander)
Uses the offscreen default content backend if we can. Otherwise generates a ref DT thats 1x1 pixels.
Attachment #8887646 - Attachment is obsolete: true
Attachment #8887646 - Flags: review?(dvander)
Attachment #8888994 - Flags: review?(dvander)
Comment on attachment 8888994 [details] [diff] [review]
Use Offscreen Target DT

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

::: gfx/2d/DrawTargetCapture.cpp
@@ +28,5 @@
> +                                             SurfaceFormat aFormat)
> +  : mBackend(aBackend)
> +  , mSize(aSize)
> +{
> +  RefPtr<DrawTarget> screenRefDT =

You could delay this until we actually need the ref DT, though it's probably not a big deal.
Attachment #8888994 - Flags: review?(dvander) → review+
Pushed by mchang@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/67ed0b90b44b
Lazily create the reference DT in DrawTargetCapture. r=dvander
https://hg.mozilla.org/mozilla-central/rev/67ed0b90b44b
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.