Closed
Bug 1378538
Opened 7 years ago
Closed 7 years ago
DrawTargetCapture doesn't store StrokeOption's Dash Information
Categories
(Core :: Graphics, enhancement)
Core
Graphics
Tracking
()
RESOLVED
FIXED
mozilla56
Tracking | Status | |
---|---|---|
firefox56 | --- | fixed |
People
(Reporter: mchang, Assigned: mchang)
References
Details
Attachments
(1 file)
906 bytes,
patch
|
jrmuizel
:
review+
|
Details | Diff | Splinter Review |
With DrawTargetCapture, we were getting some random artifacts with StrokeLine(). This is because StrokeOptions has a dash pattern array that is owned by the caller [1]. DrawTargetCapture::StrokeLine was just copying the pointer, which was getting freed before we could replay the data. DrawTargetRecording doesn't have this problem because it copies all the data. Other methods such as DrawTargetCapture::StrokeRect, which also take in a StrokeOptions already copies the dash information[2]. Let's do the same thing for StrokeLines(). I already verified that all other moz 2d api calls that take a StrokeOption copy the dash information. [1] http://searchfox.org/mozilla-central/source/gfx/2d/2D.h#160 [2] http://searchfox.org/mozilla-central/source/gfx/2d/DrawCommand.h#267
Attachment #8883731 -
Flags: review?(jmuizelaar)
Comment 1•7 years ago
|
||
Comment on attachment 8883731 [details] [diff] [review] Copy Dash data when recording StrokeLines Review of attachment 8883731 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/2d/DrawCommand.h @@ +304,5 @@ > + // between now and replay. > + if (aStrokeOptions.mDashLength) { > + mDashes.resize(aStrokeOptions.mDashLength); > + mStrokeOptions.mDashPattern = &mDashes.front(); > + memcpy(&mDashes.front(), aStrokeOptions.mDashPattern, mStrokeOptions.mDashLength * sizeof(Float)); You could also do this in one line with something like: mDashes.insert(mDashes.end(), aStrokeOptions.mDashPattern, aStrokeOptions.mDashPattern + aStrokeOptions.mDashLength);
Attachment #8883731 -
Flags: review?(jmuizelaar) → review+
Assignee | ||
Comment 2•7 years ago
|
||
(In reply to Jeff Muizelaar [:jrmuizel] from comment #1) > Comment on attachment 8883731 [details] [diff] [review] > Copy Dash data when recording StrokeLines > > Review of attachment 8883731 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: gfx/2d/DrawCommand.h > @@ +304,5 @@ > > + // between now and replay. > > + if (aStrokeOptions.mDashLength) { > > + mDashes.resize(aStrokeOptions.mDashLength); > > + mStrokeOptions.mDashPattern = &mDashes.front(); > > + memcpy(&mDashes.front(), aStrokeOptions.mDashPattern, mStrokeOptions.mDashLength * sizeof(Float)); > > You could also do this in one line with something like: > mDashes.insert(mDashes.end(), aStrokeOptions.mDashPattern, > aStrokeOptions.mDashPattern + aStrokeOptions.mDashLength); The rest of DrawCommand::Stroke* are like this, so I figured I'd copy the current style.
Pushed by mchang@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/42a708048bf7 Copy Dash data when recording StrokeLines in DrawTargetCapture. r=jrmuizel
Comment 4•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/42a708048bf7
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox56:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in
before you can comment on or make changes to this bug.
Description
•