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

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

Issue 1911963008: DNC - JSON of flattenables, with field names. Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add names to call sites 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
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 "SkRadialGradient.h" 8 #include "SkRadialGradient.h"
9 #include "SkNx.h" 9 #include "SkNx.h"
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 return nullptr; 66 return nullptr;
67 } 67 }
68 const SkPoint center = buffer.readPoint(); 68 const SkPoint center = buffer.readPoint();
69 const SkScalar radius = buffer.readScalar(); 69 const SkScalar radius = buffer.readScalar();
70 return SkGradientShader::MakeRadial(center, radius, desc.fColors, desc.fPos, desc.fCount, 70 return SkGradientShader::MakeRadial(center, radius, desc.fColors, desc.fPos, desc.fCount,
71 desc.fTileMode, desc.fGradFlags, desc.fL ocalMatrix); 71 desc.fTileMode, desc.fGradFlags, desc.fL ocalMatrix);
72 } 72 }
73 73
74 void SkRadialGradient::flatten(SkWriteBuffer& buffer) const { 74 void SkRadialGradient::flatten(SkWriteBuffer& buffer) const {
75 this->INHERITED::flatten(buffer); 75 this->INHERITED::flatten(buffer);
76 buffer.writePoint(fCenter); 76 buffer.writePoint("fCenter", fCenter);
77 buffer.writeScalar(fRadius); 77 buffer.writeScalar("fRadius", fRadius);
78 } 78 }
79 79
80 namespace { 80 namespace {
81 81
82 inline bool radial_completely_pinned(SkScalar fx, SkScalar dx, SkScalar fy, SkSc alar dy) { 82 inline bool radial_completely_pinned(SkScalar fx, SkScalar dx, SkScalar fy, SkSc alar dy) {
83 // fast, overly-conservative test: checks unit square instead of unit circle 83 // fast, overly-conservative test: checks unit square instead of unit circle
84 bool xClamped = (fx >= 1 && dx >= 0) || (fx <= -1 && dx <= 0); 84 bool xClamped = (fx >= 1 && dx >= 0) || (fx <= -1 && dx <= 0);
85 bool yClamped = (fy >= 1 && dy >= 0) || (fy <= -1 && dy <= 0); 85 bool yClamped = (fy >= 1 && dy >= 0) || (fy <= -1 && dy <= 0);
86 return xClamped || yClamped; 86 return xClamped || yClamped;
87 } 87 }
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 str->appendScalar(fCenter.fY); 373 str->appendScalar(fCenter.fY);
374 str->append(") radius: "); 374 str->append(") radius: ");
375 str->appendScalar(fRadius); 375 str->appendScalar(fRadius);
376 str->append(" "); 376 str->append(" ");
377 377
378 this->INHERITED::toString(str); 378 this->INHERITED::toString(str);
379 379
380 str->append(")"); 380 str->append(")");
381 } 381 }
382 #endif 382 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698