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

Issue 159723006: add peekPixels to canvas (Closed)

Created:
6 years, 10 months ago by reed1
Modified:
6 years, 10 months ago
CC:
skia-review_googlegroups.com
Visibility:
Public.

Description

add peekPixels to SkCanvas and SkSurface This is motivated by a desire to remove call-sites that perform the folowing: SkBaseDevice* dev = canvas->getDevice(); const SkBitmap& bitmap = dev->accessBitmap(); ... read the bitmap 1. We'd like to deprecate getDevice() entirely 2. BaseDevice itself shouldn't know about bitmaps (only BitmapDevice should) 3. SkImage already has peekPixels()

Patch Set 1 #

Patch Set 2 : #

Total comments: 6

Patch Set 3 : added helper for peek/read-pixels #

Patch Set 4 : #

Total comments: 9
Unified diffs Side-by-side diffs Delta from patch set Stats (+324 lines, -111 lines) Patch
M gm/aaclip.cpp View 4 chunks +24 lines, -22 lines 0 comments Download
M gm/bitmapcopy.cpp View 1 chunk +5 lines, -5 lines 0 comments Download
M gm/bitmapsource.cpp View 1 chunk +1 line, -2 lines 0 comments Download
M gm/deviceproperties.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M gm/displacement.cpp View 2 chunks +2 lines, -4 lines 0 comments Download
M gm/gammatext.cpp View 1 2 chunks +14 lines, -6 lines 0 comments Download
M gm/gm.h View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M gm/imagefiltersclipped.cpp View 1 2 3 2 chunks +3 lines, -5 lines 0 comments Download
M gm/imagefiltersgraph.cpp View 1 2 chunks +2 lines, -2 lines 0 comments Download
M gm/imagefiltersscaled.cpp View 1 2 chunks +2 lines, -4 lines 0 comments Download
M gm/lighting.cpp View 1 2 chunks +2 lines, -3 lines 0 comments Download
M gm/matrixconvolution.cpp View 1 1 chunk +1 line, -2 lines 0 comments Download
M gm/morphology.cpp View 1 1 chunk +1 line, -2 lines 0 comments Download
M gm/ninepatchstretch.cpp View 1 1 chunk +1 line, -4 lines 0 comments Download
M gm/offsetimagefilter.cpp View 1 2 chunks +3 lines, -6 lines 0 comments Download
M gm/tileimagefilter.cpp View 1 2 chunks +2 lines, -4 lines 0 comments Download
M gm/xfermodeimagefilter.cpp View 1 2 chunks +2 lines, -4 lines 0 comments Download
M include/core/SkBitmap.h View 1 2 1 chunk +7 lines, -0 lines 0 comments Download
M include/core/SkBitmapDevice.h View 1 chunk +1 line, -0 lines 0 comments Download
M include/core/SkCanvas.h View 1 2 5 chunks +68 lines, -4 lines 5 comments Download
M include/core/SkDevice.h View 1 2 2 chunks +11 lines, -1 line 0 comments Download
M include/core/SkSurface.h View 1 chunk +12 lines, -0 lines 0 comments Download
M samplecode/SampleApp.cpp View 1 2 1 chunk +3 lines, -2 lines 0 comments Download
M samplecode/SampleCircle.cpp View 1 2 1 chunk +0 lines, -6 lines 0 comments Download
M samplecode/SampleLayers.cpp View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M src/core/SkBitmapDevice.cpp View 1 chunk +10 lines, -0 lines 0 comments Download
M src/core/SkCanvas.cpp View 1 2 1 chunk +45 lines, -0 lines 2 comments Download
M src/core/SkDevice.cpp View 1 2 2 chunks +12 lines, -0 lines 0 comments Download
M src/image/SkImagePriv.h View 1 2 1 chunk +0 lines, -2 lines 0 comments Download
M src/image/SkSurface.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M tests/SkpSkGrTest.cpp View 1 2 1 chunk +5 lines, -1 line 0 comments Download
M tests/SurfaceTest.cpp View 4 chunks +76 lines, -16 lines 2 comments Download

Messages

Total messages: 11 (0 generated)
reed1
6 years, 10 months ago (2014-02-12 15:05:42 UTC) #1
hal.canary
https://codereview.chromium.org/159723006/diff/20001/include/core/SkCanvas.h File include/core/SkCanvas.h (right): https://codereview.chromium.org/159723006/diff/20001/include/core/SkCanvas.h#newcode130 include/core/SkCanvas.h:130: * RAM) return the const-address of those pixels, and ...
6 years, 10 months ago (2014-02-12 15:11:01 UTC) #2
reed1
On 2014/02/12 15:11:01, Hal Canary wrote: > https://codereview.chromium.org/159723006/diff/20001/include/core/SkCanvas.h > File include/core/SkCanvas.h (right): > > https://codereview.chromium.org/159723006/diff/20001/include/core/SkCanvas.h#newcode130 ...
6 years, 10 months ago (2014-02-12 15:15:43 UTC) #3
bsalomon
lgtm https://codereview.chromium.org/159723006/diff/20001/gm/gm.h File gm/gm.h (right): https://codereview.chromium.org/159723006/diff/20001/gm/gm.h#newcode12 gm/gm.h:12: //#include "SkBitmapDevice.h" just remove it? https://codereview.chromium.org/159723006/diff/20001/gm/imagefiltersclipped.cpp File gm/imagefiltersclipped.cpp ...
6 years, 10 months ago (2014-02-12 15:56:36 UTC) #4
reed1
https://codereview.chromium.org/159723006/diff/20001/gm/gm.h File gm/gm.h (right): https://codereview.chromium.org/159723006/diff/20001/gm/gm.h#newcode12 gm/gm.h:12: //#include "SkBitmapDevice.h" On 2014/02/12 15:56:37, bsalomon wrote: > just ...
6 years, 10 months ago (2014-02-12 17:24:09 UTC) #5
reed1
The CQ bit was checked by reed@google.com
6 years, 10 months ago (2014-02-12 17:24:16 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/reed@google.com/159723006/140001
6 years, 10 months ago (2014-02-12 17:24:22 UTC) #7
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 10 months ago (2014-02-12 17:29:38 UTC) #8
commit-bot: I haz the power
Retried try job too often on Build-Ubuntu12-GCC-x86_64-Release-Trybot for step(s) BuildSkiaLib http://108.170.219.164:10117/buildstatus?builder=Build-Ubuntu12-GCC-x86_64-Release-Trybot&number=1453
6 years, 10 months ago (2014-02-12 17:29:38 UTC) #9
scroggo
https://codereview.chromium.org/159723006/diff/140001/include/core/SkCanvas.h File include/core/SkCanvas.h (right): https://codereview.chromium.org/159723006/diff/140001/include/core/SkCanvas.h#newcode81 include/core/SkCanvas.h:81: * (cpu or gpu), then the info's ColorType will ...
6 years, 10 months ago (2014-02-12 18:40:57 UTC) #10
reed2
6 years, 10 months ago (2014-02-13 14:43:34 UTC) #11
https://codereview.chromium.org/159723006/diff/140001/include/core/SkCanvas.h
File include/core/SkCanvas.h (right):

https://codereview.chromium.org/159723006/diff/140001/include/core/SkCanvas.h...
include/core/SkCanvas.h:143: *  canvas canvas (or its parent surface if any)
will invalidate the
On 2014/02/12 18:40:58, scroggo wrote:
> "canvas canvas" -> "canvas"

Done.

https://codereview.chromium.org/159723006/diff/140001/include/core/SkCanvas.h...
include/core/SkCanvas.h:1242: *  succed (though be slower, since it will return
a copy of the pixels).
On 2014/02/12 18:40:58, scroggo wrote:
> succeed*

Done.

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

https://codereview.chromium.org/159723006/diff/140001/src/core/SkCanvas.cpp#n...
src/core/SkCanvas.cpp:1032: const SkBitmap& bm =
canvas->getDevice()->accessBitmap(false);
On 2014/02/12 18:40:58, scroggo wrote:
> Is this just here for comparison?

Just for local testing, will remove.

https://codereview.chromium.org/159723006/diff/140001/tests/SurfaceTest.cpp
File tests/SurfaceTest.cpp (right):

https://codereview.chromium.org/159723006/diff/140001/tests/SurfaceTest.cpp#n...
tests/SurfaceTest.cpp:178: continue;   // gpu may not be enabled
On 2014/02/12 18:40:58, scroggo wrote:
> This could hide errors if one of the others fails to get created.

Done.

Powered by Google App Engine
This is Rietveld 408576698