summaryrefslogtreecommitdiffstats
path: root/skia/ext/convolver.h
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-12 20:19:14 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-12 20:19:14 +0000
commit465b34b73d11d017dfc546821c8dcb8e4dbe4b56 (patch)
tree465760a07b08c237db9026fb968374cad3be6e92 /skia/ext/convolver.h
parent76960a40e09420ac2e302f4b307c4dd0d8a61ce8 (diff)
downloadchromium_src-465b34b73d11d017dfc546821c8dcb8e4dbe4b56.zip
chromium_src-465b34b73d11d017dfc546821c8dcb8e4dbe4b56.tar.gz
chromium_src-465b34b73d11d017dfc546821c8dcb8e4dbe4b56.tar.bz2
Move Image operations and convolver to the skia namespace and clean up a few (but not all) base types.
Review URL: http://codereview.chromium.org/13726 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6921 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext/convolver.h')
-rw-r--r--skia/ext/convolver.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/skia/ext/convolver.h b/skia/ext/convolver.h
index 3ae84cd..225a17d 100644
--- a/skia/ext/convolver.h
+++ b/skia/ext/convolver.h
@@ -10,11 +10,11 @@
#include "base/basictypes.h"
// avoid confusion with Mac OS X's math library (Carbon)
-#if defined(OS_MACOSX)
+#if defined(__APPLE__)
#undef FloatToFixed
#endif
-namespace gfx {
+namespace skia {
// Represents a filter in one dimension. Each output pixel has one entry in this
// object for the filter values contributing to it. You build up the filter
@@ -29,14 +29,16 @@ class ConvolusionFilter1D {
// The number of bits that fixed point values are shifted by.
enum { kShiftBits = 14 };
+ typedef short Fixed;
+
ConvolusionFilter1D() : max_filter_(0) {
}
// Convert between floating point and our fixed point representation.
- static inline int16 FloatToFixed(float f) {
- return static_cast<int16>(f * (1 << kShiftBits));
+ static Fixed FloatToFixed(float f) {
+ return static_cast<Fixed>(f * (1 << kShiftBits));
}
- static inline unsigned char FixedToChar(int16 x) {
+ static unsigned char FixedToChar(Fixed x) {
return static_cast<unsigned char>(x >> kShiftBits);
}
@@ -65,7 +67,7 @@ class ConvolusionFilter1D {
// Same as the above version, but the input is already fixed point.
void AddFilter(int filter_offset,
- const int16* filter_values,
+ const Fixed* filter_values,
int filter_length);
// Retrieves a filter for the given |value_offset|, a position in the output
@@ -73,7 +75,7 @@ class ConvolusionFilter1D {
// filter values are put into the corresponding out arguments (see AddFilter
// above for what these mean), and a pointer to the first scaling factor is
// returned. There will be |filter_length| values in this array.
- inline const int16* FilterForValue(int value_offset,
+ inline const Fixed* FilterForValue(int value_offset,
int* filter_offset,
int* filter_length) const {
const FilterInstance& filter = filters_[value_offset];
@@ -100,7 +102,7 @@ class ConvolusionFilter1D {
// We store all the filter values in this flat list, indexed by
// |FilterInstance.data_location| to avoid the mallocs required for storing
// each one separately.
- std::vector<int16> filter_values_;
+ std::vector<Fixed> filter_values_;
// The maximum size of any filter we've added.
int max_filter_;
@@ -124,14 +126,14 @@ class ConvolusionFilter1D {
//
// The layout in memory is assumed to be 4-bytes per pixel in B-G-R-A order
// (this is ARGB when loaded into 32-bit words on a little-endian machine).
-void BGRAConvolve2D(const uint8* source_data,
+void BGRAConvolve2D(const unsigned char* source_data,
int source_byte_row_stride,
bool source_has_alpha,
const ConvolusionFilter1D& xfilter,
const ConvolusionFilter1D& yfilter,
- uint8* output);
+ unsigned char* output);
-} // namespace gfx
+} // namespace skia
#endif // SKIA_EXT_CONVOLVER_H_