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

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

Issue 1855733002: change flattenable factory to return sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 "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 11 matching lines...) Expand all
22 } 22 }
23 23
24 SkShader::GradientType SkSweepGradient::asAGradient(GradientInfo* info) const { 24 SkShader::GradientType SkSweepGradient::asAGradient(GradientInfo* info) const {
25 if (info) { 25 if (info) {
26 commonAsAGradient(info); 26 commonAsAGradient(info);
27 info->fPoint[0] = fCenter; 27 info->fPoint[0] = fCenter;
28 } 28 }
29 return kSweep_GradientType; 29 return kSweep_GradientType;
30 } 30 }
31 31
32 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, des c.fPos,
39 desc.fCount, desc.fGradFlags, desc.fLocal Matrix).release(); 39 desc.fCount, desc.fGradFlags, desc.fLocal Matrix);
40 } 40 }
41 41
42 void SkSweepGradient::flatten(SkWriteBuffer& buffer) const { 42 void SkSweepGradient::flatten(SkWriteBuffer& buffer) const {
43 this->INHERITED::flatten(buffer); 43 this->INHERITED::flatten(buffer);
44 buffer.writePoint(fCenter); 44 buffer.writePoint(fCenter);
45 } 45 }
46 46
47 size_t SkSweepGradient::onContextSize(const ContextRec&) const { 47 size_t SkSweepGradient::onContextSize(const ContextRec&) const {
48 return sizeof(SweepGradientContext); 48 return sizeof(SweepGradientContext);
49 } 49 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 str->appendScalar(fCenter.fX); 260 str->appendScalar(fCenter.fX);
261 str->append(", "); 261 str->append(", ");
262 str->appendScalar(fCenter.fY); 262 str->appendScalar(fCenter.fY);
263 str->append(") "); 263 str->append(") ");
264 264
265 this->INHERITED::toString(str); 265 this->INHERITED::toString(str);
266 266
267 str->append(")"); 267 str->append(")");
268 } 268 }
269 #endif 269 #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