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 "SkBenchmark.h" | 8 #include "SkBenchmark.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColorShader.h" | 10 #include "SkColorShader.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 SkString fText; | 37 SkString fText; |
38 SkString fName; | 38 SkString fName; |
39 FontQuality fFQ; | 39 FontQuality fFQ; |
40 public: | 40 public: |
41 ShaderMaskBench(bool isOpaque, FontQuality fq) { | 41 ShaderMaskBench(bool isOpaque, FontQuality fq) { |
42 fFQ = fq; | 42 fFQ = fq; |
43 fText.set(STR); | 43 fText.set(STR); |
44 | 44 |
45 fPaint.setAntiAlias(kBW != fq); | 45 fPaint.setAntiAlias(kBW != fq); |
46 fPaint.setLCDRenderText(kLCD == fq); | 46 fPaint.setLCDRenderText(kLCD == fq); |
47 fPaint.setAlpha(isOpaque ? 0xFF : 0x80); | 47 fPaint.setShader(new SkColorShader(isOpaque ? 0xFFFFFFFF : 0x80808080))-
>unref(); |
48 fPaint.setShader(new SkColorShader)->unref(); | |
49 } | 48 } |
50 | 49 |
51 protected: | 50 protected: |
52 virtual const char* onGetName() { | 51 virtual const char* onGetName() { |
53 fName.printf("shadermask"); | 52 fName.printf("shadermask"); |
54 fName.appendf("_%s", fontQualityName(fPaint)); | 53 fName.appendf("_%s", fontQualityName(fPaint)); |
55 fName.appendf("_%02X", fPaint.getAlpha()); | 54 fName.appendf("_%02X", fPaint.getAlpha()); |
56 return fName.c_str(); | 55 return fName.c_str(); |
57 } | 56 } |
58 | 57 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 }; | 89 }; |
91 | 90 |
92 /////////////////////////////////////////////////////////////////////////////// | 91 /////////////////////////////////////////////////////////////////////////////// |
93 | 92 |
94 DEF_BENCH( return new ShaderMaskBench(true, kBW); ) | 93 DEF_BENCH( return new ShaderMaskBench(true, kBW); ) |
95 DEF_BENCH( return new ShaderMaskBench(false, kBW); ) | 94 DEF_BENCH( return new ShaderMaskBench(false, kBW); ) |
96 DEF_BENCH( return new ShaderMaskBench(true, kAA); ) | 95 DEF_BENCH( return new ShaderMaskBench(true, kAA); ) |
97 DEF_BENCH( return new ShaderMaskBench(false, kAA); ) | 96 DEF_BENCH( return new ShaderMaskBench(false, kAA); ) |
98 DEF_BENCH( return new ShaderMaskBench(true, kLCD); ) | 97 DEF_BENCH( return new ShaderMaskBench(true, kLCD); ) |
99 DEF_BENCH( return new ShaderMaskBench(false, kLCD); ) | 98 DEF_BENCH( return new ShaderMaskBench(false, kLCD); ) |
OLD | NEW |