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" | |
22 | 21 |
23 static inline SkPMColor rgb2gray(SkPMColor c) { | 22 static inline SkPMColor rgb2gray(SkPMColor c) { |
24 unsigned r = SkGetPackedR32(c); | 23 unsigned r = SkGetPackedR32(c); |
25 unsigned g = SkGetPackedG32(c); | 24 unsigned g = SkGetPackedG32(c); |
26 unsigned b = SkGetPackedB32(c); | 25 unsigned b = SkGetPackedB32(c); |
27 | 26 |
28 unsigned x = (r * 5 + g * 7 + b * 4) >> 4; | 27 unsigned x = (r * 5 + g * 7 + b * 4) >> 4; |
29 | 28 |
30 return SkPackARGB32(0, x, x, x) | (c & (SK_A32_MASK << SK_A32_SHIFT)); | 29 return SkPackARGB32(0, x, x, x) | (c & (SK_A32_MASK << SK_A32_SHIFT)); |
31 } | 30 } |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } | 245 } |
247 | 246 |
248 private: | 247 private: |
249 typedef SkView INHERITED; | 248 typedef SkView INHERITED; |
250 }; | 249 }; |
251 | 250 |
252 ////////////////////////////////////////////////////////////////////////////// | 251 ////////////////////////////////////////////////////////////////////////////// |
253 | 252 |
254 static SkView* MyFactory() { return new ClockFaceView; } | 253 static SkView* MyFactory() { return new ClockFaceView; } |
255 static SkViewRegister reg(MyFactory); | 254 static SkViewRegister reg(MyFactory); |
OLD | NEW |