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

Unified Diff: src/effects/SkColorFilterImageFilter.cpp

Issue 691383003: notice null colorfilter in legacy unflattening (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkColorFilterImageFilter.cpp
diff --git a/src/effects/SkColorFilterImageFilter.cpp b/src/effects/SkColorFilterImageFilter.cpp
index 806dd5dd010b7758b49a108d87185af77066adff..012f1329a44c552d0f33529ba63d9739ecc5b9e5 100755
--- a/src/effects/SkColorFilterImageFilter.cpp
+++ b/src/effects/SkColorFilterImageFilter.cpp
@@ -85,9 +85,17 @@ SkColorFilterImageFilter::SkColorFilterImageFilter(SkColorFilter* cf,
}
#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
-SkColorFilterImageFilter::SkColorFilterImageFilter(SkReadBuffer& buffer)
- : INHERITED(1, buffer) {
+SkColorFilterImageFilter::SkColorFilterImageFilter(SkReadBuffer& buffer) : INHERITED(1, buffer) {
fColorFilter = buffer.readColorFilter();
+ // we aren't prepared for this to be NULL, and it can't ever be when we're NOT supporting
+ // SK_SUPPORT_LEGACY_DEEPFLATTENING, as we always go through a factory which can detect
+ // NULL. However, since here we're in the legacy code, we assign a dummy filter so we
+ // don't crash with a null-ptr.
+ if (NULL == fColorFilter) {
+ // colormatrix identity is effectively a no-op
+ fColorFilter = SkColorMatrixFilter::Create(SkColorMatrix());
+ SkASSERT(fColorFilter);
+ }
}
#endif
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698