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/offscreencanvas2d/OffscreenCanvasRenderingContext2D.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/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h" 5 #include "modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h"
6 6
7 #include "bindings/modules/v8/OffscreenCanvasRenderingContext2DOrWebGLRenderingC ontextOrWebGL2RenderingContext.h" 7 #include "bindings/modules/v8/OffscreenCanvasRenderingContext2DOrWebGLRenderingC ontextOrWebGL2RenderingContext.h"
8 #include "core/frame/ImageBitmap.h" 8 #include "core/frame/ImageBitmap.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/workers/WorkerGlobalScope.h" 10 #include "core/workers/WorkerGlobalScope.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 bool OffscreenCanvasRenderingContext2D::hasImageBuffer() const { 99 bool OffscreenCanvasRenderingContext2D::hasImageBuffer() const {
100 return !!m_imageBuffer; 100 return !!m_imageBuffer;
101 } 101 }
102 102
103 void OffscreenCanvasRenderingContext2D::reset() { 103 void OffscreenCanvasRenderingContext2D::reset() {
104 m_imageBuffer = nullptr; 104 m_imageBuffer = nullptr;
105 BaseRenderingContext2D::reset(); 105 BaseRenderingContext2D::reset();
106 } 106 }
107 107
108 ColorBehavior OffscreenCanvasRenderingContext2D::drawImageColorBehavior()
109 const {
110 return CanvasRenderingContext::colorBehaviorForMediaDrawnToCanvas();
111 }
112
108 ImageBuffer* OffscreenCanvasRenderingContext2D::imageBuffer() const { 113 ImageBuffer* OffscreenCanvasRenderingContext2D::imageBuffer() const {
109 if (!m_imageBuffer) { 114 if (!m_imageBuffer) {
110 IntSize surfaceSize(width(), height()); 115 IntSize surfaceSize(width(), height());
111 OpacityMode opacityMode = hasAlpha() ? NonOpaque : Opaque; 116 OpacityMode opacityMode = hasAlpha() ? NonOpaque : Opaque;
112 std::unique_ptr<ImageBufferSurface> surface; 117 std::unique_ptr<ImageBufferSurface> surface;
113 if (RuntimeEnabledFeatures::accelerated2dCanvasEnabled()) { 118 if (RuntimeEnabledFeatures::accelerated2dCanvasEnabled()) {
114 surface.reset( 119 surface.reset(
115 new AcceleratedImageBufferSurface(surfaceSize, opacityMode)); 120 new AcceleratedImageBufferSurface(surfaceSize, opacityMode));
116 } 121 }
117 122
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 251 }
247 252
248 bool OffscreenCanvasRenderingContext2D::isContextLost() const { 253 bool OffscreenCanvasRenderingContext2D::isContextLost() const {
249 return false; 254 return false;
250 } 255 }
251 256
252 bool OffscreenCanvasRenderingContext2D::isPaintable() const { 257 bool OffscreenCanvasRenderingContext2D::isPaintable() const {
253 return this->imageBuffer(); 258 return this->imageBuffer();
254 } 259 }
255 } 260 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698