Chromium Code Reviews| 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, 20); | 311 if (buffer.readScalarArray(fMatrix.fMat, 20)) { |
| 312 this->initState(fMatrix.fMat); | 312 this->initState(fMatrix.fMat); |
| 313 for (int i = 0; i < 20; ++i) { | |
| 314 buffer.validate(SkScalarIsFinite(fMatrix.fMat[i])); | |
|
sugoi1
2013/12/06 18:39:04
I didn't find anything obviously wrong with removi
| |
| 315 } | 313 } |
| 316 } | 314 } |
| 317 | 315 |
| 318 bool SkColorMatrixFilter::asColorMatrix(SkScalar matrix[20]) const { | 316 bool SkColorMatrixFilter::asColorMatrix(SkScalar matrix[20]) const { |
| 319 if (matrix) { | 317 if (matrix) { |
| 320 memcpy(matrix, fMatrix.fMat, 20 * sizeof(SkScalar)); | 318 memcpy(matrix, fMatrix.fMat, 20 * sizeof(SkScalar)); |
| 321 } | 319 } |
| 322 return true; | 320 return true; |
| 323 } | 321 } |
| 324 | 322 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 489 str->append("matrix: ("); | 487 str->append("matrix: ("); |
| 490 for (int i = 0; i < 20; ++i) { | 488 for (int i = 0; i < 20; ++i) { |
| 491 str->appendScalar(fMatrix.fMat[i]); | 489 str->appendScalar(fMatrix.fMat[i]); |
| 492 if (i < 19) { | 490 if (i < 19) { |
| 493 str->append(", "); | 491 str->append(", "); |
| 494 } | 492 } |
| 495 } | 493 } |
| 496 str->append(")"); | 494 str->append(")"); |
| 497 } | 495 } |
| 498 #endif | 496 #endif |
| OLD | NEW |