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

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

Issue 2370063002: Gradients are serialized (and can be constructed) as SkColor4f + SkColorSpace (Closed)
Patch Set: Widen storage for flags. Shift used bits to be contiguous. Document layout. Created 4 years, 2 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/effects/gradients/SkLinearGradient.cpp ('k') | src/effects/gradients/SkSweepGradient.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 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 return kRadial_GradientType; 60 return kRadial_GradientType;
61 } 61 }
62 62
63 sk_sp<SkFlattenable> SkRadialGradient::CreateProc(SkReadBuffer& buffer) { 63 sk_sp<SkFlattenable> SkRadialGradient::CreateProc(SkReadBuffer& buffer) {
64 DescriptorScope desc; 64 DescriptorScope desc;
65 if (!desc.unflatten(buffer)) { 65 if (!desc.unflatten(buffer)) {
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, std::move( desc.fColorSpace),
71 desc.fTileMode, desc.fGradFlags, desc.fL ocalMatrix); 71 desc.fPos, desc.fCount, desc.fTileMode, desc.fGradFlags,
72 desc.fLocalMatrix);
72 } 73 }
73 74
74 void SkRadialGradient::flatten(SkWriteBuffer& buffer) const { 75 void SkRadialGradient::flatten(SkWriteBuffer& buffer) const {
75 this->INHERITED::flatten(buffer); 76 this->INHERITED::flatten(buffer);
76 buffer.writePoint(fCenter); 77 buffer.writePoint(fCenter);
77 buffer.writeScalar(fRadius); 78 buffer.writeScalar(fRadius);
78 } 79 }
79 80
80 namespace { 81 namespace {
81 82
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 str->appendScalar(fCenter.fY); 376 str->appendScalar(fCenter.fY);
376 str->append(") radius: "); 377 str->append(") radius: ");
377 str->appendScalar(fRadius); 378 str->appendScalar(fRadius);
378 str->append(" "); 379 str->append(" ");
379 380
380 this->INHERITED::toString(str); 381 this->INHERITED::toString(str);
381 382
382 str->append(")"); 383 str->append(")");
383 } 384 }
384 #endif 385 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkLinearGradient.cpp ('k') | src/effects/gradients/SkSweepGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698