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

Unified Diff: src/core/SkImageFilter.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/core/SkFlattenable.cpp ('k') | src/core/SkLocalMatrixShader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageFilter.cpp
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 4a9a22e63445bde4b0c6705403fe0dc08ee31805..20c7d57b0933dd2e0f5748c21618b085884eb213 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -75,11 +75,11 @@ void SkImageFilter::Common::detachInputs(SkImageFilter** inputs) {
}
bool SkImageFilter::Common::unflatten(SkReadBuffer& buffer, int expectedCount) {
- int count = buffer.readInt();
- if (expectedCount < 0) { // means the caller doesn't care how many
- expectedCount = count;
+ const int count = buffer.readInt();
+ if (!buffer.validate(count >= 0)) {
+ return false;
}
- if (!buffer.validate((count == expectedCount) && (count >= 0))) {
+ if (!buffer.validate(expectedCount < 0 || count == expectedCount)) {
return false;
}
« no previous file with comments | « src/core/SkFlattenable.cpp ('k') | src/core/SkLocalMatrixShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698