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

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

Issue 23021015: Initial error handling code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Adapting code to sk_once changes 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
« 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 #if SK_SUPPORT_GPU 13 #if SK_SUPPORT_GPU
14 #include "GrContext.h" 14 #include "GrContext.h"
15 #include "GrTexture.h" 15 #include "GrTexture.h"
16 #include "GrTBackendEffectFactory.h" 16 #include "GrTBackendEffectFactory.h"
17 #include "gl/GrGLEffect.h" 17 #include "gl/GrGLEffect.h"
18 #include "effects/Gr1DKernelEffect.h" 18 #include "effects/Gr1DKernelEffect.h"
19 #include "SkImageFilterUtils.h" 19 #include "SkImageFilterUtils.h"
20 #endif 20 #endif
21 21
22 SkMorphologyImageFilter::SkMorphologyImageFilter(SkFlattenableReadBuffer& buffer ) 22 SkMorphologyImageFilter::SkMorphologyImageFilter(SkFlattenableReadBuffer& buffer )
23 : INHERITED(buffer) { 23 : INHERITED(buffer) {
24 fRadius.fWidth = buffer.readInt(); 24 fRadius.fWidth = buffer.readInt();
25 fRadius.fHeight = buffer.readInt(); 25 fRadius.fHeight = buffer.readInt();
26 buffer.validate((fRadius.fWidth >= 0) &&
27 (fRadius.fHeight >= 0));
26 } 28 }
27 29
28 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, int radiusY, SkIma geFilter* input, const CropRect* cropRect) 30 SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, int radiusY, SkIma geFilter* input, const CropRect* cropRect)
29 : INHERITED(input, cropRect), fRadius(SkISize::Make(radiusX, radiusY)) { 31 : INHERITED(input, cropRect), fRadius(SkISize::Make(radiusX, radiusY)) {
30 } 32 }
31 33
32 34
33 void SkMorphologyImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { 35 void SkMorphologyImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const {
34 this->INHERITED::flatten(buffer); 36 this->INHERITED::flatten(buffer);
35 buffer.writeInt(fRadius.fWidth); 37 buffer.writeInt(fRadius.fWidth);
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 583
582 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy pe, radius(), result)) { 584 if (!apply_morphology(input, bounds, GrMorphologyEffect::kErode_MorphologyTy pe, radius(), result)) {
583 return false; 585 return false;
584 } 586 }
585 offset->fX += bounds.left(); 587 offset->fX += bounds.left();
586 offset->fY += bounds.top(); 588 offset->fY += bounds.top();
587 return true; 589 return true;
588 } 590 }
589 591
590 #endif 592 #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