OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkDisplacementMapEffect.h" | 10 #include "SkDisplacementMapEffect.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 paint.setAntiAlias(true); | 41 paint.setAntiAlias(true); |
42 paint.setColor(0xFF884422); | 42 paint.setColor(0xFF884422); |
43 paint.setTextSize(SkIntToScalar(96)); | 43 paint.setTextSize(SkIntToScalar(96)); |
44 const char* str = "g"; | 44 const char* str = "g"; |
45 canvas.drawText(str, strlen(str), SkIntToScalar(15), SkIntToScalar(55),
paint); | 45 canvas.drawText(str, strlen(str), SkIntToScalar(15), SkIntToScalar(55),
paint); |
46 } | 46 } |
47 | 47 |
48 void makeCheckerboard() { | 48 void makeCheckerboard() { |
49 const int w = this->isSmall() ? FILTER_WIDTH_SMALL : FILTER_WIDTH_LARGE; | 49 const int w = this->isSmall() ? FILTER_WIDTH_SMALL : FILTER_WIDTH_LARGE; |
50 const int h = this->isSmall() ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARG
E; | 50 const int h = this->isSmall() ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARG
E; |
51 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(w, h)); | 51 auto surface(SkSurface::MakeRasterN32Premul(w, h)); |
52 SkCanvas* canvas = surface->getCanvas(); | 52 SkCanvas* canvas = surface->getCanvas(); |
53 canvas->clear(0x00000000); | 53 canvas->clear(0x00000000); |
54 SkPaint darkPaint; | 54 SkPaint darkPaint; |
55 darkPaint.setColor(0xFF804020); | 55 darkPaint.setColor(0xFF804020); |
56 SkPaint lightPaint; | 56 SkPaint lightPaint; |
57 lightPaint.setColor(0xFF244484); | 57 lightPaint.setColor(0xFF244484); |
58 for (int y = 0; y < h; y += 16) { | 58 for (int y = 0; y < h; y += 16) { |
59 for (int x = 0; x < w; x += 16) { | 59 for (int x = 0; x < w; x += 16) { |
60 canvas->save(); | 60 canvas->save(); |
61 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); | 61 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 }; | 170 }; |
171 | 171 |
172 /////////////////////////////////////////////////////////////////////////////// | 172 /////////////////////////////////////////////////////////////////////////////// |
173 | 173 |
174 DEF_BENCH( return new DisplacementZeroBench(true); ) | 174 DEF_BENCH( return new DisplacementZeroBench(true); ) |
175 DEF_BENCH( return new DisplacementAlphaBench(true); ) | 175 DEF_BENCH( return new DisplacementAlphaBench(true); ) |
176 DEF_BENCH( return new DisplacementFullBench(true); ) | 176 DEF_BENCH( return new DisplacementFullBench(true); ) |
177 DEF_BENCH( return new DisplacementZeroBench(false); ) | 177 DEF_BENCH( return new DisplacementZeroBench(false); ) |
178 DEF_BENCH( return new DisplacementAlphaBench(false); ) | 178 DEF_BENCH( return new DisplacementAlphaBench(false); ) |
179 DEF_BENCH( return new DisplacementFullBench(false); ) | 179 DEF_BENCH( return new DisplacementFullBench(false); ) |
OLD | NEW |