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

Unified Diff: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp

Issue 2290903002: Change (Pass)RefPtr<SkXxx> into sk_sp<SkXxx>. (Closed)
Patch Set: Self-review. 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
index d3db49bf4c1502d785f667376e39c571973f2e34..179a5476dd1ea7322cefa88a3b0e1285de0a9c25 100644
--- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
@@ -116,7 +116,7 @@ PassRefPtr<Image> createTransparentImage(const IntSize& size)
{
DCHECK(ImageBuffer::canCreateImageBuffer(size));
sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(size.width(), size.height());
- return StaticBitmapImage::create(fromSkSp(surface->makeImageSnapshot()));
+ return StaticBitmapImage::create(surface->makeImageSnapshot());
}
} // namespace
@@ -458,7 +458,7 @@ void HTMLCanvasElement::notifyListenersCanvasChanged()
RefPtr<Image> sourceImage = getSourceImageForCanvas(&status, PreferNoAcceleration, SnapshotReasonCanvasListenerCapture, FloatSize());
if (status != NormalSourceImageStatus)
return;
- RefPtr<SkImage> image = sourceImage->imageForCurrentFrame();
+ sk_sp<SkImage> image = sourceImage->imageForCurrentFrame();
for (CanvasDrawListener* listener : m_listeners) {
if (listener->needsNewFrame()) {
listener->sendNewFrame(image);
f(malita) 2016/09/01 03:55:37 Not new, but it would make sense to std::move(imag
Łukasz Anforowicz 2016/09/01 20:50:57 But this is in a loop, so |image| can be reused, s
f(malita) 2016/09/01 21:03:43 Acknowledged.
@@ -607,7 +607,7 @@ ImageData* HTMLCanvasElement::toImageData(SourceDrawingBuffer sourceBuffer, Snap
m_context->paintRenderingResultsToCanvas(sourceBuffer);
imageData = ImageData::create(m_size);
- RefPtr<SkImage> snapshot = buffer()->newSkImageSnapshot(PreferNoAcceleration, reason);
+ sk_sp<SkImage> snapshot = buffer()->newSkImageSnapshot(PreferNoAcceleration, reason);
if (snapshot) {
SkImageInfo imageInfo = SkImageInfo::Make(width(), height(), kRGBA_8888_SkColorType, kUnpremul_SkAlphaType);
snapshot->readPixels(imageInfo, imageData->data()->data(), imageInfo.minRowBytes(), 0, 0);
@@ -621,7 +621,7 @@ ImageData* HTMLCanvasElement::toImageData(SourceDrawingBuffer sourceBuffer, Snap
return imageData;
DCHECK(m_context->is2d());
- RefPtr<SkImage> snapshot = buffer()->newSkImageSnapshot(PreferNoAcceleration, reason);
+ sk_sp<SkImage> snapshot = buffer()->newSkImageSnapshot(PreferNoAcceleration, reason);
if (snapshot) {
SkImageInfo imageInfo = SkImageInfo::Make(width(), height(), kRGBA_8888_SkColorType, kUnpremul_SkAlphaType);
snapshot->readPixels(imageInfo, imageData->data()->data(), imageInfo.minRowBytes(), 0, 0);
@@ -1123,7 +1123,7 @@ PassRefPtr<Image> HTMLCanvasElement::getSourceImageForCanvas(SourceImageStatus*
m_context->paintRenderingResultsToCanvas(BackBuffer);
}
- RefPtr<SkImage> skImage;
+ sk_sp<SkImage> skImage;
RefPtr<blink::Image> image = renderingContext()->getImage();
if (image)
@@ -1133,7 +1133,7 @@ PassRefPtr<Image> HTMLCanvasElement::getSourceImageForCanvas(SourceImageStatus*
if (skImage) {
*status = NormalSourceImageStatus;
- return StaticBitmapImage::create(skImage.release());
+ return StaticBitmapImage::create(std::move(skImage));
}
*status = InvalidSourceImageStatus;

Powered by Google App Engine
This is Rietveld 408576698