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 #include "SkBenchmark.h" | 7 #include "SkBenchmark.h" |
8 #include "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
9 #include "SkBitmapSource.h" | 9 #include "SkBitmapSource.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 SkRect::MakeWH(FILTER_WIDTH_LARGE, FILTER_HEIGHT_L
ARGE); | 37 SkRect::MakeWH(FILTER_WIDTH_LARGE, FILTER_HEIGHT_L
ARGE); |
38 SkPaint paint; | 38 SkPaint paint; |
39 paint.setImageFilter(mergeBitmaps())->unref(); | 39 paint.setImageFilter(mergeBitmaps())->unref(); |
40 for (int i = 0; i < loops; i++) { | 40 for (int i = 0; i < loops; i++) { |
41 canvas->drawRect(r, paint); | 41 canvas->drawRect(r, paint); |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
45 private: | 45 private: |
46 SkImageFilter* mergeBitmaps() { | 46 SkImageFilter* mergeBitmaps() { |
47 SkImageFilter* first = new SkBitmapSource(fCheckerboard); | 47 SkImageFilter* first = SkBitmapSource::Create(fCheckerboard); |
48 SkImageFilter* second = new SkBitmapSource(fBitmap); | 48 SkImageFilter* second = SkBitmapSource::Create(fBitmap); |
49 SkAutoUnref aur0(first); | 49 SkAutoUnref aur0(first); |
50 SkAutoUnref aur1(second); | 50 SkAutoUnref aur1(second); |
51 return new SkMergeImageFilter(first, second); | 51 return SkMergeImageFilter::Create(first, second); |
52 } | 52 } |
53 | 53 |
54 void make_bitmap() { | 54 void make_bitmap() { |
55 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 80, 80); | 55 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 80, 80); |
56 fBitmap.allocPixels(); | 56 fBitmap.allocPixels(); |
57 SkBitmapDevice device(fBitmap); | 57 SkBitmapDevice device(fBitmap); |
58 SkCanvas canvas(&device); | 58 SkCanvas canvas(&device); |
59 canvas.clear(0x00000000); | 59 canvas.clear(0x00000000); |
60 SkPaint paint; | 60 SkPaint paint; |
61 paint.setAntiAlias(true); | 61 paint.setAntiAlias(true); |
(...skipping 30 matching lines...) Expand all Loading... |
92 bool fInitialized; | 92 bool fInitialized; |
93 SkBitmap fBitmap, fCheckerboard; | 93 SkBitmap fBitmap, fCheckerboard; |
94 | 94 |
95 typedef SkBenchmark INHERITED; | 95 typedef SkBenchmark INHERITED; |
96 }; | 96 }; |
97 | 97 |
98 /////////////////////////////////////////////////////////////////////////////// | 98 /////////////////////////////////////////////////////////////////////////////// |
99 | 99 |
100 DEF_BENCH( return new MergeBench(true); ) | 100 DEF_BENCH( return new MergeBench(true); ) |
101 DEF_BENCH( return new MergeBench(false); ) | 101 DEF_BENCH( return new MergeBench(false); ) |
OLD | NEW |