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

Side by Side Diff: samplecode/SampleText.cpp

Issue 85463005: remove SkFloatToScalar macro (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add flag to expose SkFloatToScalar to chromium 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 | « samplecode/SampleSlides.cpp ('k') | samplecode/SampleTextOnPath.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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 void SkPowerMode::init(SkScalar e) { 169 void SkPowerMode::init(SkScalar e) {
170 fExp = e; 170 fExp = e;
171 float ee = SkScalarToFloat(e); 171 float ee = SkScalarToFloat(e);
172 172
173 printf("------ %g\n", ee); 173 printf("------ %g\n", ee);
174 for (int i = 0; i < 256; i++) { 174 for (int i = 0; i < 256; i++) {
175 float x = i / 255.f; 175 float x = i / 255.f;
176 // printf(" %d %g", i, x); 176 // printf(" %d %g", i, x);
177 x = powf(x, ee); 177 x = powf(x, ee);
178 // printf(" %g", x); 178 // printf(" %g", x);
179 int xx = SkScalarRound(SkFloatToScalar(x * 255)); 179 int xx = SkScalarRound(x * 255);
180 // printf(" %d\n", xx); 180 // printf(" %d\n", xx);
181 fTable[i] = SkToU8(xx); 181 fTable[i] = SkToU8(xx);
182 } 182 }
183 } 183 }
184 184
185 void SkPowerMode::xfer16(uint16_t dst[], const SkPMColor src[], int count, 185 void SkPowerMode::xfer16(uint16_t dst[], const SkPMColor src[], int count,
186 const SkAlpha aa[]) const { 186 const SkAlpha aa[]) const {
187 for (int i = 0; i < count; i++) { 187 for (int i = 0; i < count; i++) {
188 SkPMColor c = src[i]; 188 SkPMColor c = src[i];
189 int r = SkGetPackedR32(c); 189 int r = SkGetPackedR32(c);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 SkScalar fClickX; 351 SkScalar fClickX;
352 SkMaskFilter* fMF; 352 SkMaskFilter* fMF;
353 353
354 typedef SampleView INHERITED; 354 typedef SampleView INHERITED;
355 }; 355 };
356 356
357 ////////////////////////////////////////////////////////////////////////////// 357 //////////////////////////////////////////////////////////////////////////////
358 358
359 static SkView* MyFactory() { return new TextSpeedView; } 359 static SkView* MyFactory() { return new TextSpeedView; }
360 static SkViewRegister reg(MyFactory); 360 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleSlides.cpp ('k') | samplecode/SampleTextOnPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698