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

Side by Side Diff: third_party/WebKit/Source/core/frame/ImageBitmap.cpp

Issue 1855273002: Update new Surface callsites (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: software_output_device was indirectly including skia::refptr, switch to sk_sp<> Created 4 years, 8 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
« no previous file with comments | « skia/config/SkUserConfig.h ('k') | third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/frame/ImageBitmap.h" 5 #include "core/frame/ImageBitmap.h"
6 6
7 #include "core/html/HTMLCanvasElement.h" 7 #include "core/html/HTMLCanvasElement.h"
8 #include "core/html/HTMLVideoElement.h" 8 #include "core/html/HTMLVideoElement.h"
9 #include "core/html/ImageData.h" 9 #include "core/html/ImageData.h"
10 #include "platform/image-decoders/ImageDecoder.h" 10 #include "platform/image-decoders/ImageDecoder.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 if (cropRect == srcRect) { 135 if (cropRect == srcRect) {
136 if (flipY) 136 if (flipY)
137 return StaticBitmapImage::create(flipSkImageVertically(skiaImage->ne wSubset(srcRect), premultiplyAlpha ? PremultiplyAlpha : DontPremultiplyAlpha)); 137 return StaticBitmapImage::create(flipSkImageVertically(skiaImage->ne wSubset(srcRect), premultiplyAlpha ? PremultiplyAlpha : DontPremultiplyAlpha));
138 SkImage* croppedSkImage = skiaImage->newSubset(srcRect); 138 SkImage* croppedSkImage = skiaImage->newSubset(srcRect);
139 // Call preroll to trigger image decoding. 139 // Call preroll to trigger image decoding.
140 croppedSkImage->preroll(); 140 croppedSkImage->preroll();
141 return StaticBitmapImage::create(adoptRef(croppedSkImage)); 141 return StaticBitmapImage::create(adoptRef(croppedSkImage));
142 } 142 }
143 143
144 RefPtr<SkSurface> surface = adoptRef(SkSurface::NewRasterN32Premul(cropRect. width(), cropRect.height())); 144 sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(cropRect.width(), cropRect.height());
145 if (!surface) 145 if (!surface)
146 return nullptr; 146 return nullptr;
147 if (srcRect.isEmpty()) 147 if (srcRect.isEmpty())
148 return StaticBitmapImage::create(adoptRef(surface->newImageSnapshot())); 148 return StaticBitmapImage::create(adoptRef(surface->newImageSnapshot()));
149 149
150 SkScalar dstLeft = std::min(0, -cropRect.x()); 150 SkScalar dstLeft = std::min(0, -cropRect.x());
151 SkScalar dstTop = std::min(0, -cropRect.y()); 151 SkScalar dstTop = std::min(0, -cropRect.y());
152 if (cropRect.x() < 0) 152 if (cropRect.x() < 0)
153 dstLeft = -cropRect.x(); 153 dstLeft = -cropRect.x();
154 if (cropRect.y() < 0) 154 if (cropRect.y() < 0)
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 FloatSize ImageBitmap::elementSize(const FloatSize&) const 462 FloatSize ImageBitmap::elementSize(const FloatSize&) const
463 { 463 {
464 return FloatSize(width(), height()); 464 return FloatSize(width(), height());
465 } 465 }
466 466
467 DEFINE_TRACE(ImageBitmap) 467 DEFINE_TRACE(ImageBitmap)
468 { 468 {
469 } 469 }
470 470
471 } // namespace blink 471 } // namespace blink
OLDNEW
« no previous file with comments | « skia/config/SkUserConfig.h ('k') | third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698