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

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: Fixes to address Brett's comments Created 10 years 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') | skia/ext/image_operations.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/convolver.h
===================================================================
--- skia/ext/convolver.h (revision 68621)
+++ skia/ext/convolver.h (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,11 +6,13 @@
#define SKIA_EXT_CONVOLVER_H_
#pragma once
+#include <cmath>
#include <vector>
// avoid confusion with Mac OS X's math library (Carbon)
#if defined(__APPLE__)
#undef FloatToFixed
+#undef FixedToFloat
#endif
namespace skia {
@@ -40,6 +42,13 @@
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.
+ 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,7 +89,11 @@
const FilterInstance& filter = filters_[value_offset];
*filter_offset = filter.offset;
*filter_length = filter.length;
- return &filter_values_[filter.data_location];
+ if (filter.length == 0) {
+ return NULL;
+ } else {
+ return &filter_values_[filter.data_location];
+ }
}
private:
@@ -130,9 +143,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') | skia/ext/image_operations.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698