| 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 "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 fDstR.offset(SK_Scalar1 / 3, SK_Scalar1 * 5 / 7); | 79 fDstR.offset(SK_Scalar1 / 3, SK_Scalar1 * 5 / 7); |
| 80 // want enough to create a scale matrix, but not enough to scare | 80 // want enough to create a scale matrix, but not enough to scare |
| 81 // off our sniffer which tries to see if the matrix is "effectively" | 81 // off our sniffer which tries to see if the matrix is "effectively" |
| 82 // translate-only. | 82 // translate-only. |
| 83 fDstR.fRight += SK_Scalar1 / (kWidth * 60); | 83 fDstR.fRight += SK_Scalar1 / (kWidth * 60); |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 | 86 |
| 87 | 87 |
| 88 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 88 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 89 SkMWCRandom rand; | 89 SkRandom rand; |
| 90 | 90 |
| 91 SkPaint paint; | 91 SkPaint paint; |
| 92 this->setupPaint(&paint); | 92 this->setupPaint(&paint); |
| 93 paint.setFilterBitmap(fDoFilter); | 93 paint.setFilterBitmap(fDoFilter); |
| 94 paint.setAlpha(fAlpha); | 94 paint.setAlpha(fAlpha); |
| 95 | 95 |
| 96 for (int i = 0; i < N; i++) { | 96 for (int i = 0; i < N; i++) { |
| 97 canvas->drawBitmapRectToRect(fBitmap, &fSrcR, fDstR, &paint); | 97 canvas->drawBitmapRectToRect(fBitmap, &fSrcR, fDstR, &paint); |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 private: | 101 private: |
| 102 typedef SkBenchmark INHERITED; | 102 typedef SkBenchmark INHERITED; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 DEF_BENCH(return new BitmapRectBench(p, 0xFF, false, false)) | 105 DEF_BENCH(return new BitmapRectBench(p, 0xFF, false, false)) |
| 106 DEF_BENCH(return new BitmapRectBench(p, 0x80, false, false)) | 106 DEF_BENCH(return new BitmapRectBench(p, 0x80, false, false)) |
| 107 DEF_BENCH(return new BitmapRectBench(p, 0xFF, true, false)) | 107 DEF_BENCH(return new BitmapRectBench(p, 0xFF, true, false)) |
| 108 DEF_BENCH(return new BitmapRectBench(p, 0x80, true, false)) | 108 DEF_BENCH(return new BitmapRectBench(p, 0x80, true, false)) |
| 109 | 109 |
| 110 DEF_BENCH(return new BitmapRectBench(p, 0xFF, false, true)) | 110 DEF_BENCH(return new BitmapRectBench(p, 0xFF, false, true)) |
| 111 DEF_BENCH(return new BitmapRectBench(p, 0xFF, true, true)) | 111 DEF_BENCH(return new BitmapRectBench(p, 0xFF, true, true)) |
| OLD | NEW |