| 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 #include "Benchmark.h" | 7 #include "Benchmark.h" |
| 8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkColorCubeFilter.h" | 9 #include "SkColorCubeFilter.h" |
| 10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 for (int g = 0; g < fCubeDimension; ++g) { | 87 for (int g = 0; g < fCubeDimension; ++g) { |
| 88 for (int b = 0; b < fCubeDimension; ++b) { | 88 for (int b = 0; b < fCubeDimension; ++b) { |
| 89 pixels[(fCubeDimension * ((fCubeDimension * b) + g)) + r] = | 89 pixels[(fCubeDimension * ((fCubeDimension * b) + g)) + r] = |
| 90 SkColorSetARGB(0xFF, lut[r], lut[g], lut[b]); | 90 SkColorSetARGB(0xFF, lut[r], lut[g], lut[b]); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 void test(const int loops, SkCanvas* canvas) { | 96 void test(const int loops, SkCanvas* canvas) { |
| 97 SkAutoTUnref<SkColorFilter> colorCube( | |
| 98 SkColorCubeFilter::Create(fCubeData, fCubeDimension)); | |
| 99 SkPaint paint; | 97 SkPaint paint; |
| 100 paint.setColorFilter(colorCube); | |
| 101 | |
| 102 for (int i = 0; i < loops; i++) { | 98 for (int i = 0; i < loops; i++) { |
| 99 SkAutoTUnref<SkColorFilter> colorCube( |
| 100 SkColorCubeFilter::Create(fCubeData, fCubeDimension)); |
| 101 paint.setColorFilter(colorCube); |
| 103 canvas->drawBitmap(fBitmap, 0, 0, &paint); | 102 canvas->drawBitmap(fBitmap, 0, 0, &paint); |
| 104 } | 103 } |
| 105 } | 104 } |
| 106 | 105 |
| 107 typedef Benchmark INHERITED; | 106 typedef Benchmark INHERITED; |
| 108 }; | 107 }; |
| 109 | 108 |
| 110 /////////////////////////////////////////////////////////////////////////////// | 109 /////////////////////////////////////////////////////////////////////////////// |
| 111 | 110 |
| 112 DEF_BENCH( return new ColorCubeBench(); ) | 111 DEF_BENCH( return new ColorCubeBench(); ) |
| OLD | NEW |