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

Unified Diff: src/effects/gradients/SkSweepGradient.cpp

Issue 395603002: Simplify flattening to just write enough to call the factory (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/gradients/SkSweepGradient.h ('k') | src/effects/gradients/SkTwoPointConicalGradient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkSweepGradient.cpp
diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp
index a5392160504e9e2b29dde872e01b82a339805c2c..1bb595cb3c262ef5a8557f22d0fb797a4f2522a3 100644
--- a/src/effects/gradients/SkSweepGradient.cpp
+++ b/src/effects/gradients/SkSweepGradient.cpp
@@ -41,10 +41,22 @@ SkShader::GradientType SkSweepGradient::asAGradient(GradientInfo* info) const {
return kSweep_GradientType;
}
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
SkSweepGradient::SkSweepGradient(SkReadBuffer& buffer)
: INHERITED(buffer),
fCenter(buffer.readPoint()) {
}
+#endif
+
+SkFlattenable* SkSweepGradient::CreateProc(SkReadBuffer& buffer) {
+ DescriptorScope desc;
+ if (!desc.unflatten(buffer)) {
+ return NULL;
+ }
+ const SkPoint center = buffer.readPoint();
+ return SkGradientShader::CreateSweep(center.x(), center.y(), desc.fColors, desc.fPos,
+ desc.fCount, desc.fGradFlags, desc.fLocalMatrix);
+}
void SkSweepGradient::flatten(SkWriteBuffer& buffer) const {
this->INHERITED::flatten(buffer);
« no previous file with comments | « src/effects/gradients/SkSweepGradient.h ('k') | src/effects/gradients/SkTwoPointConicalGradient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698