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

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

Issue 2175563003: Bundle SkShader::asFragmentProcessor arguments in a struct (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix indentation to be less arbitrary Created 4 years, 5 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/SkColorFilterShader.h ('k') | src/core/SkColorShader.h » ('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 2013 Google Inc. 2 * Copyright 2013 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 "SkColorFilterShader.h" 8 #include "SkColorFilterShader.h"
9 #include "SkReadBuffer.h" 9 #include "SkReadBuffer.h"
10 #include "SkWriteBuffer.h" 10 #include "SkWriteBuffer.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 int count) { 90 int count) {
91 const SkColorFilterShader& filterShader = static_cast<const SkColorFilterSha der&>(fShader); 91 const SkColorFilterShader& filterShader = static_cast<const SkColorFilterSha der&>(fShader);
92 92
93 fShaderContext->shadeSpan4f(x, y, result, count); 93 fShaderContext->shadeSpan4f(x, y, result, count);
94 filterShader.fFilter->filterSpan4f(result, count, result); 94 filterShader.fFilter->filterSpan4f(result, count, result);
95 } 95 }
96 96
97 #if SK_SUPPORT_GPU 97 #if SK_SUPPORT_GPU
98 ///////////////////////////////////////////////////////////////////// 98 /////////////////////////////////////////////////////////////////////
99 99
100 sk_sp<GrFragmentProcessor> SkColorFilterShader::asFragmentProcessor( 100 sk_sp<GrFragmentProcessor> SkColorFilterShader::asFragmentProcessor(const AsFPAr gs& args) const {
101 GrContext* context,
102 const SkMatrix& viewM,
103 const SkMatrix* localMatrix ,
104 SkFilterQuality fq,
105 SkSourceGammaTreatment gamm aTreatment) const {
106 101
107 sk_sp<GrFragmentProcessor> fp1(fShader->asFragmentProcessor(context, viewM, localMatrix, fq, 102 sk_sp<GrFragmentProcessor> fp1(fShader->asFragmentProcessor(args));
108 gammaTreatment)) ;
109 if (!fp1) { 103 if (!fp1) {
110 return nullptr; 104 return nullptr;
111 } 105 }
112 106
113 sk_sp<GrFragmentProcessor> fp2(fFilter->asFragmentProcessor(context)); 107 sk_sp<GrFragmentProcessor> fp2(fFilter->asFragmentProcessor(args.fContext));
114 if (!fp2) { 108 if (!fp2) {
115 return fp1; 109 return fp1;
116 } 110 }
117 111
118 sk_sp<GrFragmentProcessor> fpSeries[] = { std::move(fp1), std::move(fp2) }; 112 sk_sp<GrFragmentProcessor> fpSeries[] = { std::move(fp1), std::move(fp2) };
119 return GrFragmentProcessor::RunInSeries(fpSeries, 2); 113 return GrFragmentProcessor::RunInSeries(fpSeries, 2);
120 } 114 }
121 #endif 115 #endif
122 116
123 #ifndef SK_IGNORE_TO_STRING 117 #ifndef SK_IGNORE_TO_STRING
(...skipping 13 matching lines...) Expand all
137 131
138 //////////////////////////////////////////////////////////////////////////////// /////////////////// 132 //////////////////////////////////////////////////////////////////////////////// ///////////////////
139 133
140 sk_sp<SkShader> SkShader::makeWithColorFilter(sk_sp<SkColorFilter> filter) const { 134 sk_sp<SkShader> SkShader::makeWithColorFilter(sk_sp<SkColorFilter> filter) const {
141 SkShader* base = const_cast<SkShader*>(this); 135 SkShader* base = const_cast<SkShader*>(this);
142 if (!filter) { 136 if (!filter) {
143 return sk_ref_sp(base); 137 return sk_ref_sp(base);
144 } 138 }
145 return sk_make_sp<SkColorFilterShader>(sk_ref_sp(base), filter); 139 return sk_make_sp<SkColorFilterShader>(sk_ref_sp(base), filter);
146 } 140 }
OLDNEW
« no previous file with comments | « src/core/SkColorFilterShader.h ('k') | src/core/SkColorShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698