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 "SkBenchmark.h" | 8 #include "SkBenchmark.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 SkIPoint onGetSize() SK_OVERRIDE { | 51 SkIPoint onGetSize() SK_OVERRIDE { |
52 return SkIPoint::Make( fOutputSize, fOutputSize ); | 52 return SkIPoint::Make( fOutputSize, fOutputSize ); |
53 } | 53 } |
54 | 54 |
55 void setName(const char * name) { | 55 void setName(const char * name) { |
56 fName.printf( "bitmap_scale_%s_%d_%d", name, fInputSize, fOutputSize ); | 56 fName.printf( "bitmap_scale_%s_%d_%d", name, fInputSize, fOutputSize ); |
57 } | 57 } |
58 | 58 |
59 virtual void onPreDraw() { | 59 virtual void onPreDraw() { |
60 fInputBitmap.setConfig(SkBitmap::kARGB_8888_Config, fInputSize, fInputSi
ze); | 60 fInputBitmap.setConfig(SkBitmap::kARGB_8888_Config, |
| 61 fInputSize, fInputSize, 0, kOpaque_SkAlphaType); |
61 fInputBitmap.allocPixels(); | 62 fInputBitmap.allocPixels(); |
62 fInputBitmap.eraseColor(SK_ColorWHITE); | 63 fInputBitmap.eraseColor(SK_ColorWHITE); |
63 fInputBitmap.setIsOpaque(true); | |
64 | 64 |
65 fOutputBitmap.setConfig(SkBitmap::kARGB_8888_Config, fOutputSize, fOutpu
tSize); | 65 fOutputBitmap.setConfig(SkBitmap::kARGB_8888_Config, |
| 66 fOutputSize, fOutputSize, 0, kOpaque_SkAlphaType
); |
66 fOutputBitmap.allocPixels(); | 67 fOutputBitmap.allocPixels(); |
67 fOutputBitmap.setIsOpaque(true); | |
68 | 68 |
69 fMatrix.setScale( scale(), scale() ); | 69 fMatrix.setScale( scale(), scale() ); |
70 } | 70 } |
71 | 71 |
72 virtual void onDraw(SkCanvas*) { | 72 virtual void onDraw(SkCanvas*) { |
73 SkPaint paint; | 73 SkPaint paint; |
74 this->setupPaint(&paint); | 74 this->setupPaint(&paint); |
75 | 75 |
76 preBenchSetup(); | 76 preBenchSetup(); |
77 | 77 |
(...skipping 27 matching lines...) Expand all Loading... |
105 | 105 |
106 DEF_BENCH(return new BitmapFilterScaleBench(10, 90);) | 106 DEF_BENCH(return new BitmapFilterScaleBench(10, 90);) |
107 DEF_BENCH(return new BitmapFilterScaleBench(30, 90);) | 107 DEF_BENCH(return new BitmapFilterScaleBench(30, 90);) |
108 DEF_BENCH(return new BitmapFilterScaleBench(80, 90);) | 108 DEF_BENCH(return new BitmapFilterScaleBench(80, 90);) |
109 DEF_BENCH(return new BitmapFilterScaleBench(90, 90);) | 109 DEF_BENCH(return new BitmapFilterScaleBench(90, 90);) |
110 DEF_BENCH(return new BitmapFilterScaleBench(90, 80);) | 110 DEF_BENCH(return new BitmapFilterScaleBench(90, 80);) |
111 DEF_BENCH(return new BitmapFilterScaleBench(90, 30);) | 111 DEF_BENCH(return new BitmapFilterScaleBench(90, 30);) |
112 DEF_BENCH(return new BitmapFilterScaleBench(90, 10);) | 112 DEF_BENCH(return new BitmapFilterScaleBench(90, 10);) |
113 DEF_BENCH(return new BitmapFilterScaleBench(256, 64);) | 113 DEF_BENCH(return new BitmapFilterScaleBench(256, 64);) |
114 DEF_BENCH(return new BitmapFilterScaleBench(64, 256);) | 114 DEF_BENCH(return new BitmapFilterScaleBench(64, 256);) |
OLD | NEW |