Closed
Bug 944646
Opened 12 years ago
Closed 12 years ago
Crash in reftest layout/reftests/svg/text/simple-fill-gradient.svg with skia backend
Categories
(Core :: Graphics, defect)
Tracking
()
RESOLVED
FIXED
mozilla29
People
(Reporter: kevin, Assigned: kevin)
Details
Attachments
(2 files, 11 obsolete files)
Opening layout/reftests/svg/text/simple-fill-gradient.svg causes a reproducible crash when the skia backend is in use.
Assignee | ||
Comment 1•12 years ago
|
||
Caused by GlyphBufferAzure::Flush(), which ultimately calls:
aFont->CopyGlyphsToBuilder(buf, aThebesContext->mPathBuilder, &mat);
And CopyGlyphsToBuilder() assumes the the PathBuilder passed in is a PathBuilderCairo, which it is in not in the case where the draw target is a DrawTargetSkia.
Assignee | ||
Comment 2•12 years ago
|
||
Assignee | ||
Updated•12 years ago
|
Attachment #8341927 -
Flags: review?(matt.woodrow)
Assignee | ||
Comment 3•12 years ago
|
||
Since there is not a transform being passed to PathCairo::AppendPathToBuilder, I believe (from my quick read of that method) that this is semantically equivalent. However, it does seem to be slightly less efficient for PathBuilderCairo instances since calling StreamToSink for all of the path components is less efficient than just adding all of the points. If you'd prefer I keep the normal path for Cairo, but have an alternate path for Skia, that's no problem.
I checked and the SVG mentioned in the bug summary does now render correctly in Skia (and still renders correctly in Cairo).
Comment 4•12 years ago
|
||
Comment on attachment 8341927 [details] [diff] [review]
Handle non-Cairo PathBuilder in ScaledFontBase::CopyGlyphsToBuilder
Review of attachment 8341927 [details] [diff] [review]:
-----------------------------------------------------------------
I think we want to do this using the Skia API, instead of using cairo and then streaming into skia.
For standalone builds (and maybe gecko builds at some point in the future) USE_CAIRO might not be defined, and we still want this code to work.
Attachment #8341927 -
Flags: review?(matt.woodrow) → review-
Assignee | ||
Comment 5•12 years ago
|
||
Sounds very reasonable. I'll attempt to code that up tomorrow then. Thanks for the quick feedback!
Assignee | ||
Comment 6•12 years ago
|
||
Previously the ScaledFontBase::CopyGlyphsToBuilder methods in the
various ScaledFont subclasses static_cast-ed the passed in PathBuilder
objects without checking which sort of DrawSurface they were created by.
Attachment #8341927 -
Attachment is obsolete: true
Assignee | ||
Comment 7•12 years ago
|
||
Handle PathBuilderSkia with a separate path specifically for
BACKEND_SKIA DrawTarget instances.
Assignee | ||
Updated•12 years ago
|
Attachment #8342493 -
Attachment description: Check the DrawTarget type before downcasting PathBuilders → Part 1: Check the DrawTarget type before downcasting PathBuilders
Attachment #8342493 -
Flags: review?(matt.woodrow)
Assignee | ||
Updated•12 years ago
|
Attachment #8342494 -
Attachment description: Implement Skia path in ScaledFontBase::CopyGlyphsToBuilder → Part 2: Implement Skia path in ScaledFontBase::CopyGlyphsToBuilder
Attachment #8342494 -
Flags: review?(matt.woodrow)
Assignee | ||
Comment 8•12 years ago
|
||
Attempted to make things work with Skia. Rendering seems to be correct based on the few SVGs I tried.
Couple of things:
1) It was a little unclear where to put the code since the heirarchy of ScaledFont is a bit confusing. ScaledFontBase does Cairo stuff, but so does ScaledFontCairo. I decided to mimic the structure of ScaledFontBase::GetPathForGlyphs. Feel free to shout if this is wrong
2) This was my first attempt at real Skia stuff, so I guess I probably messed some stuff up. I implemented things by adding each glyph one at a time to the path builder. Skia has means to do a whole strings of glyphs at a time, but I was worried that wouldn't respect the x/y position specified in the GlyphBuffer.
3) I modeled the PathSkia::AppendPathToBuilder after the similar function in PathCairo. However, to be honest, I'm not sure why this couldn't just be a method in PathBuilderSkia which takes an SkPath and appends it (rather than going through PathSkia).
Looking forward to feedback.
Assignee | ||
Comment 9•12 years ago
|
||
Handle PathBuilderSkia with a separate path specifically for
BACKEND_SKIA DrawTarget instances.
Attachment #8342494 -
Attachment is obsolete: true
Attachment #8342494 -
Flags: review?(matt.woodrow)
Assignee | ||
Updated•12 years ago
|
Attachment #8342573 -
Attachment description: Implement Skia path in ScaledFontBase::CopyGlyphsToBuilder → Part 2: Implement Skia path in ScaledFontBase::CopyGlyphsToBuilder
Assignee | ||
Updated•12 years ago
|
Attachment #8342493 -
Flags: review?(matt.woodrow)
Assignee | ||
Comment 10•12 years ago
|
||
Realized the transform bit doesn't work. Revisiting.
Assignee | ||
Comment 11•12 years ago
|
||
Handle PathBuilderSkia with a separate path specifically for
BACKEND_SKIA DrawTarget instances.
Attachment #8342573 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Attachment #8342625 -
Attachment description: Implement Skia path in ScaledFontBase::CopyGlyphsToBuilder → Part 2: Implement Skia path in ScaledFontBase::CopyGlyphsToBuilder
Attachment #8342625 -
Flags: review?(matt.woodrow)
Assignee | ||
Updated•12 years ago
|
Attachment #8342493 -
Flags: review?(matt.woodrow)
Comment 12•12 years ago
|
||
Comment on attachment 8342493 [details] [diff] [review]
Part 1: Check the DrawTarget type before downcasting PathBuilders
Review of attachment 8342493 [details] [diff] [review]:
-----------------------------------------------------------------
::: gfx/2d/ScaledFontBase.cpp
@@ +117,3 @@
> {
> #ifdef USE_CAIRO
> + if (aBackendType == BACKEND_CAIRO) {
Check if we actually have mScaledFont too, or assert that we do.
@@ +145,1 @@
> #endif
Assert that we don't get to the end of this function without finding an appropriate path type. We don't want it to silently not draw anything.
Attachment #8342493 -
Flags: review?(matt.woodrow) → review+
Comment 13•12 years ago
|
||
Comment on attachment 8342625 [details] [diff] [review]
Part 2: Implement Skia path in ScaledFontBase::CopyGlyphsToBuilder
Review of attachment 8342625 [details] [diff] [review]:
-----------------------------------------------------------------
::: gfx/2d/ScaledFontBase.cpp
@@ +120,5 @@
> + if (aBackendType == BACKEND_SKIA) {
> + PathBuilderSkia *builder = static_cast<PathBuilderSkia *>(aBuilder);
> +
> + SkPaint paint;
> + paint.setTypeface(GetSkTypeface());
Assert that GetSkTypeface() returns non-null.
@@ +128,5 @@
> + for (uint32_t i = 0; i < aBuffer.mNumGlyphs; ++i) {
> + SkPath path;
> + paint.getTextPath(&aBuffer.mGlyphs[i].mIndex, 1,
> + aBuffer.mGlyphs[i].mPosition.x, aBuffer.mGlyphs[i].mPosition.y,
> + &path);
Lets do this the same way as the function above (GetPathForGlyphs), and share the common code between them (which is most of it).
Bonus points for making the cairo versions share code too.
@@ +131,5 @@
> + aBuffer.mGlyphs[i].mPosition.x, aBuffer.mGlyphs[i].mPosition.y,
> + &path);
> +
> + RefPtr<PathSkia> skiaPath = new PathSkia(path, FILL_WINDING);
> + skiaPath->AppendPathToBuilder(builder);
I know this matches the cairo version, but it seems really backwards to me.
How about PathBuilderSkia::AppendPath(SkPath& aPath) instead, then we can skip the construction of the PathSkia too.
Assignee | ||
Comment 14•12 years ago
|
||
(In reply to Matt Woodrow (:mattwoodrow) from comment #13)
> Comment on attachment 8342625 [details] [diff] [review]
> Part 2: Implement Skia path in ScaledFontBase::CopyGlyphsToBuilder
>
> Review of attachment 8342625 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> Lets do this the same way as the function above (GetPathForGlyphs), and
> share the common code between them (which is most of it).
>
Wow, not sure how I missed this when writing in. Oh well, at least I arrived at more or less the same result ;-)
Assignee | ||
Comment 15•12 years ago
|
||
Previously the ScaledFontBase::CopyGlyphsToBuilder methods in the
various ScaledFont subclasses static_cast-ed the passed in PathBuilder
objects without checking which sort of DrawSurface they were created by.
Attachment #8342493 -
Attachment is obsolete: true
Assignee | ||
Comment 16•12 years ago
|
||
Handle PathBuilderSkia with a separate path specifically for
BACKEND_SKIA DrawTarget instances.
Attachment #8342625 -
Attachment is obsolete: true
Attachment #8342625 -
Flags: review?(matt.woodrow)
Assignee | ||
Updated•12 years ago
|
Attachment #8345243 -
Attachment description: Check the DrawTarget type before downcasting PathBuilders. r=mattwoodrow → Part 1: Check the DrawTarget type before downcasting PathBuilders. r=mattwoodrow
Assignee | ||
Updated•12 years ago
|
Attachment #8345244 -
Attachment description: Implement Skia path in ScaledFontBase::CopyGlyphsToBuilder → Part 2: Implement Skia path in ScaledFontBase::CopyGlyphsToBuilder
Attachment #8345244 -
Flags: review?(matt.woodrow)
Updated•12 years ago
|
Attachment #8345244 -
Flags: review?(matt.woodrow) → review+
Assignee | ||
Comment 17•12 years ago
|
||
Previously the ScaledFontBase::CopyGlyphsToBuilder methods in the
various ScaledFont subclasses static_cast-ed the passed in PathBuilder
objects without checking which sort of DrawSurface they were created by.
Attachment #8345243 -
Attachment is obsolete: true
Assignee | ||
Comment 18•12 years ago
|
||
Handle PathBuilderSkia with a separate path specifically for
BACKEND_SKIA DrawTarget instances.
Attachment #8345244 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Attachment #8345766 -
Attachment description: Check the DrawTarget type before downcasting PathBuilders. r=mattwoodrow → Part 1: Check the DrawTarget type before downcasting PathBuilders. r=mattwoodrow
Assignee | ||
Updated•12 years ago
|
Attachment #8345767 -
Attachment description: Implement Skia path in ScaledFontBase::CopyGlyphsToBuilder. r=mattwoodrow → Part 2: Implement Skia path in ScaledFontBase::CopyGlyphsToBuilder. r=mattwoodrow
Assignee | ||
Comment 19•12 years ago
|
||
Previously the ScaledFontBase::CopyGlyphsToBuilder methods in the
various ScaledFont subclasses static_cast-ed the passed in PathBuilder
objects without checking which sort of DrawSurface they were created by.
Attachment #8345766 -
Attachment is obsolete: true
Assignee | ||
Comment 20•12 years ago
|
||
Handle PathBuilderSkia with a separate path specifically for
BACKEND_SKIA DrawTarget instances.
Attachment #8345767 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Attachment #8346393 -
Attachment description: Check the DrawTarget type before downcasting PathBuilders. r=mattwoodrow → Part 1: Check the DrawTarget type before downcasting PathBuilders. r=mattwoodrow
Assignee | ||
Updated•12 years ago
|
Attachment #8346394 -
Attachment description: Implement Skia path in ScaledFontBase::CopyGlyphsToBuilder. r=mattwoodrow → Part 2: Implement Skia path in ScaledFontBase::CopyGlyphsToBuilder. r=mattwoodrow
Assignee | ||
Comment 21•12 years ago
|
||
Previously the ScaledFontBase::CopyGlyphsToBuilder methods in the
various ScaledFont subclasses static_cast-ed the passed in PathBuilder
objects without checking which sort of DrawSurface they were created by.
Attachment #8346393 -
Attachment is obsolete: true
Assignee | ||
Comment 22•12 years ago
|
||
Handle PathBuilderSkia with a separate path specifically for
BACKEND_SKIA DrawTarget instances.
Attachment #8346394 -
Attachment is obsolete: true
Assignee | ||
Comment 23•12 years ago
|
||
Try run: https://tbpl.mozilla.org/?tree=Try&rev=05ed47278485
Having never used try before, are these results ok? I.e. is this able to be merged or are those failures unexpected. Most of them seem to have bugs for intermittent failures.
Comment 24•12 years ago
|
||
Yep, looks like you're good to go.
Assignee | ||
Updated•12 years ago
|
Keywords: checkin-needed
Comment 25•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/064eb6b0604d
https://hg.mozilla.org/integration/mozilla-inbound/rev/1f6ecbf2aac3
Flags: in-testsuite+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/064eb6b0604d
https://hg.mozilla.org/mozilla-central/rev/1f6ecbf2aac3
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
You need to log in
before you can comment on or make changes to this bug.
Description
•