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

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

Issue 2320663002: Fix performance regression in WebGL to 2D canvas draws. (Closed)
Patch Set: Created 4 years, 3 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"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 return nullptr; 62 return nullptr;
63 } 63 }
64 ImageBitmap* image = m_context->transferToImageBitmap(exceptionState); 64 ImageBitmap* image = m_context->transferToImageBitmap(exceptionState);
65 if (!image) { 65 if (!image) {
66 // Undocumented exception (not in spec) 66 // Undocumented exception (not in spec)
67 exceptionState.throwDOMException(V8Error, "Out of memory"); 67 exceptionState.throwDOMException(V8Error, "Out of memory");
68 } 68 }
69 return image; 69 return image;
70 } 70 }
71 71
72 PassRefPtr<Image> OffscreenCanvas::getSourceImageForCanvas(SourceImageStatus* st atus, AccelerationHint, SnapshotReason reason, const FloatSize&) const 72 PassRefPtr<Image> OffscreenCanvas::getSourceImageForCanvas(SourceImageStatus* st atus, AccelerationHint hint, SnapshotReason reason, const FloatSize&) const
73 { 73 {
74 if (!m_context) { 74 if (!m_context) {
75 *status = InvalidSourceImageStatus; 75 *status = InvalidSourceImageStatus;
76 return nullptr; 76 return nullptr;
77 } 77 }
78 *status = NormalSourceImageStatus; 78 *status = NormalSourceImageStatus;
79 return m_context->getImage(reason); 79 return m_context->getImage(hint, reason);
80 } 80 }
81 81
82 bool OffscreenCanvas::isOpaque() const 82 bool OffscreenCanvas::isOpaque() const
83 { 83 {
84 if (!m_context) 84 if (!m_context)
85 return false; 85 return false;
86 return !m_context->creationAttributes().hasAlpha(); 86 return !m_context->creationAttributes().hasAlpha();
87 } 87 }
88 88
89 CanvasRenderingContext* OffscreenCanvas::getCanvasRenderingContext(ScriptState* scriptState, const String& id, const CanvasContextCreationAttributes& attributes ) 89 CanvasRenderingContext* OffscreenCanvas::getCanvasRenderingContext(ScriptState* scriptState, const String& id, const CanvasContextCreationAttributes& attributes )
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 m_frameDispatcher = wrapUnique(new OffscreenCanvasFrameDispatcherImpl(m_ clientId, m_localId, m_nonce, width(), height())); 148 m_frameDispatcher = wrapUnique(new OffscreenCanvasFrameDispatcherImpl(m_ clientId, m_localId, m_nonce, width(), height()));
149 return m_frameDispatcher.get(); 149 return m_frameDispatcher.get();
150 } 150 }
151 151
152 DEFINE_TRACE(OffscreenCanvas) 152 DEFINE_TRACE(OffscreenCanvas)
153 { 153 {
154 visitor->trace(m_context); 154 visitor->trace(m_context);
155 } 155 }
156 156
157 } // namespace blink 157 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698