Closed
Bug 933567
Opened 11 years ago
Closed 11 years ago
Implement MaskSurface for DrawTargetSkia
Categories
(Core :: Graphics, defect)
Tracking
()
RESOLVED
FIXED
mozilla28
People
(Reporter: gal, Assigned: kevin)
References
(Blocks 1 open bug)
Details
(Whiteboard: [qa-])
Attachments
(3 files, 8 obsolete files)
2.28 KB,
patch
|
gal
:
review+
|
Details | Diff | Splinter Review |
41.43 KB,
image/jpeg
|
Details | |
3.03 KB,
patch
|
mattwoodrow
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Reporter | ||
Updated•11 years ago
|
Attachment #825668 -
Attachment is patch: true
Attachment #825668 -
Attachment mime type: text/x-patch → text/plain
Attachment #825668 -
Flags: review?(matt.woodrow)
Reporter | ||
Updated•11 years ago
|
Attachment #825668 -
Attachment description: patch → Part 1: Implement MaskSurface
Reporter | ||
Comment 1•11 years ago
|
||
Assignee: nobody → gal
Attachment #825670 -
Flags: review?(matt.woodrow)
This works in simple cases, but it doesn't work on the Firefox home page 3x3 page grid, hovering over each is supposed to paint a shadow (which animates outward). I get something that looks like it's scaled up too much and offset. I only see it for the top left one too, nothing renders for the others. http://i.imgur.com/AkUMR34.jpg
Comment 3•11 years ago
|
||
I think the best way to implement MaskSurface will be to use the secret features of drawBitmap(). drawBitmap normally draws the passed bitmap as a source, unless the bitmap is a8, in which case it will use the bitmap as a mask and use the SkPaint to decide the source. Most of the time we should already have a8 bitmap as the mask surface, but we can call SkBitmap::extractAlpha() if we get some other sort of source. Then the implementation should be more or less identical to FillRect() except passing mask, aOffset.x, aOffset.y instead of aRect.
Reporter | ||
Comment 4•11 years ago
|
||
Attachment #825668 -
Attachment is obsolete: true
Attachment #825668 -
Flags: review?(matt.woodrow)
Attachment #825681 -
Flags: review?(matt.woodrow)
Comment 5•11 years ago
|
||
Comment on attachment 825681 [details] [diff] [review] Part 1: Implement MaskSurface for Skia. Review of attachment 825681 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/2d/DrawTargetSkia.cpp @@ +618,5 @@ > + > + IntSize size = aMask->GetSize(); > + Rect rect = Rect(aOffset.x, aOffset.y, size.width, size.height); > + > + mCanvas->drawRect(RectToSkRect(mTransform.TransformBounds(rect)), paint.mPaint); Don't transform rect here I believe. We want the userspace rect.
Reporter | ||
Comment 6•11 years ago
|
||
Attachment #825670 -
Attachment is obsolete: true
Attachment #825670 -
Flags: review?(matt.woodrow)
Attachment #825688 -
Flags: review?(matt.woodrow)
Reporter | ||
Comment 7•11 years ago
|
||
Attachment #825681 -
Attachment is obsolete: true
Attachment #825681 -
Flags: review?(matt.woodrow)
Attachment #825689 -
Flags: review?(matt.woodrow)
Comment 8•11 years ago
|
||
Comment on attachment 825689 [details] [diff] [review] Part 1: Implement MaskSurface for Skia. Review of attachment 825689 [details] [diff] [review]: ----------------------------------------------------------------- Looks good, assuming it works. I'd still rather replace this with what I said in comment 3 though.
Attachment #825689 -
Flags: review?(matt.woodrow) → review+
Reporter | ||
Comment 9•11 years ago
|
||
Yeah, new bug and patch coming up for that, but lets land this to get vlad moving.
Comment 10•11 years ago
|
||
Comment on attachment 825688 [details] [diff] [review] Part 2: Clean up Mask implementation a bit Review of attachment 825688 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/2d/DrawTargetSkia.cpp @@ +850,5 @@ > +SkRect > +DrawTargetSkia::SkRectCoveringWholeSurface() const > +{ > + Rect rect = Rect(0, 0, mSize.width, mSize.height); > + return RectToSkRect(Rect(mTransform * rect.TopLeft(), mTransform * rect.Size())); Just use TransformBounds. Expanding outwards for non-axis aligned transforms should be ok, and transforming the point/size individually isn't necessarily correct.
Attachment #825688 -
Flags: review?(matt.woodrow) → review+
Reporter | ||
Comment 11•11 years ago
|
||
Attachment #825688 -
Attachment is obsolete: true
Attachment #825696 -
Flags: review+
Reporter | ||
Comment 12•11 years ago
|
||
Pushed to try: https://tbpl.mozilla.org/?tree=Try&rev=ccea8a7861f9
Still no bueno. Left is with this patch + sw skia, right is what it looks like on d2d trunk (the shadow around when you hover).
*poke* Any progress on this?
Assignee | ||
Comment 15•11 years ago
|
||
Keep in mind I have no idea what I'm doing, but I poked into this code today and made it work so that the drop shadows on the home page are rendered correctly. Basically I made this change to Andreas' code: SkPaint maskPaint; SetPaintPattern(maskPaint, SurfacePattern(aMask, EXTEND_CLAMP)); SkMatrix transform = maskPaint.getShader()->getLocalMatrix(); transform.setTranslate(SkFloatToScalar(aOffset.x), SkFloatToScalar(aOffset.y)); maskPaint.getShader()->setLocalMatrix(transform); SkLayerRasterizer *raster = new SkLayerRasterizer(); raster->addLayer(maskPaint); Basically it looks like the layer itself was being translated which clipped off the mask instead of the mask being translate to the appropriate place in the layer.
Assignee | ||
Comment 16•11 years ago
|
||
(In reply to Kevin Simons [:kevsim] from comment #15) > SkMatrix transform = maskPaint.getShader()->getLocalMatrix(); > transform.setTranslate(SkFloatToScalar(aOffset.x), SkFloatToScalar(aOffset.y)); I guess that should be postTranslate in case there's already some translation set?
Reporter | ||
Comment 17•11 years ago
|
||
Can you upload a patch? The fix looks good to me.
Reporter | ||
Updated•11 years ago
|
Assignee: gal → kevin
Assignee | ||
Comment 18•11 years ago
|
||
Attachment #825689 -
Attachment is obsolete: true
Attachment #8336295 -
Flags: review?(matt.woodrow)
Assignee | ||
Comment 19•11 years ago
|
||
Attachment #8336295 -
Attachment is obsolete: true
Attachment #8336295 -
Flags: review?(matt.woodrow)
Attachment #8336300 -
Flags: review?(matt.woodrow)
Updated•11 years ago
|
Attachment #8336300 -
Flags: review?(matt.woodrow) → review+
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Assignee | ||
Comment 20•11 years ago
|
||
Attachment #8336300 -
Attachment is obsolete: true
Attachment #8336795 -
Flags: review?(matt.woodrow)
Assignee | ||
Comment 21•11 years ago
|
||
Attachment #8336795 -
Attachment is obsolete: true
Attachment #8336795 -
Flags: review?(matt.woodrow)
Attachment #8336798 -
Flags: review?(matt.woodrow)
Updated•11 years ago
|
Attachment #8336798 -
Flags: review?(matt.woodrow) → review+
Reporter | ||
Comment 22•11 years ago
|
||
I think we can skip the try server here. This code is currently unused by any of our tests. We will start covering this once we turn on skia for content. Lets land it until then.
Reporter | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 23•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/7e31cf975f22 https://hg.mozilla.org/integration/mozilla-inbound/rev/f6a7521fd518
Keywords: checkin-needed
Comment 24•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/7e31cf975f22 https://hg.mozilla.org/mozilla-central/rev/f6a7521fd518
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
Updated•10 years ago
|
Whiteboard: [qa-]
You need to log in
before you can comment on or make changes to this bug.
Description
•