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

Side by Side Diff: third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.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 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 return nullptr; 130 return nullptr;
131 sk_sp<SkImage> skImage = m_imageBuffer->newSkImageSnapshot(PreferAcceleratio n, SnapshotReasonTransferToImageBitmap); 131 sk_sp<SkImage> skImage = m_imageBuffer->newSkImageSnapshot(PreferAcceleratio n, SnapshotReasonTransferToImageBitmap);
132 DCHECK(isMainThread() || !skImage->isTextureBacked()); // Acceleration not y et supported in Workers 132 DCHECK(isMainThread() || !skImage->isTextureBacked()); // Acceleration not y et supported in Workers
133 RefPtr<StaticBitmapImage> image = StaticBitmapImage::create(std::move(skImag e)); 133 RefPtr<StaticBitmapImage> image = StaticBitmapImage::create(std::move(skImag e));
134 image->setOriginClean(this->originClean()); 134 image->setOriginClean(this->originClean());
135 m_imageBuffer.reset(); // "Transfer" means no retained buffer 135 m_imageBuffer.reset(); // "Transfer" means no retained buffer
136 m_needsMatrixClipRestore = true; 136 m_needsMatrixClipRestore = true;
137 return ImageBitmap::create(image.release()); 137 return ImageBitmap::create(image.release());
138 } 138 }
139 139
140 PassRefPtr<Image> OffscreenCanvasRenderingContext2D::getImage(SnapshotReason rea son) const 140 PassRefPtr<Image> OffscreenCanvasRenderingContext2D::getImage(AccelerationHint h int, SnapshotReason reason) const
141 { 141 {
142 if (!imageBuffer()) 142 if (!imageBuffer())
143 return nullptr; 143 return nullptr;
144 sk_sp<SkImage> skImage = m_imageBuffer->newSkImageSnapshot(PreferAcceleratio n, reason); 144 sk_sp<SkImage> skImage = m_imageBuffer->newSkImageSnapshot(hint, reason);
145 RefPtr<StaticBitmapImage> image = StaticBitmapImage::create(std::move(skImag e)); 145 RefPtr<StaticBitmapImage> image = StaticBitmapImage::create(std::move(skImag e));
146 return image; 146 return image;
147 } 147 }
148 148
149 void OffscreenCanvasRenderingContext2D::setOffscreenCanvasGetContextResult(Offsc reenRenderingContext& result) 149 void OffscreenCanvasRenderingContext2D::setOffscreenCanvasGetContextResult(Offsc reenRenderingContext& result)
150 { 150 {
151 result.setOffscreenCanvasRenderingContext2D(this); 151 result.setOffscreenCanvasRenderingContext2D(this);
152 } 152 }
153 153
154 bool OffscreenCanvasRenderingContext2D::parseColorOrCurrentColor(Color& color, c onst String& colorString) const 154 bool OffscreenCanvasRenderingContext2D::parseColorOrCurrentColor(Color& color, c onst String& colorString) const
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 bool OffscreenCanvasRenderingContext2D::isContextLost() const 211 bool OffscreenCanvasRenderingContext2D::isContextLost() const
212 { 212 {
213 return false; 213 return false;
214 } 214 }
215 215
216 bool OffscreenCanvasRenderingContext2D::isPaintable() const 216 bool OffscreenCanvasRenderingContext2D::isPaintable() const
217 { 217 {
218 return this->imageBuffer(); 218 return this->imageBuffer();
219 } 219 }
220 } 220 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698