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

Side by Side Diff: src/effects/SkColorMatrixFilter.cpp

Issue 23021015: Initial error handling code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Comments fixed Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
312 this->initState(fMatrix.fMat); 312 this->initState(fMatrix.fMat);
313 for (int i = 0; i < 20; ++i) {
314 buffer.validate(SkScalarIsFinite(fMatrix.fMat[0]));
mtklein 2013/10/16 18:54:09 fMat[i]?
sugoi1 2013/10/16 20:07:41 ouf... good catch! Fixed
315 }
313 } 316 }
314 317
315 bool SkColorMatrixFilter::asColorMatrix(SkScalar matrix[20]) const { 318 bool SkColorMatrixFilter::asColorMatrix(SkScalar matrix[20]) const {
316 if (matrix) { 319 if (matrix) {
317 memcpy(matrix, fMatrix.fMat, 20 * sizeof(SkScalar)); 320 memcpy(matrix, fMatrix.fMat, 20 * sizeof(SkScalar));
318 } 321 }
319 return true; 322 return true;
320 } 323 }
321 324
322 #if SK_SUPPORT_GPU 325 #if SK_SUPPORT_GPU
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 str->append("matrix: ("); 489 str->append("matrix: (");
487 for (int i = 0; i < 20; ++i) { 490 for (int i = 0; i < 20; ++i) {
488 str->appendScalar(fMatrix.fMat[i]); 491 str->appendScalar(fMatrix.fMat[i]);
489 if (i < 19) { 492 if (i < 19) {
490 str->append(", "); 493 str->append(", ");
491 } 494 }
492 } 495 }
493 str->append(")"); 496 str->append(")");
494 } 497 }
495 #endif 498 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698