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

Side by Side Diff: src/effects/SkTestImageFilters.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/effects/SkResizeImageFilter.cpp ('k') | src/effects/SkTileImageFilter.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 #include "SkTestImageFilters.h" 2 #include "SkTestImageFilters.h"
3 #include "SkCanvas.h" 3 #include "SkCanvas.h"
4 #include "SkDevice.h" 4 #include "SkDevice.h"
5 #include "SkReadBuffer.h" 5 #include "SkReadBuffer.h"
6 #include "SkWriteBuffer.h" 6 #include "SkWriteBuffer.h"
7 7
8 // Simple helper canvas that "takes ownership" of the provided device, so that 8 // Simple helper canvas that "takes ownership" of the provided device, so that
9 // when this canvas goes out of scope, so will its device. Could be replaced 9 // when this canvas goes out of scope, so will its device. Could be replaced
10 // with the following: 10 // with the following:
11 // 11 //
12 // SkCanvas canvas(device); 12 // SkCanvas canvas(device);
13 // SkAutoTUnref<SkBaseDevice> aur(device); 13 // SkAutoTUnref<SkBaseDevice> aur(device);
14 // 14 //
15 class OwnDeviceCanvas : public SkCanvas { 15 class OwnDeviceCanvas : public SkCanvas {
16 public: 16 public:
17 OwnDeviceCanvas(SkBaseDevice* device) : SkCanvas(device) { 17 OwnDeviceCanvas(SkBaseDevice* device) : SkCanvas(device) {
18 SkSafeUnref(device); 18 SkSafeUnref(device);
19 } 19 }
20 }; 20 };
21 21
22 /////////////////////////////////////////////////////////////////////////////// 22 ///////////////////////////////////////////////////////////////////////////////
23 23
24 bool SkDownSampleImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, 24 bool SkDownSampleImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
25 const SkMatrix&, 25 const SkMatrix&,
26 SkBitmap* result, SkIPoint*) { 26 SkBitmap* result, SkIPoint*) const {
27 SkScalar scale = fScale; 27 SkScalar scale = fScale;
28 if (scale > SK_Scalar1 || scale <= 0) { 28 if (scale > SK_Scalar1 || scale <= 0) {
29 return false; 29 return false;
30 } 30 }
31 31
32 int dstW = SkScalarRoundToInt(src.width() * scale); 32 int dstW = SkScalarRoundToInt(src.width() * scale);
33 int dstH = SkScalarRoundToInt(src.height() * scale); 33 int dstH = SkScalarRoundToInt(src.height() * scale);
34 if (dstW < 1) { 34 if (dstW < 1) {
35 dstW = 1; 35 dstW = 1;
36 } 36 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 this->INHERITED::flatten(buffer); 75 this->INHERITED::flatten(buffer);
76 76
77 buffer.writeScalar(fScale); 77 buffer.writeScalar(fScale);
78 } 78 }
79 79
80 SkDownSampleImageFilter::SkDownSampleImageFilter(SkReadBuffer& buffer) 80 SkDownSampleImageFilter::SkDownSampleImageFilter(SkReadBuffer& buffer)
81 : INHERITED(1, buffer) { 81 : INHERITED(1, buffer) {
82 fScale = buffer.readScalar(); 82 fScale = buffer.readScalar();
83 buffer.validate(SkScalarIsFinite(fScale)); 83 buffer.validate(SkScalarIsFinite(fScale));
84 } 84 }
OLDNEW
« no previous file with comments | « src/effects/SkResizeImageFilter.cpp ('k') | src/effects/SkTileImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698