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

Unified Diff: src/effects/gradients/SkTwoPointRadialGradient.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/SkTwoPointRadialGradient.h ('k') | src/opts/SkXfermode_opts_SSE2.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkTwoPointRadialGradient.cpp
diff --git a/src/effects/gradients/SkTwoPointRadialGradient.cpp b/src/effects/gradients/SkTwoPointRadialGradient.cpp
index 8a408228f6d25da229d62fc974adf05a5b7f000b..754a53261b722df5658c9f171bc14814ca1bc55b 100644
--- a/src/effects/gradients/SkTwoPointRadialGradient.cpp
+++ b/src/effects/gradients/SkTwoPointRadialGradient.cpp
@@ -343,8 +343,8 @@ void SkTwoPointRadialGradient::toString(SkString* str) const {
}
#endif
-SkTwoPointRadialGradient::SkTwoPointRadialGradient(
- SkReadBuffer& buffer)
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+SkTwoPointRadialGradient::SkTwoPointRadialGradient(SkReadBuffer& buffer)
: INHERITED(buffer),
fCenter1(buffer.readPoint()),
fCenter2(buffer.readPoint()),
@@ -352,6 +352,21 @@ SkTwoPointRadialGradient::SkTwoPointRadialGradient(
fRadius2(buffer.readScalar()) {
init();
};
+#endif
+
+SkFlattenable* SkTwoPointRadialGradient::CreateProc(SkReadBuffer& buffer) {
+ DescriptorScope desc;
+ if (!desc.unflatten(buffer)) {
+ return NULL;
+ }
+ const SkPoint c1 = buffer.readPoint();
+ const SkPoint c2 = buffer.readPoint();
+ const SkScalar r1 = buffer.readScalar();
+ const SkScalar r2 = buffer.readScalar();
+ return SkGradientShader::CreateTwoPointRadial(c1, r1, c2, r2, desc.fColors, desc.fPos,
+ desc.fCount, desc.fTileMode, desc.fGradFlags,
+ desc.fLocalMatrix);
+}
void SkTwoPointRadialGradient::flatten(
SkWriteBuffer& buffer) const {
« no previous file with comments | « src/effects/gradients/SkTwoPointRadialGradient.h ('k') | src/opts/SkXfermode_opts_SSE2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698