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

Side by Side Diff: src/utils/SkBitmapSourceDeserializer.cpp

Issue 1855733002: change flattenable factory to return sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « src/image/SkImageShader.cpp ('k') | tests/ImageFilterTest.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 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmapSourceDeserializer.h" 8 #include "SkBitmapSourceDeserializer.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
11 #include "SkFilterQuality.h" 11 #include "SkFilterQuality.h"
12 #include "SkImage.h" 12 #include "SkImage.h"
13 #include "SkImageSource.h" 13 #include "SkImageSource.h"
14 #include "SkReadBuffer.h" 14 #include "SkReadBuffer.h"
15 15
16 SkFlattenable* SkBitmapSourceDeserializer::CreateProc(SkReadBuffer& buffer) { 16 sk_sp<SkFlattenable> SkBitmapSourceDeserializer::CreateProc(SkReadBuffer& buffer ) {
17 SkFilterQuality filterQuality; 17 SkFilterQuality filterQuality;
18 if (buffer.isVersionLT(SkReadBuffer::kBitmapSourceFilterQuality_Version)) { 18 if (buffer.isVersionLT(SkReadBuffer::kBitmapSourceFilterQuality_Version)) {
19 filterQuality = kHigh_SkFilterQuality; 19 filterQuality = kHigh_SkFilterQuality;
20 } else { 20 } else {
21 filterQuality = (SkFilterQuality)buffer.readInt(); 21 filterQuality = (SkFilterQuality)buffer.readInt();
22 } 22 }
23 SkRect src, dst; 23 SkRect src, dst;
24 buffer.readRect(&src); 24 buffer.readRect(&src);
25 buffer.readRect(&dst); 25 buffer.readRect(&dst);
26 SkBitmap bitmap; 26 SkBitmap bitmap;
27 if (!buffer.readBitmap(&bitmap)) { 27 if (!buffer.readBitmap(&bitmap)) {
28 return nullptr; 28 return nullptr;
29 } 29 }
30 bitmap.setImmutable(); 30 bitmap.setImmutable();
31 31
32 return SkImageSource::Make(SkImage::MakeFromBitmap(bitmap), src, dst, filter Quality).release(); 32 return SkImageSource::Make(SkImage::MakeFromBitmap(bitmap), src, dst, filter Quality);
33 } 33 }
OLDNEW
« no previous file with comments | « src/image/SkImageShader.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698