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

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

Issue 319003002: Adding kernel offset validation (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The Android Open Source Project 2 * Copyright 2012 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkMatrixConvolutionImageFilter.h" 8 #include "SkMatrixConvolutionImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 fGain = buffer.readScalar(); 80 fGain = buffer.readScalar();
81 fBias = buffer.readScalar(); 81 fBias = buffer.readScalar();
82 fKernelOffset.fX = buffer.readInt(); 82 fKernelOffset.fX = buffer.readInt();
83 fKernelOffset.fY = buffer.readInt(); 83 fKernelOffset.fY = buffer.readInt();
84 fTileMode = (TileMode) buffer.readInt(); 84 fTileMode = (TileMode) buffer.readInt();
85 fConvolveAlpha = buffer.readBool(); 85 fConvolveAlpha = buffer.readBool();
86 buffer.validate((fKernel != 0) && 86 buffer.validate((fKernel != 0) &&
87 SkScalarIsFinite(fGain) && 87 SkScalarIsFinite(fGain) &&
88 SkScalarIsFinite(fBias) && 88 SkScalarIsFinite(fBias) &&
89 tile_mode_is_valid(fTileMode)); 89 tile_mode_is_valid(fTileMode) &&
90 (fKernelOffset.fX >= 0) && (fKernelOffset.fX < fKernelSize.f Width) &&
91 (fKernelOffset.fY >= 0) && (fKernelOffset.fY < fKernelSize.f Height));
90 } 92 }
91 93
92 void SkMatrixConvolutionImageFilter::flatten(SkWriteBuffer& buffer) const { 94 void SkMatrixConvolutionImageFilter::flatten(SkWriteBuffer& buffer) const {
93 this->INHERITED::flatten(buffer); 95 this->INHERITED::flatten(buffer);
94 buffer.writeInt(fKernelSize.fWidth); 96 buffer.writeInt(fKernelSize.fWidth);
95 buffer.writeInt(fKernelSize.fHeight); 97 buffer.writeInt(fKernelSize.fHeight);
96 buffer.writeScalarArray(fKernel, fKernelSize.fWidth * fKernelSize.fHeight); 98 buffer.writeScalarArray(fKernel, fKernelSize.fWidth * fKernelSize.fHeight);
97 buffer.writeScalar(fGain); 99 buffer.writeScalar(fGain);
98 buffer.writeScalar(fBias); 100 buffer.writeScalar(fBias);
99 buffer.writeInt(fKernelOffset.fX); 101 buffer.writeInt(fKernelOffset.fX);
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 fBias, 679 fBias,
678 fKernelOffset, 680 fKernelOffset,
679 fTileMode, 681 fTileMode,
680 fConvolveAlpha); 682 fConvolveAlpha);
681 return true; 683 return true;
682 } 684 }
683 685
684 /////////////////////////////////////////////////////////////////////////////// 686 ///////////////////////////////////////////////////////////////////////////////
685 687
686 #endif 688 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698