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

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

Issue 2290903002: Change (Pass)RefPtr<SkXxx> into sk_sp<SkXxx>. (Closed)
Patch Set: Rebasing... 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 111 }
112 } 112 }
113 113
114 return m_imageBuffer.get(); 114 return m_imageBuffer.get();
115 } 115 }
116 116
117 ImageBitmap* OffscreenCanvasRenderingContext2D::transferToImageBitmap(ExceptionS tate& exceptionState) 117 ImageBitmap* OffscreenCanvasRenderingContext2D::transferToImageBitmap(ExceptionS tate& exceptionState)
118 { 118 {
119 if (!imageBuffer()) 119 if (!imageBuffer())
120 return nullptr; 120 return nullptr;
121 RefPtr<SkImage> skImage = m_imageBuffer->newSkImageSnapshot(PreferAccelerati on, SnapshotReasonTransferToImageBitmap); 121 sk_sp<SkImage> skImage = m_imageBuffer->newSkImageSnapshot(PreferAcceleratio n, SnapshotReasonTransferToImageBitmap);
122 DCHECK(isMainThread() || !skImage->isTextureBacked()); // Acceleration not y et supported in Workers 122 DCHECK(isMainThread() || !skImage->isTextureBacked()); // Acceleration not y et supported in Workers
123 RefPtr<StaticBitmapImage> image = StaticBitmapImage::create(skImage.release( )); 123 RefPtr<StaticBitmapImage> image = StaticBitmapImage::create(std::move(skImag e));
124 image->setOriginClean(this->originClean()); 124 image->setOriginClean(this->originClean());
125 m_imageBuffer.reset(); // "Transfer" means no retained buffer 125 m_imageBuffer.reset(); // "Transfer" means no retained buffer
126 m_needsMatrixClipRestore = true; 126 m_needsMatrixClipRestore = true;
127 return ImageBitmap::create(image.release()); 127 return ImageBitmap::create(image.release());
128 } 128 }
129 129
130 PassRefPtr<Image> OffscreenCanvasRenderingContext2D::getImage(SnapshotReason rea son) const 130 PassRefPtr<Image> OffscreenCanvasRenderingContext2D::getImage(SnapshotReason rea son) const
131 { 131 {
132 if (!imageBuffer()) 132 if (!imageBuffer())
133 return nullptr; 133 return nullptr;
134 RefPtr<SkImage> skImage = m_imageBuffer->newSkImageSnapshot(PreferAccelerati on, reason); 134 sk_sp<SkImage> skImage = m_imageBuffer->newSkImageSnapshot(PreferAcceleratio n, reason);
135 RefPtr<StaticBitmapImage> image = StaticBitmapImage::create(skImage.release( )); 135 RefPtr<StaticBitmapImage> image = StaticBitmapImage::create(std::move(skImag e));
136 return image; 136 return image;
137 } 137 }
138 138
139 void OffscreenCanvasRenderingContext2D::setOffscreenCanvasGetContextResult(Offsc reenRenderingContext& result) 139 void OffscreenCanvasRenderingContext2D::setOffscreenCanvasGetContextResult(Offsc reenRenderingContext& result)
140 { 140 {
141 result.setOffscreenCanvasRenderingContext2D(this); 141 result.setOffscreenCanvasRenderingContext2D(this);
142 } 142 }
143 143
144 bool OffscreenCanvasRenderingContext2D::parseColorOrCurrentColor(Color& color, c onst String& colorString) const 144 bool OffscreenCanvasRenderingContext2D::parseColorOrCurrentColor(Color& color, c onst String& colorString) const
145 { 145 {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 bool OffscreenCanvasRenderingContext2D::isContextLost() const 201 bool OffscreenCanvasRenderingContext2D::isContextLost() const
202 { 202 {
203 return false; 203 return false;
204 } 204 }
205 205
206 bool OffscreenCanvasRenderingContext2D::isPaintable() const 206 bool OffscreenCanvasRenderingContext2D::isPaintable() const
207 { 207 {
208 return this->imageBuffer(); 208 return this->imageBuffer();
209 } 209 }
210 } 210 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698