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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 301 |
302 void SkColorMatrixFilter::flatten(SkFlattenableWriteBuffer& buffer) const { | 302 void SkColorMatrixFilter::flatten(SkFlattenableWriteBuffer& buffer) const { |
303 this->INHERITED::flatten(buffer); | 303 this->INHERITED::flatten(buffer); |
304 SkASSERT(sizeof(fMatrix.fMat)/sizeof(SkScalar) == 20); | 304 SkASSERT(sizeof(fMatrix.fMat)/sizeof(SkScalar) == 20); |
305 buffer.writeScalarArray(fMatrix.fMat, 20); | 305 buffer.writeScalarArray(fMatrix.fMat, 20); |
306 } | 306 } |
307 | 307 |
308 SkColorMatrixFilter::SkColorMatrixFilter(SkFlattenableReadBuffer& buffer) | 308 SkColorMatrixFilter::SkColorMatrixFilter(SkFlattenableReadBuffer& buffer) |
309 : INHERITED(buffer) { | 309 : INHERITED(buffer) { |
310 SkASSERT(buffer.getArrayCount() == 20); | 310 SkASSERT(buffer.getArrayCount() == 20); |
311 buffer.readScalarArray(fMatrix.fMat); | 311 buffer.readScalarArray(fMatrix.fMat, 20); |
312 this->initState(fMatrix.fMat); | 312 this->initState(fMatrix.fMat); |
313 for (int i = 0; i < 20; ++i) { | 313 for (int i = 0; i < 20; ++i) { |
314 buffer.validate(SkScalarIsFinite(fMatrix.fMat[i])); | 314 buffer.validate(SkScalarIsFinite(fMatrix.fMat[i])); |
315 } | 315 } |
316 } | 316 } |
317 | 317 |
318 bool SkColorMatrixFilter::asColorMatrix(SkScalar matrix[20]) const { | 318 bool SkColorMatrixFilter::asColorMatrix(SkScalar matrix[20]) const { |
319 if (matrix) { | 319 if (matrix) { |
320 memcpy(matrix, fMatrix.fMat, 20 * sizeof(SkScalar)); | 320 memcpy(matrix, fMatrix.fMat, 20 * sizeof(SkScalar)); |
321 } | 321 } |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 str->append("matrix: ("); | 489 str->append("matrix: ("); |
490 for (int i = 0; i < 20; ++i) { | 490 for (int i = 0; i < 20; ++i) { |
491 str->appendScalar(fMatrix.fMat[i]); | 491 str->appendScalar(fMatrix.fMat[i]); |
492 if (i < 19) { | 492 if (i < 19) { |
493 str->append(", "); | 493 str->append(", "); |
494 } | 494 } |
495 } | 495 } |
496 str->append(")"); | 496 str->append(")"); |
497 } | 497 } |
498 #endif | 498 #endif |
OLD | NEW |