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

Unified Diff: src/effects/gradients/SkRadialGradient.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/SkRadialGradient.h ('k') | src/effects/gradients/SkSweepGradient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkRadialGradient.cpp
diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp
index a6a2e366b22a3f90cfaf7723a061c959b61c820a..fb1d40a7ab0d9c92b66169aca5c785138fbf2a73 100644
--- a/src/effects/gradients/SkRadialGradient.cpp
+++ b/src/effects/gradients/SkRadialGradient.cpp
@@ -252,11 +252,24 @@ SkShader::GradientType SkRadialGradient::asAGradient(GradientInfo* info) const {
return kRadial_GradientType;
}
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
SkRadialGradient::SkRadialGradient(SkReadBuffer& buffer)
: INHERITED(buffer),
fCenter(buffer.readPoint()),
fRadius(buffer.readScalar()) {
}
+#endif
+
+SkFlattenable* SkRadialGradient::CreateProc(SkReadBuffer& buffer) {
+ DescriptorScope desc;
+ if (!desc.unflatten(buffer)) {
+ return NULL;
+ }
+ const SkPoint center = buffer.readPoint();
+ const SkScalar radius = buffer.readScalar();
+ return SkGradientShader::CreateRadial(center, radius, desc.fColors, desc.fPos, desc.fCount,
+ desc.fTileMode, desc.fGradFlags, desc.fLocalMatrix);
+}
void SkRadialGradient::flatten(SkWriteBuffer& buffer) const {
this->INHERITED::flatten(buffer);
« no previous file with comments | « src/effects/gradients/SkRadialGradient.h ('k') | src/effects/gradients/SkSweepGradient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698