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" |
11 #include "SkReadBuffer.h" | 11 #include "SkReadBuffer.h" |
12 #include "SkWriteBuffer.h" | 12 #include "SkWriteBuffer.h" |
13 #include "SkGradientShader.h" | 13 #include "SkGradientShader.h" |
14 #include "SkPath.h" | 14 #include "SkPath.h" |
15 #include "SkRegion.h" | 15 #include "SkRegion.h" |
16 #include "SkShader.h" | 16 #include "SkShader.h" |
17 #include "SkUtils.h" | 17 #include "SkUtils.h" |
18 #include "SkColorPriv.h" | 18 #include "SkColorPriv.h" |
19 #include "SkColorFilter.h" | 19 #include "SkColorFilter.h" |
20 #include "SkTypeface.h" | 20 #include "SkTypeface.h" |
| 21 #include "SkAvoidXfermode.h" |
21 | 22 |
22 static inline SkPMColor rgb2gray(SkPMColor c) { | 23 static inline SkPMColor rgb2gray(SkPMColor c) { |
23 unsigned r = SkGetPackedR32(c); | 24 unsigned r = SkGetPackedR32(c); |
24 unsigned g = SkGetPackedG32(c); | 25 unsigned g = SkGetPackedG32(c); |
25 unsigned b = SkGetPackedB32(c); | 26 unsigned b = SkGetPackedB32(c); |
26 | 27 |
27 unsigned x = (r * 5 + g * 7 + b * 4) >> 4; | 28 unsigned x = (r * 5 + g * 7 + b * 4) >> 4; |
28 | 29 |
29 return SkPackARGB32(0, x, x, x) | (c & (SK_A32_MASK << SK_A32_SHIFT)); | 30 return SkPackARGB32(0, x, x, x) | (c & (SK_A32_MASK << SK_A32_SHIFT)); |
30 } | 31 } |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 246 } |
246 | 247 |
247 private: | 248 private: |
248 typedef SkView INHERITED; | 249 typedef SkView INHERITED; |
249 }; | 250 }; |
250 | 251 |
251 ////////////////////////////////////////////////////////////////////////////// | 252 ////////////////////////////////////////////////////////////////////////////// |
252 | 253 |
253 static SkView* MyFactory() { return new ClockFaceView; } | 254 static SkView* MyFactory() { return new ClockFaceView; } |
254 static SkViewRegister reg(MyFactory); | 255 static SkViewRegister reg(MyFactory); |
OLD | NEW |