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

Issue 358893002: Use newImageSnapshot() to get an image from a Canvas (Closed)

Created:
6 years, 6 months ago by Rémi Piotaix
Modified:
6 years, 2 months ago
Reviewers:
Justin Novosad
CC:
blink-reviews, jamesr, krit, jbroman, danakj, Rik, pdr., rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

Use SkImage::newImageSnapshot() in CanvasIMageSource::getImageSourceForCanvas(). When repeatedly creating a pattern from a canvas or when doing a canvas-to-canvas copy, additional memory is allocated even if the canvas' content don't change between the calls to createPattern() (cf benchmark in the bug 344804, message #7). The idea is to use a SkImage obtained by calling newImageSnapshot() on the SkSurface encapsulated by the HTMLCanvasElement. This way a new bitmap is created only if the canvas is changed. This CL depends on the CLs: - https://codereview.chromium.org/416543002/ (merged) - https://codereview.chromium.org/406673003/ for SkImage::isOpaque() (merged) BUG=344804, 170021, 257428 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=182967

Patch Set 1 #

Patch Set 2 : Moving the m_shader 'cache management' part to the upper class #

Patch Set 3 : Created ImagePattern and StaticBitmapImage #

Total comments: 6

Patch Set 4 : Renaming ImagePattern to SkiaImagePattern + changing LICENCE in new files #

Patch Set 5 : Renamed SkiaImagePattern to StaticBitmapPattern #

Patch Set 6 : First try to inplement StaticBitmapImage::draw() #

Patch Set 7 : StaticBitmapImage::draw() now uses ctx::drawRect #

Patch Set 8 : Make use of StaticBitmapImage #

Patch Set 9 : Rebase master #

Patch Set 10 : Depends on CL 416543002, tests seems ok #

Patch Set 11 : Use StaticBitmapImage on non-accelerated cases #

Patch Set 12 : Correcting bugs and use new cache mechanism from SkImage #

Total comments: 67

Patch Set 13 : First corrections #

Patch Set 14 : Refactoring Pattern + corrections according to comments #

Patch Set 15 : Drop dependency on SkImage::info() #

Patch Set 16 : Bitmap caching for Shaders/Patterns from StaticBitmapImage/SkImage #

Total comments: 6

Patch Set 17 : Renaming BitmapBackedPatern in BitmapPatternBase #

Patch Set 18 : Correct implementation for StaticBitmapImage::currentFrameKnownToBeOpaque() #

Patch Set 19 : Rebase master #

Patch Set 20 : Drop dependency on previous caching strategy implementation #

Patch Set 21 : Correct error in StaticBitmapPattern #

Patch Set 22 : Fix tests #

Patch Set 23 : PLATFORM_EXPORT #

Patch Set 24 : Use SkCanvas::drawImageRect() instead of SkImage::draw() #

Patch Set 25 : Again in StaticBitmapPattern #

Total comments: 4

Patch Set 26 : Corrections #

Unified diffs Side-by-side diffs Delta from patch set Stats (+468 lines, -71 lines) Patch
M Source/core/html/HTMLCanvasElement.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 chunks +6 lines, -6 lines 0 comments Download
M Source/platform/blink_platform.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 chunks +8 lines, -0 lines 0 comments Download
A Source/platform/graphics/BitmapPattern.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +35 lines, -0 lines 0 comments Download
A Source/platform/graphics/BitmapPattern.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +52 lines, -0 lines 0 comments Download
A Source/platform/graphics/BitmapPatternBase.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +26 lines, -0 lines 0 comments Download
A Source/platform/graphics/BitmapPatternBase.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +66 lines, -0 lines 0 comments Download
M Source/platform/graphics/Canvas2DImageBufferSurface.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +3 lines, -0 lines 0 comments Download
M Source/platform/graphics/Canvas2DLayerBridge.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +4 lines, -2 lines 0 comments Download
M Source/platform/graphics/Canvas2DLayerBridge.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +6 lines, -0 lines 0 comments Download
M Source/platform/graphics/GraphicsContext.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 chunk +1 line, -0 lines 0 comments Download
M Source/platform/graphics/Image.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 2 chunks +4 lines, -0 lines 0 comments Download
M Source/platform/graphics/Image.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 2 chunks +6 lines, -0 lines 0 comments Download
M Source/platform/graphics/ImageBuffer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +2 lines, -0 lines 0 comments Download
M Source/platform/graphics/ImageBuffer.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +5 lines, -0 lines 0 comments Download
M Source/platform/graphics/ImageBufferSurface.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 3 chunks +4 lines, -1 line 0 comments Download
M Source/platform/graphics/ImageBufferSurface.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +8 lines, -0 lines 0 comments Download
M Source/platform/graphics/Pattern.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 3 chunks +16 lines, -6 lines 0 comments Download
M Source/platform/graphics/Pattern.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 2 chunks +23 lines, -56 lines 0 comments Download
A Source/platform/graphics/StaticBitmapImage.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 1 chunk +33 lines, -0 lines 0 comments Download
A Source/platform/graphics/StaticBitmapImage.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +64 lines, -0 lines 0 comments Download
A Source/platform/graphics/StaticBitmapPattern.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +32 lines, -0 lines 0 comments Download
A Source/platform/graphics/StaticBitmapPattern.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 1 chunk +58 lines, -0 lines 0 comments Download
M Source/platform/graphics/UnacceleratedImageBufferSurface.h View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M Source/platform/graphics/UnacceleratedImageBufferSurface.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 17 (1 generated)
Justin Novosad
https://codereview.chromium.org/358893002/diff/30001/Source/platform/blink_platform.gypi File Source/platform/blink_platform.gypi (right): https://codereview.chromium.org/358893002/diff/30001/Source/platform/blink_platform.gypi#newcode613 Source/platform/blink_platform.gypi:613: 'graphics/ImagePattern.cpp', Would be clearer to call this SkiaImagePattern https://codereview.chromium.org/358893002/diff/30001/Source/platform/graphics/ImagePattern.cpp ...
6 years, 5 months ago (2014-07-02 19:04:18 UTC) #1
Rémi Piotaix
https://codereview.chromium.org/358893002/diff/30001/Source/platform/blink_platform.gypi File Source/platform/blink_platform.gypi (right): https://codereview.chromium.org/358893002/diff/30001/Source/platform/blink_platform.gypi#newcode613 Source/platform/blink_platform.gypi:613: 'graphics/ImagePattern.cpp', On 2014/07/02 19:04:18, junov wrote: > Would be ...
6 years, 5 months ago (2014-07-02 20:21:33 UTC) #2
Stephen Chennney
I bit drive-by, sorry, but a couple of things caught my eye. A meta question: ...
6 years, 5 months ago (2014-07-02 20:57:33 UTC) #3
Rémi Piotaix
On 2014/07/02 20:57:33, Stephen Chenney wrote: > I bit drive-by, sorry, but a couple of ...
6 years, 5 months ago (2014-07-02 21:40:48 UTC) #4
Rémi Piotaix
I tried to implement StaticBitmapImage::draw() but I am probably wrong. This is NOT the final ...
6 years, 5 months ago (2014-07-04 18:56:28 UTC) #5
Rémi Piotaix
On 2014/07/04 18:56:28, Rémi Piotaix wrote: > I tried to implement StaticBitmapImage::draw() but I am ...
6 years, 5 months ago (2014-07-10 14:16:09 UTC) #6
Justin Novosad
https://codereview.chromium.org/358893002/diff/210001/Source/platform/graphics/BitmapPattern.cpp File Source/platform/graphics/BitmapPattern.cpp (right): https://codereview.chromium.org/358893002/diff/210001/Source/platform/graphics/BitmapPattern.cpp#newcode1 Source/platform/graphics/BitmapPattern.cpp:1: // Copyright 2014 The Chromium Authors. All rights reserved. ...
6 years, 4 months ago (2014-07-29 14:56:54 UTC) #7
Rémi Piotaix
https://codereview.chromium.org/358893002/diff/210001/Source/platform/graphics/BitmapPattern.cpp File Source/platform/graphics/BitmapPattern.cpp (right): https://codereview.chromium.org/358893002/diff/210001/Source/platform/graphics/BitmapPattern.cpp#newcode1 Source/platform/graphics/BitmapPattern.cpp:1: // Copyright 2014 The Chromium Authors. All rights reserved. ...
6 years, 4 months ago (2014-07-29 17:18:24 UTC) #8
Rémi Piotaix
https://codereview.chromium.org/358893002/diff/210001/Source/platform/graphics/BitmapPattern.cpp File Source/platform/graphics/BitmapPattern.cpp (right): https://codereview.chromium.org/358893002/diff/210001/Source/platform/graphics/BitmapPattern.cpp#newcode84 Source/platform/graphics/BitmapPattern.cpp:84: bm2.eraseARGB(0x00, 0x00, 0x00, 0x00); On 2014/07/29 14:56:51, junov wrote: ...
6 years, 4 months ago (2014-07-30 18:59:13 UTC) #9
Rémi Piotaix
New patch: Cache system in SkImage[_Gpu] is now used for shaders created from SkImage (when ...
6 years, 4 months ago (2014-08-04 15:37:29 UTC) #10
Justin Novosad
https://codereview.chromium.org/358893002/diff/290001/Source/platform/graphics/Pattern.cpp File Source/platform/graphics/Pattern.cpp (right): https://codereview.chromium.org/358893002/diff/290001/Source/platform/graphics/Pattern.cpp#newcode81 Source/platform/graphics/Pattern.cpp:81: PassRefPtr<SkShader> BitmapBackedPattern::createShader(SkShader::ShaderLocation preferredLocation) unused argument should be commented-out https://codereview.chromium.org/358893002/diff/290001/Source/platform/graphics/Pattern.cpp#newcode107 ...
6 years, 4 months ago (2014-08-05 17:31:26 UTC) #11
Rémi Piotaix
https://codereview.chromium.org/358893002/diff/290001/Source/platform/graphics/Pattern.cpp File Source/platform/graphics/Pattern.cpp (right): https://codereview.chromium.org/358893002/diff/290001/Source/platform/graphics/Pattern.cpp#newcode81 Source/platform/graphics/Pattern.cpp:81: PassRefPtr<SkShader> BitmapBackedPattern::createShader(SkShader::ShaderLocation preferredLocation) On 2014/08/05 17:31:26, junov wrote: > ...
6 years, 4 months ago (2014-08-06 18:09:14 UTC) #12
Justin Novosad
lgtm with minor comments. We just branched. The time to throw this in is now. ...
6 years, 2 months ago (2014-09-30 17:37:56 UTC) #13
Rémi Piotaix
https://codereview.chromium.org/358893002/diff/470001/Source/platform/graphics/Image.cpp File Source/platform/graphics/Image.cpp (right): https://codereview.chromium.org/358893002/diff/470001/Source/platform/graphics/Image.cpp#newcode248 Source/platform/graphics/Image.cpp:248: PassRefPtr<SkImage> Image::image() On 2014/09/30 17:37:56, junov wrote: > Confusing ...
6 years, 2 months ago (2014-09-30 17:48:12 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/358893002/490001
6 years, 2 months ago (2014-09-30 17:49:05 UTC) #16
commit-bot: I haz the power
6 years, 2 months ago (2014-09-30 19:40:32 UTC) #17
Message was sent while issue was closed.
Committed patchset #26 (id:490001) as 182967

Powered by Google App Engine
This is Rietveld 408576698