OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SkColorMatrixFilter.h" | 8 #include "SkColorMatrixFilter.h" |
9 #include "SkColorMatrix.h" | 9 #include "SkColorMatrix.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 } | 300 } |
301 } | 301 } |
302 | 302 |
303 /////////////////////////////////////////////////////////////////////////////// | 303 /////////////////////////////////////////////////////////////////////////////// |
304 | 304 |
305 void SkColorMatrixFilter::flatten(SkWriteBuffer& buffer) const { | 305 void SkColorMatrixFilter::flatten(SkWriteBuffer& buffer) const { |
306 SkASSERT(sizeof(fMatrix.fMat)/sizeof(SkScalar) == 20); | 306 SkASSERT(sizeof(fMatrix.fMat)/sizeof(SkScalar) == 20); |
307 buffer.writeScalarArray(fMatrix.fMat, 20); | 307 buffer.writeScalarArray(fMatrix.fMat, 20); |
308 } | 308 } |
309 | 309 |
| 310 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
| 311 SkColorMatrixFilter::SkColorMatrixFilter(SkReadBuffer& buffer) : INHERITED(buffe
r) { |
| 312 SkASSERT(buffer.getArrayCount() == 20); |
| 313 if (buffer.readScalarArray(fMatrix.fMat, 20)) { |
| 314 this->initState(fMatrix.fMat); |
| 315 } |
| 316 } |
| 317 #endif |
| 318 |
310 SkFlattenable* SkColorMatrixFilter::CreateProc(SkReadBuffer& buffer) { | 319 SkFlattenable* SkColorMatrixFilter::CreateProc(SkReadBuffer& buffer) { |
311 SkColorMatrix matrix; | 320 SkColorMatrix matrix; |
312 if (buffer.readScalarArray(matrix.fMat, 20)) { | 321 if (buffer.readScalarArray(matrix.fMat, 20)) { |
313 return Create(matrix); | 322 return Create(matrix); |
314 } | 323 } |
315 return NULL; | 324 return NULL; |
316 } | 325 } |
317 | 326 |
318 bool SkColorMatrixFilter::asColorMatrix(SkScalar matrix[20]) const { | 327 bool SkColorMatrixFilter::asColorMatrix(SkScalar matrix[20]) const { |
319 if (matrix) { | 328 if (matrix) { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 str->append("matrix: ("); | 502 str->append("matrix: ("); |
494 for (int i = 0; i < 20; ++i) { | 503 for (int i = 0; i < 20; ++i) { |
495 str->appendScalar(fMatrix.fMat[i]); | 504 str->appendScalar(fMatrix.fMat[i]); |
496 if (i < 19) { | 505 if (i < 19) { |
497 str->append(", "); | 506 str->append(", "); |
498 } | 507 } |
499 } | 508 } |
500 str->append(")"); | 509 str->append(")"); |
501 } | 510 } |
502 #endif | 511 #endif |
OLD | NEW |