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

Side by Side Diff: src/utils/SkUnitMappers.cpp

Issue 98703002: Fix compilation with SK_ENABLE_INST_COUNT=1 (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/utils/SkLayer.cpp ('k') | src/views/SkEventSink.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 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SkUnitMappers.h" 8 #include "SkUnitMappers.h"
9 #include "SkFlattenableBuffers.h" 9 #include "SkFlattenableBuffers.h"
10 10
11 SK_DEFINE_INST_COUNT(SkUnitMapper)
12
13 SkDiscreteMapper::SkDiscreteMapper(int segments) { 11 SkDiscreteMapper::SkDiscreteMapper(int segments) {
14 if (segments < 2) { 12 if (segments < 2) {
15 fSegments = 0; 13 fSegments = 0;
16 fScale = 0; 14 fScale = 0;
17 } else { 15 } else {
18 if (segments > 0xFFFF) { 16 if (segments > 0xFFFF) {
19 segments = 0xFFFF; 17 segments = 0xFFFF;
20 } 18 }
21 fSegments = segments; 19 fSegments = segments;
22 fScale = SK_Fract1 / (segments - 1); 20 fScale = SK_Fract1 / (segments - 1);
(...skipping 29 matching lines...) Expand all
52 16bits and pi/2 is 17bits, so we shift down our pi const before we mul 50 16bits and pi/2 is 17bits, so we shift down our pi const before we mul
53 */ 51 */
54 SkFixed rads = (unsigned)(input * (SK_FixedPI >> 2)) >> 15; 52 SkFixed rads = (unsigned)(input * (SK_FixedPI >> 2)) >> 15;
55 SkFixed x = SkFixedCos(rads); 53 SkFixed x = SkFixedCos(rads);
56 x += x << 15 >> 31; // map 0x10000 to 0xFFFF 54 x += x << 15 >> 31; // map 0x10000 to 0xFFFF
57 return SkToU16(x); 55 return SkToU16(x);
58 } 56 }
59 57
60 SkCosineMapper::SkCosineMapper(SkFlattenableReadBuffer& rb) 58 SkCosineMapper::SkCosineMapper(SkFlattenableReadBuffer& rb)
61 : SkUnitMapper(rb) {} 59 : SkUnitMapper(rb) {}
OLDNEW
« no previous file with comments | « src/utils/SkLayer.cpp ('k') | src/views/SkEventSink.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698