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

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

Issue 768183002: Revert of Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkSweepGradient.h" 9 #include "SkSweepGradient.h"
10 10
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 35
36 SkShader::GradientType SkSweepGradient::asAGradient(GradientInfo* info) const { 36 SkShader::GradientType SkSweepGradient::asAGradient(GradientInfo* info) const {
37 if (info) { 37 if (info) {
38 commonAsAGradient(info); 38 commonAsAGradient(info);
39 info->fPoint[0] = fCenter; 39 info->fPoint[0] = fCenter;
40 } 40 }
41 return kSweep_GradientType; 41 return kSweep_GradientType;
42 } 42 }
43 43
44 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
45 SkSweepGradient::SkSweepGradient(SkReadBuffer& buffer)
46 : INHERITED(buffer),
47 fCenter(buffer.readPoint()) {
48 }
49 #endif
50
44 SkFlattenable* SkSweepGradient::CreateProc(SkReadBuffer& buffer) { 51 SkFlattenable* SkSweepGradient::CreateProc(SkReadBuffer& buffer) {
45 DescriptorScope desc; 52 DescriptorScope desc;
46 if (!desc.unflatten(buffer)) { 53 if (!desc.unflatten(buffer)) {
47 return NULL; 54 return NULL;
48 } 55 }
49 const SkPoint center = buffer.readPoint(); 56 const SkPoint center = buffer.readPoint();
50 return SkGradientShader::CreateSweep(center.x(), center.y(), desc.fColors, d esc.fPos, 57 return SkGradientShader::CreateSweep(center.x(), center.y(), desc.fColors, d esc.fPos,
51 desc.fCount, desc.fGradFlags, desc.fLoc alMatrix); 58 desc.fCount, desc.fGradFlags, desc.fLoc alMatrix);
52 } 59 }
53 60
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 coords2D.c_str(), coords2D.c_str()); 287 coords2D.c_str(), coords2D.c_str());
281 } 288 }
282 this->emitColor(builder, ge, t.c_str(), outputColor, inputColor, samplers); 289 this->emitColor(builder, ge, t.c_str(), outputColor, inputColor, samplers);
283 } 290 }
284 291
285 ///////////////////////////////////////////////////////////////////// 292 /////////////////////////////////////////////////////////////////////
286 293
287 bool SkSweepGradient::asFragmentProcessor(GrContext* context, const SkPaint& pai nt, 294 bool SkSweepGradient::asFragmentProcessor(GrContext* context, const SkPaint& pai nt,
288 const SkMatrix* localMatrix, GrColor* paintColor, 295 const SkMatrix* localMatrix, GrColor* paintColor,
289 GrFragmentProcessor** effect) const { 296 GrFragmentProcessor** effect) const {
290 297
291 SkMatrix matrix; 298 SkMatrix matrix;
292 if (!this->getLocalMatrix().invert(&matrix)) { 299 if (!this->getLocalMatrix().invert(&matrix)) {
293 return false; 300 return false;
294 } 301 }
295 if (localMatrix) { 302 if (localMatrix) {
296 SkMatrix inv; 303 SkMatrix inv;
297 if (!localMatrix->invert(&inv)) { 304 if (!localMatrix->invert(&inv)) {
298 return false; 305 return false;
299 } 306 }
300 matrix.postConcat(inv); 307 matrix.postConcat(inv);
301 } 308 }
302 matrix.postConcat(fPtsToUnit); 309 matrix.postConcat(fPtsToUnit);
303 310
304 *effect = GrSweepGradient::Create(context, *this, matrix); 311 *effect = GrSweepGradient::Create(context, *this, matrix);
305 *paintColor = SkColor2GrColorJustAlpha(paint.getColor()); 312 *paintColor = SkColor2GrColorJustAlpha(paint.getColor());
306 313
307 return true; 314 return true;
308 } 315 }
309 316
310 #else 317 #else
311 318
312 bool SkSweepGradient::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa trix*, GrColor*, 319 bool SkSweepGradient::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa trix*, GrColor*,
313 GrFragmentProcessor**) const { 320 GrFragmentProcessor**) const {
314 SkDEBUGFAIL("Should not call in GPU-less build"); 321 SkDEBUGFAIL("Should not call in GPU-less build");
315 return false; 322 return false;
316 } 323 }
317 324
318 #endif 325 #endif
319 326
320 #ifndef SK_IGNORE_TO_STRING 327 #ifndef SK_IGNORE_TO_STRING
321 void SkSweepGradient::toString(SkString* str) const { 328 void SkSweepGradient::toString(SkString* str) const {
322 str->append("SkSweepGradient: ("); 329 str->append("SkSweepGradient: (");
323 330
324 str->append("center: ("); 331 str->append("center: (");
325 str->appendScalar(fCenter.fX); 332 str->appendScalar(fCenter.fX);
326 str->append(", "); 333 str->append(", ");
327 str->appendScalar(fCenter.fY); 334 str->appendScalar(fCenter.fY);
328 str->append(") "); 335 str->append(") ");
329 336
330 this->INHERITED::toString(str); 337 this->INHERITED::toString(str);
331 338
332 str->append(")"); 339 str->append(")");
333 } 340 }
334 #endif 341 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkSweepGradient.h ('k') | src/effects/gradients/SkTwoPointConicalGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698