| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 protected: | 59 protected: |
| 60 virtual const char* onGetName() SK_OVERRIDE { | 60 virtual const char* onGetName() SK_OVERRIDE { |
| 61 fName.printf("bitmaprect_%02X_%sfilter_%s", | 61 fName.printf("bitmaprect_%02X_%sfilter_%s", |
| 62 fAlpha, fDoFilter ? "" : "no", | 62 fAlpha, fDoFilter ? "" : "no", |
| 63 fSlightMatrix ? "trans" : "identity"); | 63 fSlightMatrix ? "trans" : "identity"); |
| 64 return fName.c_str(); | 64 return fName.c_str(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual void onPreDraw() SK_OVERRIDE { | 67 virtual void onPreDraw() SK_OVERRIDE { |
| 68 fBitmap.allocPixels(); | 68 fBitmap.allocPixels(); |
| 69 fBitmap.setIsOpaque(true); | 69 fBitmap.setAlphaType(kOpaque_SkAlphaType); |
| 70 fBitmap.eraseColor(SK_ColorBLACK); | 70 fBitmap.eraseColor(SK_ColorBLACK); |
| 71 draw_into_bitmap(fBitmap); | 71 draw_into_bitmap(fBitmap); |
| 72 | 72 |
| 73 fSrcR.iset(0, 0, kWidth, kHeight); | 73 fSrcR.iset(0, 0, kWidth, kHeight); |
| 74 fDstR.iset(0, 0, kWidth, kHeight); | 74 fDstR.iset(0, 0, kWidth, kHeight); |
| 75 | 75 |
| 76 if (fSlightMatrix) { | 76 if (fSlightMatrix) { |
| 77 // want fractional translate | 77 // want fractional translate |
| 78 fDstR.offset(SK_Scalar1 / 3, SK_Scalar1 * 5 / 7); | 78 fDstR.offset(SK_Scalar1 / 3, SK_Scalar1 * 5 / 7); |
| 79 // want enough to create a scale matrix, but not enough to scare | 79 // want enough to create a scale matrix, but not enough to scare |
| (...skipping 21 matching lines...) Expand all Loading... |
| 101 typedef SkBenchmark INHERITED; | 101 typedef SkBenchmark INHERITED; |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 DEF_BENCH(return new BitmapRectBench(0xFF, false, false)) | 104 DEF_BENCH(return new BitmapRectBench(0xFF, false, false)) |
| 105 DEF_BENCH(return new BitmapRectBench(0x80, false, false)) | 105 DEF_BENCH(return new BitmapRectBench(0x80, false, false)) |
| 106 DEF_BENCH(return new BitmapRectBench(0xFF, true, false)) | 106 DEF_BENCH(return new BitmapRectBench(0xFF, true, false)) |
| 107 DEF_BENCH(return new BitmapRectBench(0x80, true, false)) | 107 DEF_BENCH(return new BitmapRectBench(0x80, true, false)) |
| 108 | 108 |
| 109 DEF_BENCH(return new BitmapRectBench(0xFF, false, true)) | 109 DEF_BENCH(return new BitmapRectBench(0xFF, false, true)) |
| 110 DEF_BENCH(return new BitmapRectBench(0xFF, true, true)) | 110 DEF_BENCH(return new BitmapRectBench(0xFF, true, true)) |
| OLD | NEW |