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

Unified Diff: skia/ext/convolver.h

Issue 5575010: Integration of most changes from the GoogleTV project around the convolver/sc... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Latest rounds of changes to address Brett's comments Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | skia/ext/convolver.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/convolver.h
===================================================================
--- skia/ext/convolver.h (revision 72357)
+++ skia/ext/convolver.h (working copy)
@@ -6,11 +6,15 @@
#define SKIA_EXT_CONVOLVER_H_
#pragma once
+#include <cmath>
#include <vector>
+#include "base/basictypes.h"
+
// avoid confusion with Mac OS X's math library (Carbon)
#if defined(__APPLE__)
#undef FloatToFixed
+#undef FixedToFloat
#endif
namespace skia {
@@ -40,6 +44,14 @@
static unsigned char FixedToChar(Fixed x) {
return static_cast<unsigned char>(x >> kShiftBits);
}
+ static float FixedToFloat(Fixed x) {
+ // The cast relies on Fixed being a short, implying that on
+ // the platforms we care about all (16) bits will fit into
+ // the mantissa of a (32-bit) float.
+ COMPILE_ASSERT(sizeof(Fixed) == 2, fixed_type_should_fit_in_float_mantissa);
+ float raw = static_cast<float>(x);
+ return ldexpf(raw, -kShiftBits);
+ }
// Returns the maximum pixel span of a filter.
int max_filter() const { return max_filter_; }
@@ -80,6 +92,9 @@
const FilterInstance& filter = filters_[value_offset];
*filter_offset = filter.offset;
*filter_length = filter.length;
+ if (filter.length == 0) {
+ return NULL;
+ }
return &filter_values_[filter.data_location];
}
@@ -130,9 +145,9 @@
bool source_has_alpha,
const ConvolutionFilter1D& xfilter,
const ConvolutionFilter1D& yfilter,
+ int output_byte_row_stride,
unsigned char* output);
} // namespace skia
#endif // SKIA_EXT_CONVOLVER_H_
-
« no previous file with comments | « no previous file | skia/ext/convolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698