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

Issue 1093673002: Removing the dependency on GraphicsContext for drawing images in 2D canvas (Closed)

Created:
5 years, 8 months ago by Justin Novosad
Modified:
5 years, 6 months ago
CC:
aandrey+blink_chromium.org, blink-reviews, blink-reviews-html_chromium.org, blink-reviews-paint_chromium.org, Rik, danakj, dcheng, dglazkov+blink, Dominik Röttsches, dshwang, krit, ed+blinkwatch_opera.com, eric.carlson_apple.com, feature-media-reviews_chromium.org, f(malita), fs, gyuyoung2, jbroman, kouhei+svg_chromium.org, pdr+graphicswatchlist_chromium.org, pdr+svgwatchlist_chromium.org, philipj_slow, rwlbuis, Stephen Chennney, slimming-paint-reviews_chromium.org
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Removing the dependency on GraphicsContext for drawing images in 2D canvas Is change is the final step in removing the GraphicsContext dependency from CanvasRenderingContext2D. It changes blink::Image and all of its child classes to make them draw directly to SkCanvas without a GraphicsContext. The interactions between GraphicsContext and Image subclasses are also simplified because the SkCanvas is no longer encapsulated, which was not possible before because GraphicsContext used to be an abstraction layer back in the WebKit days. BUG=453113 TEST=all existing layout tests that use images and/or canvases. NOTRY=true Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=196424

Patch Set 1 #

Total comments: 1

Patch Set 2 : build fixes for mac and win #

Patch Set 3 : fix for overdraw optimization failures and fix for mac build #

Total comments: 11

Patch Set 4 : fixed some bugs #

Patch Set 5 : mega rebase #

Patch Set 6 : fixed issue with svg #

Patch Set 7 : Fix anti-aliasing #

Patch Set 8 : fix mac build #

Patch Set 9 : fix svg stuff #

Total comments: 1

Patch Set 10 : pdr corrections + needsrebaselines #

Total comments: 13

Patch Set 11 : apllied senorblanco feedback #

Total comments: 5

Patch Set 12 : rebase #

Total comments: 1

Patch Set 13 : fixup #

Total comments: 2

Patch Set 14 : bikeshed #

Patch Set 15 : fixing crash #

Patch Set 16 : fixing unit test #

Patch Set 17 : fix save/restore ballance #

Patch Set 18 : consolidated rebaselines #

Patch Set 19 : fix merge error #

Patch Set 20 : rebase #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+531 lines, -753 lines) Patch
M LayoutTests/TestExpectations View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +20 lines, -0 lines 0 comments Download
M Source/core/frame/ImageBitmap.cpp View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/html/HTMLCanvasElement.h View 1 2 3 4 5 6 7 8 9 10 3 chunks +0 lines, -3 lines 0 comments Download
M Source/core/html/HTMLCanvasElement.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 7 chunks +2 lines, -23 lines 0 comments Download
M Source/core/html/HTMLVideoElement.h View 1 2 3 2 chunks +3 lines, -5 lines 0 comments Download
M Source/core/html/HTMLVideoElement.cpp View 1 2 3 4 5 6 7 8 9 10 2 chunks +8 lines, -5 lines 0 comments Download
M Source/core/html/canvas/CanvasRenderingContext2D.h View 1 2 3 4 5 6 7 8 9 10 3 chunks +7 lines, -5 lines 0 comments Download
M Source/core/html/canvas/CanvasRenderingContext2D.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 18 43 chunks +100 lines, -154 lines 0 comments Download
M Source/core/html/canvas/CanvasRenderingContext2DState.h View 1 2 3 4 5 6 7 8 9 10 3 chunks +5 lines, -0 lines 0 comments Download
M Source/core/html/canvas/CanvasRenderingContext2DState.cpp View 1 2 3 4 5 6 7 8 9 10 7 chunks +35 lines, -3 lines 0 comments Download
M Source/core/html/canvas/CanvasRenderingContext2DTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +2 lines, -2 lines 0 comments Download
M Source/core/html/canvas/WebGLRenderingContextBase.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +2 lines, -2 lines 0 comments Download
M Source/core/layout/ImageQualityControllerTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +17 lines, -17 lines 0 comments Download
M Source/core/paint/ThemePainterMac.mm View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M Source/core/paint/VideoPainter.cpp View 1 2 3 4 1 chunk +6 lines, -4 lines 0 comments Download
M Source/core/svg/graphics/SVGImage.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +16 lines, -16 lines 0 comments Download
M Source/core/svg/graphics/SVGImage.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 8 chunks +36 lines, -20 lines 0 comments Download
M Source/core/svg/graphics/SVGImageForContainer.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -1 line 0 comments Download
M Source/core/svg/graphics/SVGImageForContainer.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +3 lines, -3 lines 0 comments Download
M Source/platform/DragImageTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +5 lines, -5 lines 0 comments Download
M Source/platform/graphics/BitmapImage.h View 1 2 3 4 5 6 7 8 9 10 11 12 6 chunks +20 lines, -18 lines 0 comments Download
M Source/platform/graphics/BitmapImage.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +36 lines, -26 lines 6 comments Download
M Source/platform/graphics/CrossfadeGeneratedImage.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -3 lines 0 comments Download
M Source/platform/graphics/CrossfadeGeneratedImage.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +41 lines, -39 lines 0 comments Download
M Source/platform/graphics/GradientGeneratedImage.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -3 lines 0 comments Download
M Source/platform/graphics/GradientGeneratedImage.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +9 lines, -8 lines 0 comments Download
M Source/platform/graphics/GraphicsContext.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 10 chunks +5 lines, -42 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 14 chunks +48 lines, -193 lines 0 comments Download
M Source/platform/graphics/GraphicsContextState.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 6 chunks +0 lines, -30 lines 0 comments Download
M Source/platform/graphics/GraphicsContextState.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 10 chunks +9 lines, -40 lines 0 comments Download
M Source/platform/graphics/Image.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 4 chunks +11 lines, -3 lines 0 comments Download
M Source/platform/graphics/Image.cpp View 1 2 3 4 5 6 7 8 9 10 3 chunks +7 lines, -22 lines 0 comments Download
M Source/platform/graphics/ImageLayerChromiumTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -1 line 0 comments Download
M Source/platform/graphics/StaticBitmapImage.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +3 lines, -1 line 0 comments Download
M Source/platform/graphics/StaticBitmapImage.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +10 lines, -18 lines 0 comments Download
M Source/platform/graphics/skia/SkiaUtils.h View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +5 lines, -6 lines 0 comments Download
M Source/platform/graphics/skia/SkiaUtils.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +52 lines, -30 lines 0 comments Download

Messages

Total messages: 46 (15 generated)
Justin Novosad
PTAL Note: This patch is still missing "NeedsRebaseline", and theres going to be lots of ...
5 years, 8 months ago (2015-04-16 18:12:36 UTC) #2
Justin Novosad
https://codereview.chromium.org/1093673002/diff/1/Source/core/html/canvas/CanvasRenderingContext2D.cpp File Source/core/html/canvas/CanvasRenderingContext2D.cpp (left): https://codereview.chromium.org/1093673002/diff/1/Source/core/html/canvas/CanvasRenderingContext2D.cpp#oldcode64 Source/core/html/canvas/CanvasRenderingContext2D.cpp:64: #include "platform/graphics/GraphicsContext.h" I enjoyed deleting this line. Booyah! \o/
5 years, 8 months ago (2015-04-16 18:15:31 UTC) #3
Stephen White
On 2015/04/16 18:15:31, junov wrote: > https://codereview.chromium.org/1093673002/diff/1/Source/core/html/canvas/CanvasRenderingContext2D.cpp > File Source/core/html/canvas/CanvasRenderingContext2D.cpp (left): > > https://codereview.chromium.org/1093673002/diff/1/Source/core/html/canvas/CanvasRenderingContext2D.cpp#oldcode64 > ...
5 years, 8 months ago (2015-04-17 15:12:17 UTC) #5
Stephen White
Stephen C. and/or Florin should take a look at this too. Looks good for the ...
5 years, 8 months ago (2015-04-17 15:14:56 UTC) #6
f(malita)
Nice! Non-CRC2D LGTM w/ nits. https://codereview.chromium.org/1093673002/diff/40001/Source/platform/graphics/CrossfadeGeneratedImage.cpp File Source/platform/graphics/CrossfadeGeneratedImage.cpp (right): https://codereview.chromium.org/1093673002/diff/40001/Source/platform/graphics/CrossfadeGeneratedImage.cpp#newcode55 Source/platform/graphics/CrossfadeGeneratedImage.cpp:55: compositeOp = SkXfermode::kSrcOver_Mode; Nit: ...
5 years, 8 months ago (2015-04-17 16:18:32 UTC) #7
Justin Novosad
New Patch! Since previous review (patch set 3) I have done: 1. A whole lot ...
5 years, 7 months ago (2015-05-27 00:27:04 UTC) #9
Justin Novosad
+pdr for core/svg
5 years, 7 months ago (2015-05-27 00:27:48 UTC) #10
pdr.
core/svg LGTM with a nit. https://codereview.chromium.org/1093673002/diff/160001/Source/core/svg/graphics/SVGImage.cpp File Source/core/svg/graphics/SVGImage.cpp (right): https://codereview.chromium.org/1093673002/diff/160001/Source/core/svg/graphics/SVGImage.cpp#newcode308 Source/core/svg/graphics/SVGImage.cpp:308: bool needsLayer = false; ...
5 years, 7 months ago (2015-05-27 04:23:30 UTC) #11
Justin Novosad
New Patch: applied pdr's comment + added NeedsRebaseline on two svg layout tests. Diffs look ...
5 years, 7 months ago (2015-05-27 14:23:51 UTC) #12
Stephen White
https://codereview.chromium.org/1093673002/diff/180001/Source/core/html/HTMLCanvasElement.cpp File Source/core/html/HTMLCanvasElement.cpp (left): https://codereview.chromium.org/1093673002/diff/180001/Source/core/html/HTMLCanvasElement.cpp#oldcode687 Source/core/html/HTMLCanvasElement.cpp:687: m_imageBuffer->context()->setImageInterpolationQuality(CanvasDefaultInterpolationQuality); Is this still used / necessary? If we're ...
5 years, 7 months ago (2015-05-27 15:46:02 UTC) #13
Justin Novosad
https://codereview.chromium.org/1093673002/diff/180001/Source/core/html/HTMLCanvasElement.cpp File Source/core/html/HTMLCanvasElement.cpp (left): https://codereview.chromium.org/1093673002/diff/180001/Source/core/html/HTMLCanvasElement.cpp#oldcode687 Source/core/html/HTMLCanvasElement.cpp:687: m_imageBuffer->context()->setImageInterpolationQuality(CanvasDefaultInterpolationQuality); On 2015/05/27 15:46:02, Stephen White wrote: > Is ...
5 years, 7 months ago (2015-05-27 20:08:16 UTC) #14
chrishtr
What about the use case where HTMLCanvasElement creates an ImageBuffer, which in turn relies on ...
5 years, 6 months ago (2015-05-28 21:08:25 UTC) #16
Justin Novosad
On 2015/05/28 21:08:25, chrishtr wrote: > What about the use case where HTMLCanvasElement creates an ...
5 years, 6 months ago (2015-05-29 15:10:38 UTC) #17
Justin Novosad
New patch.
5 years, 6 months ago (2015-05-29 16:20:40 UTC) #18
Justin Novosad
Most significant diff wrt previous patch is that I factored out the filter quality helper ...
5 years, 6 months ago (2015-05-29 16:24:40 UTC) #19
Stephen White
https://codereview.chromium.org/1093673002/diff/200001/Source/core/html/HTMLCanvasElement.cpp File Source/core/html/HTMLCanvasElement.cpp (right): https://codereview.chromium.org/1093673002/diff/200001/Source/core/html/HTMLCanvasElement.cpp#newcode681 Source/core/html/HTMLCanvasElement.cpp:681: toCanvasRenderingContext2D(m_context.get())->setShouldAntialias(!disableAntiAliasing); Perhaps we should make the default for CRC2D ...
5 years, 6 months ago (2015-05-29 17:26:37 UTC) #20
Justin Novosad
Done.
5 years, 6 months ago (2015-05-29 21:25:30 UTC) #21
Stephen White
LGTM w/enum nit fixed https://codereview.chromium.org/1093673002/diff/240001/Source/platform/graphics/Image.h File Source/platform/graphics/Image.h (right): https://codereview.chromium.org/1093673002/diff/240001/Source/platform/graphics/Image.h#newcode146 Source/platform/graphics/Image.h:146: DoNotClampImage Nit: DoNotClampImageToSourceRect? https://codereview.chromium.org/1093673002/diff/240001/Source/platform/graphics/skia/SkiaUtils.h File ...
5 years, 6 months ago (2015-05-29 21:38:52 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1093673002/260001
5 years, 6 months ago (2015-05-29 22:01:04 UTC) #25
commit-bot: I haz the power
Try jobs failed on following builders: linux_blink_rel on tryserver.blink (JOB_FAILED, http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/63994)
5 years, 6 months ago (2015-05-29 23:04:11 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1093673002/360001
5 years, 6 months ago (2015-06-01 19:30:47 UTC) #30
commit-bot: I haz the power
Try jobs failed on following builders: blink_presubmit on tryserver.blink (JOB_FAILED, http://build.chromium.org/p/tryserver.blink/builders/blink_presubmit/builds/34232) win_blink_rel on tryserver.blink (JOB_FAILED, ...
5 years, 6 months ago (2015-06-01 19:40:09 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1093673002/380001
5 years, 6 months ago (2015-06-03 15:10:06 UTC) #35
commit-bot: I haz the power
Try jobs failed on following builders: win_blink_rel on tryserver.blink (JOB_FAILED, http://build.chromium.org/p/tryserver.blink/builders/win_blink_rel/builds/65047)
5 years, 6 months ago (2015-06-03 17:40:24 UTC) #37
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1093673002/380001
5 years, 6 months ago (2015-06-03 19:10:18 UTC) #39
commit-bot: I haz the power
Committed patchset #20 (id:380001) as https://src.chromium.org/viewvc/blink?view=rev&revision=196424
5 years, 6 months ago (2015-06-03 19:15:19 UTC) #40
chrishtr
\o/
5 years, 6 months ago (2015-06-03 19:56:42 UTC) #41
Noel Gordon
Some comments re the other bug we are discussing about filters. https://codereview.chromium.org/1093673002/diff/380001/Source/platform/graphics/BitmapImage.cpp File Source/platform/graphics/BitmapImage.cpp (right): ...
5 years, 6 months ago (2015-06-10 12:21:15 UTC) #43
Justin Novosad
https://codereview.chromium.org/1093673002/diff/380001/Source/platform/graphics/BitmapImage.cpp File Source/platform/graphics/BitmapImage.cpp (right): https://codereview.chromium.org/1093673002/diff/380001/Source/platform/graphics/BitmapImage.cpp#newcode299 Source/platform/graphics/BitmapImage.cpp:299: void BitmapImage::draw(SkCanvas* canvas, const SkPaint& paint, const FloatRect& dstRect, ...
5 years, 6 months ago (2015-06-10 13:46:02 UTC) #44
Noel Gordon
> On 2015/06/10 12:21:15, noel gordon wrote: > > Previously, this routine created its SkPaint ...
5 years, 6 months ago (2015-06-10 15:43:46 UTC) #45
Noel Gordon
5 years, 6 months ago (2015-06-10 15:52:48 UTC) #46
Message was sent while issue was closed.
On 2015/06/10 13:46:02, Justin Novosad wrote:

> On 2015/06/10 12:21:15, noel gordon wrote:
> > Anyho, as we are discussion on another bug, I can interpolate an appropriate
> > SkColorFilter about here, and add it to the SkPaint ...
> 
> Yes, just create a local non-const copy of paint, and add the filter to it.

Thanks Justin, works for me.

>
https://codereview.chromium.org/1093673002/diff/380001/Source/platform/graphi...
> Source/platform/graphics/BitmapImage.cpp:340:
> canvas->drawBitmapRectToRect(bitmap, &skSrcRect, adjustedDstRect, &paint,
> flags);
> On 2015/06/10 12:21:15, noel gordon wrote:
> > ... and the drawBitmapRectToRect records the SkPaint.  Hence, my
SkColorFilter
> > gets sent to the impl-side where it is applied to this bitmap image, right?
> 
> Yes

k, we'll call this the meet up at the pass point :) Thanks for your answers, and
nice patch btw.

Powered by Google App Engine
This is Rietveld 408576698