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

Side by Side Diff: src/effects/gradients/SkSweepGradient.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
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 17 matching lines...) Expand all
28 } 28 }
29 return kSweep_GradientType; 29 return kSweep_GradientType;
30 } 30 }
31 31
32 sk_sp<SkFlattenable> SkSweepGradient::CreateProc(SkReadBuffer& buffer) { 32 sk_sp<SkFlattenable> SkSweepGradient::CreateProc(SkReadBuffer& buffer) {
33 DescriptorScope desc; 33 DescriptorScope desc;
34 if (!desc.unflatten(buffer)) { 34 if (!desc.unflatten(buffer)) {
35 return nullptr; 35 return nullptr;
36 } 36 }
37 const SkPoint center = buffer.readPoint(); 37 const SkPoint center = buffer.readPoint();
38 return SkGradientShader::MakeSweep(center.x(), center.y(), desc.fColors, des c.fPos, 38 return SkGradientShader::MakeSweep(center.x(), center.y(), desc.fColors,
39 desc.fCount, desc.fGradFlags, desc.fLocal Matrix); 39 std::move(desc.fColorSpace), desc.fPos, d esc.fCount,
40 desc.fGradFlags, desc.fLocalMatrix);
40 } 41 }
41 42
42 void SkSweepGradient::flatten(SkWriteBuffer& buffer) const { 43 void SkSweepGradient::flatten(SkWriteBuffer& buffer) const {
43 this->INHERITED::flatten(buffer); 44 this->INHERITED::flatten(buffer);
44 buffer.writePoint(fCenter); 45 buffer.writePoint(fCenter);
45 } 46 }
46 47
47 size_t SkSweepGradient::onContextSize(const ContextRec&) const { 48 size_t SkSweepGradient::onContextSize(const ContextRec&) const {
48 return sizeof(SweepGradientContext); 49 return sizeof(SweepGradientContext);
49 } 50 }
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 str->appendScalar(fCenter.fX); 266 str->appendScalar(fCenter.fX);
266 str->append(", "); 267 str->append(", ");
267 str->appendScalar(fCenter.fY); 268 str->appendScalar(fCenter.fY);
268 str->append(") "); 269 str->append(") ");
269 270
270 this->INHERITED::toString(str); 271 this->INHERITED::toString(str);
271 272
272 str->append(")"); 273 str->append(")");
273 } 274 }
274 #endif 275 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkRadialGradient.cpp ('k') | src/effects/gradients/SkTwoPointConicalGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698