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

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

Issue 2255683005: Determine if OffscreenCanvas is paintable in different rendering contexts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Canvas2DTypecast
Patch Set: enum Created 4 years, 4 months 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 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/html/canvas/CanvasContextCreationAttributes.h" 8 #include "core/html/canvas/CanvasContextCreationAttributes.h"
9 #include "core/html/canvas/CanvasRenderingContext.h" 9 #include "core/html/canvas/CanvasRenderingContext.h"
10 #include "core/html/canvas/CanvasRenderingContextFactory.h" 10 #include "core/html/canvas/CanvasRenderingContextFactory.h"
11 #include "platform/graphics/ImageBuffer.h"
11 #include "wtf/MathExtras.h" 12 #include "wtf/MathExtras.h"
12 #include <memory> 13 #include <memory>
13 14
14 namespace blink { 15 namespace blink {
15 16
16 OffscreenCanvas::OffscreenCanvas(const IntSize& size) 17 OffscreenCanvas::OffscreenCanvas(const IntSize& size)
17 : m_size(size) 18 : m_size(size)
18 , m_originClean(true) 19 , m_originClean(true)
19 { 20 {
20 } 21 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 ASSERT(type < CanvasRenderingContext::ContextTypeCount); 103 ASSERT(type < CanvasRenderingContext::ContextTypeCount);
103 ASSERT(!renderingContextFactories()[type]); 104 ASSERT(!renderingContextFactories()[type]);
104 renderingContextFactories()[type] = std::move(renderingContextFactory); 105 renderingContextFactories()[type] = std::move(renderingContextFactory);
105 } 106 }
106 107
107 bool OffscreenCanvas::originClean() const 108 bool OffscreenCanvas::originClean() const
108 { 109 {
109 return m_originClean && !m_disableReadingFromCanvas; 110 return m_originClean && !m_disableReadingFromCanvas;
110 } 111 }
111 112
113 bool OffscreenCanvas::isPaintable() const
114 {
115 if (!m_context)
116 return ImageBuffer::canCreateImageBuffer(m_size);
Ken Russell (switch to Gerrit) 2016/08/19 20:31:01 How reliable is this query, and how much does that
117 return m_context->isPaintable();
118 }
119
112 DEFINE_TRACE(OffscreenCanvas) 120 DEFINE_TRACE(OffscreenCanvas)
113 { 121 {
114 visitor->trace(m_context); 122 visitor->trace(m_context);
115 } 123 }
116 124
117 } // namespace blink 125 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698