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

Side by Side Diff: src/core/SkConvolver.h

Issue 1306443004: Use static_assert instead of SK_COMPILE_ASSERT. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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/core/SkClipStack.cpp ('k') | src/core/SkImageFilter.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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 SK_CONVOLVER_H 5 #ifndef SK_CONVOLVER_H
6 #define SK_CONVOLVER_H 6 #define SK_CONVOLVER_H
7 7
8 #include "SkSize.h" 8 #include "SkSize.h"
9 #include "SkTypes.h" 9 #include "SkTypes.h"
10 #include "SkTArray.h" 10 #include "SkTArray.h"
(...skipping 28 matching lines...) Expand all
39 static ConvolutionFixed FloatToFixed(float f) { 39 static ConvolutionFixed FloatToFixed(float f) {
40 return static_cast<ConvolutionFixed>(f * (1 << kShiftBits)); 40 return static_cast<ConvolutionFixed>(f * (1 << kShiftBits));
41 } 41 }
42 static unsigned char FixedToChar(ConvolutionFixed x) { 42 static unsigned char FixedToChar(ConvolutionFixed x) {
43 return static_cast<unsigned char>(x >> kShiftBits); 43 return static_cast<unsigned char>(x >> kShiftBits);
44 } 44 }
45 static float FixedToFloat(ConvolutionFixed x) { 45 static float FixedToFloat(ConvolutionFixed x) {
46 // The cast relies on ConvolutionFixed being a short, implying that on 46 // The cast relies on ConvolutionFixed being a short, implying that on
47 // the platforms we care about all (16) bits will fit into 47 // the platforms we care about all (16) bits will fit into
48 // the mantissa of a (32-bit) float. 48 // the mantissa of a (32-bit) float.
49 SK_COMPILE_ASSERT(sizeof(ConvolutionFixed) == 2, ConvolutionFixed_type_s hould_fit_in_float_mantissa); 49 static_assert(sizeof(ConvolutionFixed) == 2, "ConvolutionFixed_type_shou ld_fit_in_float_mantissa");
50 float raw = static_cast<float>(x); 50 float raw = static_cast<float>(x);
51 return ldexpf(raw, -kShiftBits); 51 return ldexpf(raw, -kShiftBits);
52 } 52 }
53 53
54 // Returns the maximum pixel span of a filter. 54 // Returns the maximum pixel span of a filter.
55 int maxFilter() const { return fMaxFilter; } 55 int maxFilter() const { return fMaxFilter; }
56 56
57 // Returns the number of filters in this filter. This is the dimension of th e 57 // Returns the number of filters in this filter. This is the dimension of th e
58 // output image. 58 // output image.
59 int numValues() const { return static_cast<int>(fFilters.count()); } 59 int numValues() const { return static_cast<int>(fFilters.count()); }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 int sourceByteRowStride, 197 int sourceByteRowStride,
198 bool sourceHasAlpha, 198 bool sourceHasAlpha,
199 const SkConvolutionFilter1D& xfilter, 199 const SkConvolutionFilter1D& xfilter,
200 const SkConvolutionFilter1D& yfilter, 200 const SkConvolutionFilter1D& yfilter,
201 int outputByteRowStride, 201 int outputByteRowStride,
202 unsigned char* output, 202 unsigned char* output,
203 const SkConvolutionProcs&, 203 const SkConvolutionProcs&,
204 bool useSimdIfPossible); 204 bool useSimdIfPossible);
205 205
206 #endif // SK_CONVOLVER_H 206 #endif // SK_CONVOLVER_H
OLDNEW
« no previous file with comments | « src/core/SkClipStack.cpp ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698