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

Side by Side Diff: src/effects/gradients/SkSweepGradient.cpp

Issue 2337313002: (Some) gradients are gamma and gamut correct on GPU (Closed)
Patch Set: Rebase Created 4 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 "SkSweepGradient.h" 8 #include "SkSweepGradient.h"
9 9
10 static SkMatrix translate(SkScalar dx, SkScalar dy) { 10 static SkMatrix translate(SkScalar dx, SkScalar dy) {
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 } 240 }
241 if (args.fLocalMatrix) { 241 if (args.fLocalMatrix) {
242 SkMatrix inv; 242 SkMatrix inv;
243 if (!args.fLocalMatrix->invert(&inv)) { 243 if (!args.fLocalMatrix->invert(&inv)) {
244 return nullptr; 244 return nullptr;
245 } 245 }
246 matrix.postConcat(inv); 246 matrix.postConcat(inv);
247 } 247 }
248 matrix.postConcat(fPtsToUnit); 248 matrix.postConcat(fPtsToUnit);
249 249
250 sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(fColorSpa ce.get(),
251 args.fDst ColorSpace);
250 sk_sp<GrFragmentProcessor> inner(GrSweepGradient::Make( 252 sk_sp<GrFragmentProcessor> inner(GrSweepGradient::Make(
251 GrGradientEffect::CreateArgs(args.fContext, this, &matrix, SkShader::kCl amp_TileMode))); 253 GrGradientEffect::CreateArgs(args.fContext, this, &matrix, SkShader::kCl amp_TileMode,
254 std::move(colorSpaceXform), SkToBool(args.f DstColorSpace))));
252 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner)); 255 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner));
253 } 256 }
254 257
255 #endif 258 #endif
256 259
257 #ifndef SK_IGNORE_TO_STRING 260 #ifndef SK_IGNORE_TO_STRING
258 void SkSweepGradient::toString(SkString* str) const { 261 void SkSweepGradient::toString(SkString* str) const {
259 str->append("SkSweepGradient: ("); 262 str->append("SkSweepGradient: (");
260 263
261 str->append("center: ("); 264 str->append("center: (");
262 str->appendScalar(fCenter.fX); 265 str->appendScalar(fCenter.fX);
263 str->append(", "); 266 str->append(", ");
264 str->appendScalar(fCenter.fY); 267 str->appendScalar(fCenter.fY);
265 str->append(") "); 268 str->append(") ");
266 269
267 this->INHERITED::toString(str); 270 this->INHERITED::toString(str);
268 271
269 str->append(")"); 272 str->append(")");
270 } 273 }
271 #endif 274 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698