Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Issue 2309483002: WIP RasterCanvasLayerAllocator experiment 2

Created:
4 years, 3 months ago by tomhudson
Modified:
4 years, 2 months ago
Reviewers:
f(malita), reed1
CC:
reviews_skia.org
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

WIP RasterCanvasLayerAllocator experiment 2 Encapsulates allocating and freeing the raster backing for a canvas. Allows a client's subclass to provide a situationally-appropriate backing: a BITMAP on Windows, a CGBitmapContext on Mac, on Linux a cairo_surface_t. skia/ext proof of concept at https://codereview.chromium.org/2304273002/ BUG=skia:3940 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2309483002

Patch Set 1 #

Patch Set 2 : . #

Patch Set 3 : seems to work on cairo chrome #

Patch Set 4 : support initial data? #

Total comments: 13

Patch Set 5 : remove flush #

Patch Set 6 : SkManagedBitmapDevice #

Patch Set 7 : remove free(), obsolete version of allocateLayer() #

Patch Set 8 : update comments #

Patch Set 9 : start unit tests #

Patch Set 10 : fleshing out unit test #

Patch Set 11 : fix unit test by removing "simplifying" hacks #

Patch Set 12 : respond to old review comments #

Patch Set 13 : vend smart pointers to SkCanvas #

Unified diffs Side-by-side diffs Delta from patch set Stats (+392 lines, -10 lines) Patch
M gyp/core.gypi View 1 2 3 4 5 6 7 8 9 3 chunks +4 lines, -0 lines 0 comments Download
M include/core/SkBitmapDevice.h View 1 chunk +2 lines, -1 line 0 comments Download
M include/core/SkCanvas.h View 1 2 3 4 5 8 9 4 chunks +7 lines, -0 lines 0 comments Download
M include/core/SkDevice.h View 1 2 chunks +3 lines, -1 line 0 comments Download
A include/core/SkRasterCanvasLayerAllocator.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +91 lines, -0 lines 0 comments Download
M src/core/SkBitmapDevice.cpp View 1 2 3 4 5 8 9 2 chunks +7 lines, -1 line 0 comments Download
M src/core/SkCanvas.cpp View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +12 lines, -1 line 0 comments Download
A src/core/SkManagedBitmapDevice.h View 1 2 3 4 5 1 chunk +41 lines, -0 lines 0 comments Download
A src/core/SkManagedBitmapDevice.cpp View 1 2 3 4 5 1 chunk +23 lines, -0 lines 0 comments Download
A src/core/SkRasterCanvasLayerAllocator.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +50 lines, -0 lines 0 comments Download
M src/gpu/SkGpuDevice.h View 1 chunk +2 lines, -1 line 0 comments Download
M src/gpu/SkGpuDevice.cpp View 1 2 8 9 1 chunk +2 lines, -1 line 0 comments Download
M src/pdf/SkPDFDevice.h View 1 2 8 9 1 chunk +2 lines, -1 line 0 comments Download
M src/pdf/SkPDFDevice.cpp View 1 2 3 4 8 9 1 chunk +2 lines, -1 line 0 comments Download
M src/xps/SkXPSDevice.h View 1 chunk +2 lines, -1 line 0 comments Download
M src/xps/SkXPSDevice.cpp View 1 2 1 chunk +2 lines, -1 line 0 comments Download
A tests/LayerAllocatorTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +140 lines, -0 lines 0 comments Download

Messages

Total messages: 11 (5 generated)
tomhudson
https://codereview.chromium.org/2309483002/diff/60001/src/core/SkCanvas.cpp File src/core/SkCanvas.cpp (right): https://codereview.chromium.org/2309483002/diff/60001/src/core/SkCanvas.cpp#newcode802 src/core/SkCanvas.cpp:802: Should probably put an SkASSERT() here to guarantee that ...
4 years, 3 months ago (2016-09-16 12:48:28 UTC) #2
reed1
https://codereview.chromium.org/2309483002/diff/60001/include/core/SkCanvas.h File include/core/SkCanvas.h (right): https://codereview.chromium.org/2309483002/diff/60001/include/core/SkCanvas.h#newcode1697 include/core/SkCanvas.h:1697: std::unique_ptr<SkRasterCanvasLayerAllocator> fLayerAllocator; Why is the type SkRefCnt, but we ...
4 years, 3 months ago (2016-09-16 13:15:00 UTC) #4
reed1
Is there a corresponding WIP CL showing how this might be used in skia/ext? That ...
4 years, 3 months ago (2016-09-16 13:15:35 UTC) #5
tomhudson
Link added to description: https://codereview.chromium.org/2304273002/
4 years, 3 months ago (2016-09-16 13:18:25 UTC) #7
f(malita)
https://codereview.chromium.org/2309483002/diff/60001/include/core/SkRasterCanvasLayerAllocator.h File include/core/SkRasterCanvasLayerAllocator.h (right): https://codereview.chromium.org/2309483002/diff/60001/include/core/SkRasterCanvasLayerAllocator.h#newcode48 include/core/SkRasterCanvasLayerAllocator.h:48: SkCanvas* CreateCanvas(const SkImageInfo& info, nit: non-static -> "createCanvas()"? Also, ...
4 years, 3 months ago (2016-09-16 13:39:01 UTC) #9
tomhudson
4 years, 2 months ago (2016-09-28 21:23:58 UTC) #11
I changed [cC]reateCanvas() to return a smart pointer, as Florin suggested - but
the Chrome CreatePlatformCanvas() expects SkCanvas*, so we're going to throw
away that smartness until another fun round of refactoring is done.

https://codereview.chromium.org/2309483002/diff/60001/include/core/SkCanvas.h
File include/core/SkCanvas.h (right):

https://codereview.chromium.org/2309483002/diff/60001/include/core/SkCanvas.h...
include/core/SkCanvas.h:1697: std::unique_ptr<SkRasterCanvasLayerAllocator>
fLayerAllocator;
On 2016/09/16 13:15:00, reed1 wrote:
> Why is the type SkRefCnt, but we have a unique_ptr to it? Perhaps it doesn't
> need to inherit from SkRefCnt?

Done.

https://codereview.chromium.org/2309483002/diff/60001/include/core/SkRasterCa...
File include/core/SkRasterCanvasLayerAllocator.h (right):

https://codereview.chromium.org/2309483002/diff/60001/include/core/SkRasterCa...
include/core/SkRasterCanvasLayerAllocator.h:48: SkCanvas* CreateCanvas(const
SkImageInfo& info,
On 2016/09/16 13:39:01, f(malita) wrote:
> nit: non-static -> "createCanvas()"?
> 
> Also, would it make sense to return a sk_sp<SkCanvas> instead of raw ptr?

Done.

Although it's really a weird member function, since it returns a thing that
takes unique ownership of the object. There's probably a saner way of
constructing these things.

https://codereview.chromium.org/2309483002/diff/60001/include/core/SkRasterCa...
include/core/SkRasterCanvasLayerAllocator.h:64: * Perform any OS-dependent
synchronization necessary to
On 2016/09/16 13:15:00, reed1 wrote:
> // When is this called?

Acknowledged.

https://codereview.chromium.org/2309483002/diff/60001/include/core/SkRasterCa...
include/core/SkRasterCanvasLayerAllocator.h:72: * native context.
On 2016/09/16 13:15:00, reed1 wrote:
> // When is this called?

Acknowledged.

https://codereview.chromium.org/2309483002/diff/60001/src/core/SkCanvas.cpp
File src/core/SkCanvas.cpp (right):

https://codereview.chromium.org/2309483002/diff/60001/src/core/SkCanvas.cpp#n...
src/core/SkCanvas.cpp:699: , fLayerAllocator(nullptr)
On 2016/09/16 13:15:00, reed1 wrote:
> Are any of these (nullptr) initializers needed, given that fLayerAllocator is
a
> smart container?

Done.

Powered by Google App Engine
This is Rietveld 408576698