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

Side by Side Diff: src/core/SkMatrixImageFilter.cpp

Issue 1858353002: Update SkMatrixImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix fuzz 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/core/SkMatrixImageFilter.h ('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 2014 The Android Open Source Project 2 * Copyright 2014 The Android Open Source Project
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 "SkMatrixImageFilter.h" 8 #include "SkMatrixImageFilter.h"
9 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkReadBuffer.h" 11 #include "SkReadBuffer.h"
12 #include "SkSpecialImage.h" 12 #include "SkSpecialImage.h"
13 #include "SkSpecialSurface.h" 13 #include "SkSpecialSurface.h"
14 #include "SkWriteBuffer.h" 14 #include "SkWriteBuffer.h"
15 #include "SkRect.h" 15 #include "SkRect.h"
16 16
17 SkMatrixImageFilter::SkMatrixImageFilter(const SkMatrix& transform, 17 SkMatrixImageFilter::SkMatrixImageFilter(const SkMatrix& transform,
18 SkFilterQuality filterQuality, 18 SkFilterQuality filterQuality,
19 SkImageFilter* input) 19 sk_sp<SkImageFilter> input)
20 : INHERITED(1, &input) 20 : INHERITED(&input, 1, nullptr)
21 , fTransform(transform) 21 , fTransform(transform)
22 , fFilterQuality(filterQuality) { 22 , fFilterQuality(filterQuality) {
23 } 23 }
24 24
25 SkMatrixImageFilter* SkMatrixImageFilter::Create(const SkMatrix& transform, 25 sk_sp<SkImageFilter> SkMatrixImageFilter::Make(const SkMatrix& transform,
26 SkFilterQuality filterQuality, 26 SkFilterQuality filterQuality,
27 SkImageFilter* input) { 27 sk_sp<SkImageFilter> input) {
28 return new SkMatrixImageFilter(transform, filterQuality, input); 28 return sk_sp<SkImageFilter>(new SkMatrixImageFilter(transform,
29 filterQuality,
30 std::move(input)));
29 } 31 }
30 32
31 sk_sp<SkFlattenable> SkMatrixImageFilter::CreateProc(SkReadBuffer& buffer) { 33 sk_sp<SkFlattenable> SkMatrixImageFilter::CreateProc(SkReadBuffer& buffer) {
32 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); 34 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
33 SkMatrix matrix; 35 SkMatrix matrix;
34 buffer.readMatrix(&matrix); 36 buffer.readMatrix(&matrix);
35 SkFilterQuality quality = static_cast<SkFilterQuality>(buffer.readInt()); 37 SkFilterQuality quality = static_cast<SkFilterQuality>(buffer.readInt());
36 return sk_sp<SkImageFilter>(Create(matrix, quality, common.getInput(0).get() )); 38 return Make(matrix, quality, common.getInput(0));
37 } 39 }
38 40
39 void SkMatrixImageFilter::flatten(SkWriteBuffer& buffer) const { 41 void SkMatrixImageFilter::flatten(SkWriteBuffer& buffer) const {
40 this->INHERITED::flatten(buffer); 42 this->INHERITED::flatten(buffer);
41 buffer.writeMatrix(fTransform); 43 buffer.writeMatrix(fTransform);
42 buffer.writeInt(fFilterQuality); 44 buffer.writeInt(fFilterQuality);
43 } 45 }
44 46
45 sk_sp<SkSpecialImage> SkMatrixImageFilter::onFilterImage(SkSpecialImage* source, 47 sk_sp<SkSpecialImage> SkMatrixImageFilter::onFilterImage(SkSpecialImage* source,
46 const Context& ctx, 48 const Context& ctx,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 fTransform[SkMatrix::kMPersp2]); 140 fTransform[SkMatrix::kMPersp2]);
139 141
140 str->append("<dt>FilterLevel:</dt><dd>"); 142 str->append("<dt>FilterLevel:</dt><dd>");
141 static const char* gFilterLevelStrings[] = { "None", "Low", "Medium", "High" }; 143 static const char* gFilterLevelStrings[] = { "None", "Low", "Medium", "High" };
142 str->append(gFilterLevelStrings[fFilterQuality]); 144 str->append(gFilterLevelStrings[fFilterQuality]);
143 str->append("</dd>"); 145 str->append("</dd>");
144 146
145 str->appendf(")"); 147 str->appendf(")");
146 } 148 }
147 #endif 149 #endif
OLDNEW
« no previous file with comments | « src/core/SkMatrixImageFilter.h ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698