| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 static const int kWidth = 128; | 49 static const int kWidth = 128; |
| 50 static const int kHeight = 128; | 50 static const int kHeight = 128; |
| 51 public: | 51 public: |
| 52 BitmapRectBench(U8CPU alpha, SkPaint::FilterLevel filterLevel, | 52 BitmapRectBench(U8CPU alpha, SkPaint::FilterLevel filterLevel, |
| 53 bool slightMatrix) { | 53 bool slightMatrix) { |
| 54 fAlpha = SkToU8(alpha); | 54 fAlpha = SkToU8(alpha); |
| 55 fFilterLevel = filterLevel; | 55 fFilterLevel = filterLevel; |
| 56 fSlightMatrix = slightMatrix; | 56 fSlightMatrix = slightMatrix; |
| 57 | 57 |
| 58 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, kWidth, kHeight); | 58 fBitmap.setInfo(SkImageInfo::MakeN32Premul(kWidth, kHeight)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 62 virtual const char* onGetName() SK_OVERRIDE { | 62 virtual const char* onGetName() SK_OVERRIDE { |
| 63 fName.printf("bitmaprect_%02X_%sfilter_%s", | 63 fName.printf("bitmaprect_%02X_%sfilter_%s", |
| 64 fAlpha, | 64 fAlpha, |
| 65 SkPaint::kNone_FilterLevel == fFilterLevel ? "no" : "", | 65 SkPaint::kNone_FilterLevel == fFilterLevel ? "no" : "", |
| 66 fSlightMatrix ? "trans" : "identity"); | 66 fSlightMatrix ? "trans" : "identity"); |
| 67 return fName.c_str(); | 67 return fName.c_str(); |
| 68 } | 68 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 typedef SkBenchmark INHERITED; | 104 typedef SkBenchmark INHERITED; |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 DEF_BENCH(return new BitmapRectBench(0xFF, SkPaint::kNone_FilterLevel, false)) | 107 DEF_BENCH(return new BitmapRectBench(0xFF, SkPaint::kNone_FilterLevel, false)) |
| 108 DEF_BENCH(return new BitmapRectBench(0x80, SkPaint::kNone_FilterLevel, false)) | 108 DEF_BENCH(return new BitmapRectBench(0x80, SkPaint::kNone_FilterLevel, false)) |
| 109 DEF_BENCH(return new BitmapRectBench(0xFF, SkPaint::kLow_FilterLevel, false)) | 109 DEF_BENCH(return new BitmapRectBench(0xFF, SkPaint::kLow_FilterLevel, false)) |
| 110 DEF_BENCH(return new BitmapRectBench(0x80, SkPaint::kLow_FilterLevel, false)) | 110 DEF_BENCH(return new BitmapRectBench(0x80, SkPaint::kLow_FilterLevel, false)) |
| 111 | 111 |
| 112 DEF_BENCH(return new BitmapRectBench(0xFF, SkPaint::kNone_FilterLevel, true)) | 112 DEF_BENCH(return new BitmapRectBench(0xFF, SkPaint::kNone_FilterLevel, true)) |
| 113 DEF_BENCH(return new BitmapRectBench(0xFF, SkPaint::kLow_FilterLevel, true)) | 113 DEF_BENCH(return new BitmapRectBench(0xFF, SkPaint::kLow_FilterLevel, true)) |
| OLD | NEW |