OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "Benchmark.h" | 8 #include "Benchmark.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 class RotRectBench: public Benchmark { | 68 class RotRectBench: public Benchmark { |
69 public: | 69 public: |
70 RotRectBench(bool aa, ColorType ct, SkXfermode::Mode mode) | 70 RotRectBench(bool aa, ColorType ct, SkXfermode::Mode mode) |
71 : fAA(aa) | 71 : fAA(aa) |
72 , fColorType(ct) | 72 , fColorType(ct) |
73 , fMode(mode) { | 73 , fMode(mode) { |
74 this->makeName(); | 74 this->makeName(); |
75 } | 75 } |
76 | 76 |
77 protected: | 77 protected: |
78 virtual const char* onGetName() SK_OVERRIDE { return fName.c_str(); } | 78 const char* onGetName() SK_OVERRIDE { return fName.c_str(); } |
79 | 79 |
80 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { | 80 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { |
81 SkPaint paint; | 81 SkPaint paint; |
82 paint.setAntiAlias(fAA); | 82 paint.setAntiAlias(fAA); |
83 paint.setXfermodeMode(fMode); | 83 paint.setXfermodeMode(fMode); |
84 SkColor color = start_color(fColorType); | 84 SkColor color = start_color(fColorType); |
85 | 85 |
86 int w = canvas->getBaseLayerSize().width(); | 86 int w = canvas->getBaseLayerSize().width(); |
87 int h = canvas->getBaseLayerSize().height(); | 87 int h = canvas->getBaseLayerSize().height(); |
88 | 88 |
89 static const SkScalar kRectW = 25.1f; | 89 static const SkScalar kRectW = 25.1f; |
90 static const SkScalar kRectH = 25.9f; | 90 static const SkScalar kRectH = 25.9f; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 DEF_BENCH(return new RotRectBench(true, kConstantTransparent_ColorType,
SkXfermode::kDarken_Mode);) | 185 DEF_BENCH(return new RotRectBench(true, kConstantTransparent_ColorType,
SkXfermode::kDarken_Mode);) |
186 DEF_BENCH(return new RotRectBench(true, kChangingOpaque_ColorType,
SkXfermode::kDarken_Mode);) | 186 DEF_BENCH(return new RotRectBench(true, kChangingOpaque_ColorType,
SkXfermode::kDarken_Mode);) |
187 DEF_BENCH(return new RotRectBench(true, kChangingTransparent_ColorType,
SkXfermode::kDarken_Mode);) | 187 DEF_BENCH(return new RotRectBench(true, kChangingTransparent_ColorType,
SkXfermode::kDarken_Mode);) |
188 DEF_BENCH(return new RotRectBench(true, kAlternatingOpaqueAndTransparent_ColorT
ype, SkXfermode::kDarken_Mode);) | 188 DEF_BENCH(return new RotRectBench(true, kAlternatingOpaqueAndTransparent_ColorT
ype, SkXfermode::kDarken_Mode);) |
189 | 189 |
190 DEF_BENCH(return new RotRectBench(false, kConstantOpaque_ColorType,
SkXfermode::kDarken_Mode);) | 190 DEF_BENCH(return new RotRectBench(false, kConstantOpaque_ColorType,
SkXfermode::kDarken_Mode);) |
191 DEF_BENCH(return new RotRectBench(false, kConstantTransparent_ColorType,
SkXfermode::kDarken_Mode);) | 191 DEF_BENCH(return new RotRectBench(false, kConstantTransparent_ColorType,
SkXfermode::kDarken_Mode);) |
192 DEF_BENCH(return new RotRectBench(false, kChangingOpaque_ColorType,
SkXfermode::kDarken_Mode);) | 192 DEF_BENCH(return new RotRectBench(false, kChangingOpaque_ColorType,
SkXfermode::kDarken_Mode);) |
193 DEF_BENCH(return new RotRectBench(false, kChangingTransparent_ColorType,
SkXfermode::kDarken_Mode);) | 193 DEF_BENCH(return new RotRectBench(false, kChangingTransparent_ColorType,
SkXfermode::kDarken_Mode);) |
194 DEF_BENCH(return new RotRectBench(false, kAlternatingOpaqueAndTransparent_ColorT
ype, SkXfermode::kDarken_Mode);) | 194 DEF_BENCH(return new RotRectBench(false, kAlternatingOpaqueAndTransparent_ColorT
ype, SkXfermode::kDarken_Mode);) |
OLD | NEW |