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

Side by Side Diff: third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp

Issue 2517343003: Update Resize information from OffscreenCanvas to OffscreenCanvasFrameDispatcher (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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "core/offscreencanvas/OffscreenCanvas.h" 5 #include "core/offscreencanvas/OffscreenCanvas.h"
6 6
7 #include "core/dom/ExceptionCode.h" 7 #include "core/dom/ExceptionCode.h"
8 #include "core/fileapi/Blob.h" 8 #include "core/fileapi/Blob.h"
9 #include "core/html/ImageData.h" 9 #include "core/html/ImageData.h"
10 #include "core/html/canvas/CanvasAsyncBlobCreator.h" 10 #include "core/html/canvas/CanvasAsyncBlobCreator.h"
(...skipping 24 matching lines...) Expand all
35 setSize(newSize); 35 setSize(newSize);
36 } 36 }
37 37
38 void OffscreenCanvas::setHeight(unsigned height) { 38 void OffscreenCanvas::setHeight(unsigned height) {
39 IntSize newSize = m_size; 39 IntSize newSize = m_size;
40 newSize.setHeight(clampTo<int>(height)); 40 newSize.setHeight(clampTo<int>(height));
41 setSize(newSize); 41 setSize(newSize);
42 } 42 }
43 43
44 void OffscreenCanvas::setSize(const IntSize& size) { 44 void OffscreenCanvas::setSize(const IntSize& size) {
45 if (size == m_size)
46 return;
45 if (m_context) { 47 if (m_context) {
46 if (m_context->is3d()) { 48 if (m_context->is3d()) {
47 if (size != m_size) 49 if (size != m_size)
48 m_context->reshape(size.width(), size.height()); 50 m_context->reshape(size.width(), size.height());
49 } else if (m_context->is2d()) { 51 } else if (m_context->is2d()) {
50 m_context->reset(); 52 m_context->reset();
51 } 53 }
52 } 54 }
53 m_size = size; 55 m_size = size;
56 if (m_frameDispatcher) {
57 m_frameDispatcher->reshape(width(), height());
xidachen 2016/11/22 18:41:45 As discussed offline, please change this to use m_
58 }
54 } 59 }
55 60
56 void OffscreenCanvas::setNeutered() { 61 void OffscreenCanvas::setNeutered() {
57 ASSERT(!m_context); 62 ASSERT(!m_context);
58 m_isNeutered = true; 63 m_isNeutered = true;
59 m_size.setWidth(0); 64 m_size.setWidth(0);
60 m_size.setHeight(0); 65 m_size.setHeight(0);
61 } 66 }
62 67
63 ImageBitmap* OffscreenCanvas::transferToImageBitmap( 68 ImageBitmap* OffscreenCanvas::transferToImageBitmap(
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 return resolver->promise(); 240 return resolver->promise();
236 } 241 }
237 242
238 DEFINE_TRACE(OffscreenCanvas) { 243 DEFINE_TRACE(OffscreenCanvas) {
239 visitor->trace(m_context); 244 visitor->trace(m_context);
240 visitor->trace(m_executionContext); 245 visitor->trace(m_executionContext);
241 EventTarget::trace(visitor); 246 EventTarget::trace(visitor);
242 } 247 }
243 248
244 } // namespace blink 249 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698