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

Side by Side Diff: third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.cpp

Issue 2508943003: Make OffscreenCanvas resizeable (Closed)
Patch Set: Created 4 years, 1 month 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 94
95 int OffscreenCanvasRenderingContext2D::height() const { 95 int OffscreenCanvasRenderingContext2D::height() const {
96 return getOffscreenCanvas()->height(); 96 return getOffscreenCanvas()->height();
97 } 97 }
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() {
104 m_imageBuffer = nullptr;
xlai (Olivia) 2016/11/21 16:26:57 This function's implementation doesn't look correc
xlai (Olivia) 2016/11/21 19:56:17 Ah I just realize that the image buffer (with a ne
105 BaseRenderingContext2D::reset();
106 }
107
103 ImageBuffer* OffscreenCanvasRenderingContext2D::imageBuffer() const { 108 ImageBuffer* OffscreenCanvasRenderingContext2D::imageBuffer() const {
104 if (!m_imageBuffer) { 109 if (!m_imageBuffer) {
105 IntSize surfaceSize(width(), height()); 110 IntSize surfaceSize(width(), height());
106 OpacityMode opacityMode = hasAlpha() ? NonOpaque : Opaque; 111 OpacityMode opacityMode = hasAlpha() ? NonOpaque : Opaque;
107 std::unique_ptr<ImageBufferSurface> surface; 112 std::unique_ptr<ImageBufferSurface> surface;
108 if (RuntimeEnabledFeatures::accelerated2dCanvasEnabled()) { 113 if (RuntimeEnabledFeatures::accelerated2dCanvasEnabled()) {
109 surface.reset( 114 surface.reset(
110 new AcceleratedImageBufferSurface(surfaceSize, opacityMode)); 115 new AcceleratedImageBufferSurface(surfaceSize, opacityMode));
111 } 116 }
112 117
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } 246 }
242 247
243 bool OffscreenCanvasRenderingContext2D::isContextLost() const { 248 bool OffscreenCanvasRenderingContext2D::isContextLost() const {
244 return false; 249 return false;
245 } 250 }
246 251
247 bool OffscreenCanvasRenderingContext2D::isPaintable() const { 252 bool OffscreenCanvasRenderingContext2D::isPaintable() const {
248 return this->imageBuffer(); 253 return this->imageBuffer();
249 } 254 }
250 } 255 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698