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

Side by Side Diff: third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.cpp

Issue 2572873002: Add ColorBehavior plumbing for 2D canvas drawImage (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/csspaint/PaintRenderingContext2D.h" 5 #include "modules/csspaint/PaintRenderingContext2D.h"
6 6
7 #include "platform/graphics/ImageBuffer.h" 7 #include "platform/graphics/ImageBuffer.h"
8 #include <memory> 8 #include <memory>
9 9
10 namespace blink { 10 namespace blink {
(...skipping 29 matching lines...) Expand all
40 bool PaintRenderingContext2D::parseColorOrCurrentColor( 40 bool PaintRenderingContext2D::parseColorOrCurrentColor(
41 Color& color, 41 Color& color,
42 const String& colorString) const { 42 const String& colorString) const {
43 // We ignore "currentColor" for PaintRenderingContext2D and just make it 43 // We ignore "currentColor" for PaintRenderingContext2D and just make it
44 // "black". "currentColor" can be emulated by having "color" as an input 44 // "black". "currentColor" can be emulated by having "color" as an input
45 // property for the css-paint-api. 45 // property for the css-paint-api.
46 // https://github.com/w3c/css-houdini-drafts/issues/133 46 // https://github.com/w3c/css-houdini-drafts/issues/133
47 return ::blink::parseColorOrCurrentColor(color, colorString, nullptr); 47 return ::blink::parseColorOrCurrentColor(color, colorString, nullptr);
48 } 48 }
49 49
50 ColorBehavior PaintRenderingContext2D::drawImageColorBehavior() const {
51 return ColorBehavior::transformToGlobalTarget();
52 }
53
50 SkCanvas* PaintRenderingContext2D::drawingCanvas() const { 54 SkCanvas* PaintRenderingContext2D::drawingCanvas() const {
51 return m_imageBuffer->canvas(); 55 return m_imageBuffer->canvas();
52 } 56 }
53 57
54 SkCanvas* PaintRenderingContext2D::existingDrawingCanvas() const { 58 SkCanvas* PaintRenderingContext2D::existingDrawingCanvas() const {
55 ASSERT(m_imageBuffer); 59 ASSERT(m_imageBuffer);
56 return m_imageBuffer->canvas(); 60 return m_imageBuffer->canvas();
57 } 61 }
58 62
59 AffineTransform PaintRenderingContext2D::baseTransform() const { 63 AffineTransform PaintRenderingContext2D::baseTransform() const {
60 ASSERT(m_imageBuffer); 64 ASSERT(m_imageBuffer);
61 return m_imageBuffer->baseTransform(); 65 return m_imageBuffer->baseTransform();
62 } 66 }
63 67
64 void PaintRenderingContext2D::didDraw(const SkIRect& dirtyRect) { 68 void PaintRenderingContext2D::didDraw(const SkIRect& dirtyRect) {
65 ASSERT(m_imageBuffer); 69 ASSERT(m_imageBuffer);
66 return m_imageBuffer->didDraw(SkRect::Make(dirtyRect)); 70 return m_imageBuffer->didDraw(SkRect::Make(dirtyRect));
67 } 71 }
68 72
69 void PaintRenderingContext2D::validateStateStack() const { 73 void PaintRenderingContext2D::validateStateStack() const {
70 #if DCHECK_IS_ON() 74 #if DCHECK_IS_ON()
71 if (SkCanvas* skCanvas = existingDrawingCanvas()) { 75 if (SkCanvas* skCanvas = existingDrawingCanvas()) {
72 DCHECK_EQ(static_cast<size_t>(skCanvas->getSaveCount()), 76 DCHECK_EQ(static_cast<size_t>(skCanvas->getSaveCount()),
73 m_stateStack.size() + 1); 77 m_stateStack.size() + 1);
74 } 78 }
75 #endif 79 #endif
76 } 80 }
77 81
78 } // namespace blink 82 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698