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

Unified Diff: src/effects/SkColorMatrixFilter.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: Created 6 years, 5 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
Index: src/effects/SkColorMatrixFilter.cpp
diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp
index c24a2b773ad74678a8d0c7e244d9646a72ad9005..4c36c63458a1a07a8c4217be69f8022274fc966e 100644
--- a/src/effects/SkColorMatrixFilter.cpp
+++ b/src/effects/SkColorMatrixFilter.cpp
@@ -303,18 +303,26 @@ void SkColorMatrixFilter::filterSpan16(const uint16_t src[], int count,
///////////////////////////////////////////////////////////////////////////////
void SkColorMatrixFilter::flatten(SkWriteBuffer& buffer) const {
- this->INHERITED::flatten(buffer);
SkASSERT(sizeof(fMatrix.fMat)/sizeof(SkScalar) == 20);
buffer.writeScalarArray(fMatrix.fMat, 20);
}
-SkColorMatrixFilter::SkColorMatrixFilter(SkReadBuffer& buffer)
- : INHERITED(buffer) {
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
+SkColorMatrixFilter::SkColorMatrixFilter(SkReadBuffer& buffer) : INHERITED(buffer) {
SkASSERT(buffer.getArrayCount() == 20);
if (buffer.readScalarArray(fMatrix.fMat, 20)) {
this->initState(fMatrix.fMat);
}
}
+#endif
+
+SkFlattenable* SkColorMatrixFilter::CreateProc(SkReadBuffer& buffer) {
+ SkColorMatrix matrix;
+ if (buffer.readScalarArray(matrix.fMat, 20)) {
+ return Create(matrix);
+ }
+ return NULL;
+}
bool SkColorMatrixFilter::asColorMatrix(SkScalar matrix[20]) const {
if (matrix) {

Powered by Google App Engine
This is Rietveld 408576698