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

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

Issue 148883011: Make SkImageFilter methods const. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More fixes to gm/ Created 6 years, 10 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 | « src/core/SkImageFilterUtils.cpp ('k') | src/effects/SkBicubicImageFilter.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 2013 Google Inc. 2 * Copyright 2013 Google Inc.
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 "SkAlphaThresholdFilter.h" 8 #include "SkAlphaThresholdFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
11 #include "SkWriteBuffer.h" 11 #include "SkWriteBuffer.h"
12 #include "SkRegion.h" 12 #include "SkRegion.h"
13 13
14 class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter { 14 class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter {
15 public: 15 public:
16 SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold, SkScalar outerThreshold); 16 SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold, SkScalar outerThreshold);
17 17
18 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterIm pl) 18 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterIm pl)
19 19
20 protected: 20 protected:
21 explicit SkAlphaThresholdFilterImpl(SkReadBuffer& buffer); 21 explicit SkAlphaThresholdFilterImpl(SkReadBuffer& buffer);
22 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 22 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
23 23
24 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, 24 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
25 SkBitmap* result, SkIPoint* offset) SK_OVERRIDE; 25 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE;
26 #if SK_SUPPORT_GPU 26 #if SK_SUPPORT_GPU
27 virtual bool asNewEffect(GrEffectRef** effect, GrTexture* texture, 27 virtual bool asNewEffect(GrEffectRef** effect, GrTexture* texture,
28 const SkMatrix& matrix, const SkIRect& bounds) cons t SK_OVERRIDE; 28 const SkMatrix& matrix, const SkIRect& bounds) cons t SK_OVERRIDE;
29 #endif 29 #endif
30 30
31 private: 31 private:
32 SkRegion fRegion; 32 SkRegion fRegion;
33 SkScalar fInnerThreshold; 33 SkScalar fInnerThreshold;
34 SkScalar fOuterThreshold; 34 SkScalar fOuterThreshold;
35 typedef SkImageFilter INHERITED; 35 typedef SkImageFilter INHERITED;
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 298
299 void SkAlphaThresholdFilterImpl::flatten(SkWriteBuffer& buffer) const { 299 void SkAlphaThresholdFilterImpl::flatten(SkWriteBuffer& buffer) const {
300 this->INHERITED::flatten(buffer); 300 this->INHERITED::flatten(buffer);
301 buffer.writeScalar(fInnerThreshold); 301 buffer.writeScalar(fInnerThreshold);
302 buffer.writeScalar(fOuterThreshold); 302 buffer.writeScalar(fOuterThreshold);
303 buffer.writeRegion(fRegion); 303 buffer.writeRegion(fRegion);
304 } 304 }
305 305
306 bool SkAlphaThresholdFilterImpl::onFilterImage(Proxy*, const SkBitmap& src, 306 bool SkAlphaThresholdFilterImpl::onFilterImage(Proxy*, const SkBitmap& src,
307 const SkMatrix& matrix, SkBitmap* dst, 307 const SkMatrix& matrix, SkBitmap* dst,
308 SkIPoint* offset) { 308 SkIPoint* offset) const {
309 SkASSERT(src.config() == SkBitmap::kARGB_8888_Config); 309 SkASSERT(src.config() == SkBitmap::kARGB_8888_Config);
310 310
311 if (src.config() != SkBitmap::kARGB_8888_Config) { 311 if (src.config() != SkBitmap::kARGB_8888_Config) {
312 return false; 312 return false;
313 } 313 }
314 314
315 SkMatrix localInverse; 315 SkMatrix localInverse;
316 if (!matrix.invert(&localInverse)) { 316 if (!matrix.invert(&localInverse)) {
317 return false; 317 return false;
318 } 318 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 (U8CPU)(SkColorGetG(source) * scale), 358 (U8CPU)(SkColorGetG(source) * scale),
359 (U8CPU)(SkColorGetB(source) * scale)); 359 (U8CPU)(SkColorGetB(source) * scale));
360 } 360 }
361 } 361 }
362 dptr[y * dst->width() + x] = output_color; 362 dptr[y * dst->width() + x] = output_color;
363 } 363 }
364 } 364 }
365 365
366 return true; 366 return true;
367 } 367 }
OLDNEW
« no previous file with comments | « src/core/SkImageFilterUtils.cpp ('k') | src/effects/SkBicubicImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698