OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SKIA_EXT_CONVOLVER_H_ | 5 #ifndef SKIA_EXT_CONVOLVER_H_ |
6 #define SKIA_EXT_CONVOLVER_H_ | 6 #define SKIA_EXT_CONVOLVER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 // ConvolutionFilter1D, then convolving each column by another one. | 23 // ConvolutionFilter1D, then convolving each column by another one. |
24 // | 24 // |
25 // Entries are stored in fixed point, shifted left by kShiftBits. | 25 // Entries are stored in fixed point, shifted left by kShiftBits. |
26 class ConvolutionFilter1D { | 26 class ConvolutionFilter1D { |
27 public: | 27 public: |
28 // The number of bits that fixed point values are shifted by. | 28 // The number of bits that fixed point values are shifted by. |
29 enum { kShiftBits = 14 }; | 29 enum { kShiftBits = 14 }; |
30 | 30 |
31 typedef short Fixed; | 31 typedef short Fixed; |
32 | 32 |
33 ConvolutionFilter1D() : max_filter_(0) { | 33 ConvolutionFilter1D(); |
34 } | 34 ~ConvolutionFilter1D(); |
35 | 35 |
36 // Convert between floating point and our fixed point representation. | 36 // Convert between floating point and our fixed point representation. |
37 static Fixed FloatToFixed(float f) { | 37 static Fixed FloatToFixed(float f) { |
38 return static_cast<Fixed>(f * (1 << kShiftBits)); | 38 return static_cast<Fixed>(f * (1 << kShiftBits)); |
39 } | 39 } |
40 static unsigned char FixedToChar(Fixed x) { | 40 static unsigned char FixedToChar(Fixed x) { |
41 return static_cast<unsigned char>(x >> kShiftBits); | 41 return static_cast<unsigned char>(x >> kShiftBits); |
42 } | 42 } |
43 | 43 |
44 // Returns the maximum pixel span of a filter. | 44 // Returns the maximum pixel span of a filter. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 int source_byte_row_stride, | 129 int source_byte_row_stride, |
130 bool source_has_alpha, | 130 bool source_has_alpha, |
131 const ConvolutionFilter1D& xfilter, | 131 const ConvolutionFilter1D& xfilter, |
132 const ConvolutionFilter1D& yfilter, | 132 const ConvolutionFilter1D& yfilter, |
133 unsigned char* output); | 133 unsigned char* output); |
134 | 134 |
135 } // namespace skia | 135 } // namespace skia |
136 | 136 |
137 #endif // SKIA_EXT_CONVOLVER_H_ | 137 #endif // SKIA_EXT_CONVOLVER_H_ |
138 | 138 |
OLD | NEW |