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

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

Issue 83343003: Adding more validation (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fixed comments Created 7 years 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
« no previous file with comments | « src/effects/SkMergeImageFilter.cpp ('k') | src/effects/SkOffsetImageFilter.cpp » ('j') | 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 "SkMorphologyImageFilter.h" 8 #include "SkMorphologyImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
11 #include "SkFlattenableBuffers.h" 11 #include "SkFlattenableBuffers.h"
12 #include "SkRect.h" 12 #include "SkRect.h"
13 #include "SkMorphology_opts.h" 13 #include "SkMorphology_opts.h"
14 #if SK_SUPPORT_GPU 14 #if SK_SUPPORT_GPU
15 #include "GrContext.h" 15 #include "GrContext.h"
16 #include "GrTexture.h" 16 #include "GrTexture.h"
17 #include "GrTBackendEffectFactory.h" 17 #include "GrTBackendEffectFactory.h"
18 #include "gl/GrGLEffect.h" 18 #include "gl/GrGLEffect.h"
19 #include "effects/Gr1DKernelEffect.h" 19 #include "effects/Gr1DKernelEffect.h"
20 #include "SkImageFilterUtils.h" 20 #include "SkImageFilterUtils.h"
21 #endif 21 #endif
22 22
23 SkMorphologyImageFilter::SkMorphologyImageFilter(SkFlattenableReadBuffer& buffer ) 23 SkMorphologyImageFilter::SkMorphologyImageFilter(SkFlattenableReadBuffer& buffer )
24 : INHERITED(buffer) { 24 : INHERITED(1, buffer) {
25 fRadius.fWidth = buffer.readInt(); 25 fRadius.fWidth = buffer.readInt();
26 fRadius.fHeight = buffer.readInt(); 26 fRadius.fHeight = buffer.readInt();
27 buffer.validate((fRadius.fWidth >= 0) && 27 buffer.validate((fRadius.fWidth >= 0) &&
28 (fRadius.fHeight >= 0)); 28 (fRadius.fHeight >= 0));
29 } 29 }
30 30
31 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, int radiusY, SkIma geFilter* input, const CropRect* cropRect) 31 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, int radiusY, SkIma geFilter* input, const CropRect* cropRect)
32 : INHERITED(input, cropRect), fRadius(SkISize::Make(radiusX, radiusY)) { 32 : INHERITED(input, cropRect), fRadius(SkISize::Make(radiusX, radiusY)) {
33 } 33 }
34 34
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 614
615 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy pe, radius(), result)) { 615 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy pe, radius(), result)) {
616 return false; 616 return false;
617 } 617 }
618 offset->fX += bounds.left(); 618 offset->fX += bounds.left();
619 offset->fY += bounds.top(); 619 offset->fY += bounds.top();
620 return true; 620 return true;
621 } 621 }
622 622
623 #endif 623 #endif
OLDNEW
« no previous file with comments | « src/effects/SkMergeImageFilter.cpp ('k') | src/effects/SkOffsetImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698