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 "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 fBitmap.allocN32Pixels(W, H); | 59 fBitmap.allocN32Pixels(W, H); |
60 fBitmap.eraseColor(SK_ColorTRANSPARENT); | 60 fBitmap.eraseColor(SK_ColorTRANSPARENT); |
61 | 61 |
62 SkCanvas canvas(fBitmap); | 62 SkCanvas canvas(fBitmap); |
63 SkPaint paint; | 63 SkPaint paint; |
64 SkPoint pts[] = { {0, 0}, {SkIntToScalar(W), SkIntToScalar(H)} }; | 64 SkPoint pts[] = { {0, 0}, {SkIntToScalar(W), SkIntToScalar(H)} }; |
65 SkColor colors[] = { | 65 SkColor colors[] = { |
66 SK_ColorBLACK, SK_ColorGREEN, SK_ColorCYAN, | 66 SK_ColorBLACK, SK_ColorGREEN, SK_ColorCYAN, |
67 SK_ColorRED, 0, SK_ColorBLUE, SK_ColorWHITE | 67 SK_ColorRED, 0, SK_ColorBLUE, SK_ColorWHITE |
68 }; | 68 }; |
69 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateLinear( | 69 paint.setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, SK_AR
RAY_COUNT(colors), |
70 pts, colors, nullptr, SK_ARRAY_COUNT(colors), SkShader::kCla
mp_TileMode | 70 SkShader::kClamp_TileMode))
; |
71 )); | |
72 paint.setShader(shader); | |
73 canvas.drawPaint(paint); | 71 canvas.drawPaint(paint); |
74 } | 72 } |
75 }; | 73 }; |
76 | 74 |
77 class TableCollapseBench: public BaseImageFilterCollapseBench { | 75 class TableCollapseBench: public BaseImageFilterCollapseBench { |
78 public: | 76 public: |
79 virtual ~TableCollapseBench() {} | 77 virtual ~TableCollapseBench() {} |
80 | 78 |
81 protected: | 79 protected: |
82 virtual const char* onGetName() override { | 80 virtual const char* onGetName() override { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 doPreDraw(colorFilters, SK_ARRAY_COUNT(colorFilters)); | 147 doPreDraw(colorFilters, SK_ARRAY_COUNT(colorFilters)); |
150 | 148 |
151 for(unsigned i = 0; i < SK_ARRAY_COUNT(colorFilters); i++) { | 149 for(unsigned i = 0; i < SK_ARRAY_COUNT(colorFilters); i++) { |
152 colorFilters[i]->unref(); | 150 colorFilters[i]->unref(); |
153 } | 151 } |
154 } | 152 } |
155 }; | 153 }; |
156 | 154 |
157 DEF_BENCH(return new TableCollapseBench;) | 155 DEF_BENCH(return new TableCollapseBench;) |
158 DEF_BENCH(return new MatrixCollapseBench;) | 156 DEF_BENCH(return new MatrixCollapseBench;) |
OLD | NEW |