Closed Bug 1293970 Opened 8 years ago Closed 8 years ago

Avoid canvas copy-on-write in CanvasRenderingContext2D::PutImageData and DrawWindow

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox51 --- fixed

People

(Reporter: nical, Assigned: ethlin)

References

(Blocks 1 open bug)

Details

(Whiteboard: [gfx-noted])

Attachments

(1 file, 1 obsolete file)

PutImageData and DrawWindow are similar to FillRect in that they may cover the entire canvas. If it is the case, we can call EnsureTarget with a covered rect parameter the same way we do with FillRect to avoid copying the front buffer.
Attached patch set covered rect parameter to EnsureTarget (obsolete) (deleted) — Splinter Review
Comment on attachment 8780387 [details] [diff] [review] set covered rect parameter to EnsureTarget I set the covered rect parameter to EnsureTarget in DrawWindow and PutImageData.
Attachment #8780387 - Attachment description: wip → set covered rect parameter to EnsureTarget
Attachment #8780387 - Flags: review?(nical.bugzilla)
Comment on attachment 8780387 [details] [diff] [review] set covered rect parameter to EnsureTarget Review of attachment 8780387 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/canvas/CanvasRenderingContext2D.cpp @@ +5641,5 @@ > > + // The canvas spec says that the current path, transformation matrix, shadow attributes, > + // global alpha, the clipping region, and global composition operator must not affect the > + // getImageData() and putImageData() methods. > + const gfx::Rect putRect(dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); nit: you can do const gfx::Rect ptRect(dirtyRect); to avoid the hassle of repeating each member.
Attachment #8780387 - Flags: review?(nical.bugzilla) → review+
(In reply to Nicolas Silva [:nical] from comment #3) > Comment on attachment 8780387 [details] [diff] [review] > set covered rect parameter to EnsureTarget > > Review of attachment 8780387 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: dom/canvas/CanvasRenderingContext2D.cpp > @@ +5641,5 @@ > > > > + // The canvas spec says that the current path, transformation matrix, shadow attributes, > > + // global alpha, the clipping region, and global composition operator must not affect the > > + // getImageData() and putImageData() methods. > > + const gfx::Rect putRect(dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); > > nit: you can do const gfx::Rect ptRect(dirtyRect); to avoid the hassle of > repeating each member. Okay!
Rebase and address nical's comments.
Attachment #8780387 - Attachment is obsolete: true
Keywords: checkin-needed
Pushed by ryanvm@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/ec2202e9607b Avoid copy in CanvasRenderingContext2D::PutImageData and DrawWindow. r=nical
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
Blocks: 1001069
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: