Closed Bug 1046918 Opened 11 years ago Closed 2 years ago

[Skia] Remove Moz2D requirement for SK_SUPPORT_LEGACY_GETDEVICE

Categories

(Core :: Graphics, defect)

x86_64
Linux
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: gw280, Unassigned)

References

Details

Attachments

(1 file, 2 obsolete files)

getDevice() on SkCanvas is no longer supported.
Assignee: nobody → wlitwinczyk
Depends on: 1046921
Comment on attachment 8474636 [details] [diff] [review] skia_bug_legacy_get_device Review of attachment 8474636 [details] [diff] [review]: ----------------------------------------------------------------- I don't think this is the direction we want to go in. Snorp - correct me if I'm wrong, but if I remember correctly the reason we accessBitmap on this is to allow for us to lazily have access to the pixel data associated with the DrawTarget in the case of a GPU target, right? We get to store the SkBitmap from the device, and then when we lockPixels or copyTo (triggered by GetData() or DrawTargetWillChange()), that causes a readPixels to occur so we don't needlessly cause a GPU readback. I *think* therefore that the correct thing to do here is to: - Store the SkCanvas object as mCanvas on the SourceSurfaceSkia - Modify GetPixels/DrawTargetWillChange to use peekPixels and readPixels instead - Explicitly document this behaviour because it's not obvious what's currently going on here
Attachment #8474636 - Flags: review?(gwright) → review-
Flags: needinfo?(snorp)
(In reply to George Wright (:gw280) from comment #2) > Comment on attachment 8474636 [details] [diff] [review] > skia_bug_legacy_get_device > > Review of attachment 8474636 [details] [diff] [review]: > ----------------------------------------------------------------- > > I don't think this is the direction we want to go in. > > Snorp - correct me if I'm wrong, but if I remember correctly the reason we > accessBitmap on this is to allow for us to lazily have access to the pixel > data associated with the DrawTarget in the case of a GPU target, right? We > get to store the SkBitmap from the device, and then when we lockPixels or > copyTo (triggered by GetData() or DrawTargetWillChange()), that causes a > readPixels to occur so we don't needlessly cause a GPU readback. > > I *think* therefore that the correct thing to do here is to: > > - Store the SkCanvas object as mCanvas on the SourceSurfaceSkia > - Modify GetPixels/DrawTargetWillChange to use peekPixels and readPixels > instead > - Explicitly document this behaviour because it's not obvious what's > currently going on here As I recall, yes, this is what is going on. Your plan there sounds fine.
Flags: needinfo?(snorp)
Attached patch skia_bug_legacy_get_device (obsolete) — Splinter Review
So I have no idea what I'm doing. I imagine the SkCanvas needs to be ref counted, it does implement SkRefCnt, but it appears there's another RefPtr in the code, should I be using that or the skia stuff? Is this what you had in mind, I really am not sure how this impacts things.
Attachment #8474636 - Attachment is obsolete: true
Attachment #8490462 - Flags: review?(gwright)
Comment on attachment 8490462 [details] [diff] [review] skia_bug_legacy_get_device Review of attachment 8490462 [details] [diff] [review]: ----------------------------------------------------------------- You may want to check DrawTargetSkia to see how the refcounting for SkCanvas is handled there. ::: gfx/2d/SourceSurfaceSkia.cpp @@ +53,4 @@ > mFormat = aFormat; > > mSize = IntSize(size.fWidth, size.fHeight); > mStride = mBitmap.rowBytes(); mBitmap was just reset, and I suspect we'll need to set it up to have an SkImageInfo that matches aCanvas' size and aFormat @@ +112,2 @@ > mBitmap.reset(); > + if (!mCanvas->readPixels(&mBitmap, 0, 0)) { This shouldn't fail unless something we can't really handle has happened, I think. I think a simple warning message would suffice. ::: gfx/2d/SourceSurfaceSkia.h @@ +47,5 @@ > > void DrawTargetWillChange(); > void MaybeUnlock(); > > + SkCanvas* mCanvas; RefPtrSkia<SkCanvas>
Attachment #8490462 - Flags: review?(gwright) → review-
Attachment #8490462 - Attachment is obsolete: true
Attachment #8490911 - Flags: review?(gwright)
No longer blocks: 1065032
Attachment #8490911 - Flags: review?(gwright)

The bug assignee didn't login in Bugzilla in the last 7 months, so the assignee is being reset.

Assignee: wlitwinczyk → nobody
Severity: normal → S3
Status: NEW → RESOLVED
Closed: 2 years ago
Depends on: 1340627
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: