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

Side by Side Diff: src/effects/gradients/SkRadialGradient.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
« 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 SkShader::GradientType SkRadialGradient::asAGradient(GradientInfo* info) const { 54 SkShader::GradientType SkRadialGradient::asAGradient(GradientInfo* info) const {
55 if (info) { 55 if (info) {
56 commonAsAGradient(info); 56 commonAsAGradient(info);
57 info->fPoint[0] = fCenter; 57 info->fPoint[0] = fCenter;
58 info->fRadius[0] = fRadius; 58 info->fRadius[0] = fRadius;
59 } 59 }
60 return kRadial_GradientType; 60 return kRadial_GradientType;
61 } 61 }
62 62
63 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, desc.fPos, desc.fCount,
71 desc.fTileMode, desc.fGradFlags, 71 desc.fTileMode, desc.fGradFlags, desc.fL ocalMatrix);
72 desc.fLocalMatrix).release();
73 } 72 }
74 73
75 void SkRadialGradient::flatten(SkWriteBuffer& buffer) const { 74 void SkRadialGradient::flatten(SkWriteBuffer& buffer) const {
76 this->INHERITED::flatten(buffer); 75 this->INHERITED::flatten(buffer);
77 buffer.writePoint(fCenter); 76 buffer.writePoint(fCenter);
78 buffer.writeScalar(fRadius); 77 buffer.writeScalar(fRadius);
79 } 78 }
80 79
81 namespace { 80 namespace {
82 81
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 str->appendScalar(fCenter.fY); 373 str->appendScalar(fCenter.fY);
375 str->append(") radius: "); 374 str->append(") radius: ");
376 str->appendScalar(fRadius); 375 str->appendScalar(fRadius);
377 str->append(" "); 376 str->append(" ");
378 377
379 this->INHERITED::toString(str); 378 this->INHERITED::toString(str);
380 379
381 str->append(")"); 380 str->append(")");
382 } 381 }
383 #endif 382 #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