| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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); |
| OLD | NEW |