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

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

Issue 1893973002: Outline SkImageFilter Make methods (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT 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/SkLocalMatrixImageFilter.h ('k') | src/effects/SkBlurImageFilter.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 "SkLocalMatrixImageFilter.h" 8 #include "SkLocalMatrixImageFilter.h"
9 #include "SkReadBuffer.h" 9 #include "SkReadBuffer.h"
10 #include "SkSpecialImage.h" 10 #include "SkSpecialImage.h"
11 #include "SkString.h" 11 #include "SkString.h"
12 12
13 sk_sp<SkImageFilter> SkLocalMatrixImageFilter::Make(const SkMatrix& localM,
14 sk_sp<SkImageFilter> input) {
15 if (!input) {
16 return nullptr;
17 }
18 if (localM.getType() & (SkMatrix::kAffine_Mask | SkMatrix::kPerspective_Mask )) {
19 return nullptr;
20 }
21 if (localM.isIdentity()) {
22 return input;
23 }
24 return sk_sp<SkImageFilter>(new SkLocalMatrixImageFilter(localM, input));
25 }
26
13 SkLocalMatrixImageFilter::SkLocalMatrixImageFilter(const SkMatrix& localM, 27 SkLocalMatrixImageFilter::SkLocalMatrixImageFilter(const SkMatrix& localM,
14 sk_sp<SkImageFilter> input) 28 sk_sp<SkImageFilter> input)
15 : INHERITED(&input, 1, nullptr) 29 : INHERITED(&input, 1, nullptr)
16 , fLocalM(localM) { 30 , fLocalM(localM) {
17 } 31 }
18 32
19 sk_sp<SkFlattenable> SkLocalMatrixImageFilter::CreateProc(SkReadBuffer& buffer) { 33 sk_sp<SkFlattenable> SkLocalMatrixImageFilter::CreateProc(SkReadBuffer& buffer) {
20 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); 34 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
21 SkMatrix lm; 35 SkMatrix lm;
22 buffer.readMatrix(&lm); 36 buffer.readMatrix(&lm);
(...skipping 16 matching lines...) Expand all
39 MapDirection direction) const { 53 MapDirection direction) const {
40 return this->getInput(0)->filterBounds(src, SkMatrix::Concat(matrix, fLocalM ), direction); 54 return this->getInput(0)->filterBounds(src, SkMatrix::Concat(matrix, fLocalM ), direction);
41 } 55 }
42 56
43 #ifndef SK_IGNORE_TO_STRING 57 #ifndef SK_IGNORE_TO_STRING
44 void SkLocalMatrixImageFilter::toString(SkString* str) const { 58 void SkLocalMatrixImageFilter::toString(SkString* str) const {
45 str->append("SkLocalMatrixImageFilter: ("); 59 str->append("SkLocalMatrixImageFilter: (");
46 str->append(")"); 60 str->append(")");
47 } 61 }
48 #endif 62 #endif
OLDNEW
« no previous file with comments | « src/core/SkLocalMatrixImageFilter.h ('k') | src/effects/SkBlurImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698