Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: bench/MergeBench.cpp

Issue 182983003: Factory methods for heap-allocated SkImageFilter objects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « bench/MatrixConvolutionBench.cpp ('k') | bench/MorphologyBench.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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); )
OLDNEW
« no previous file with comments | « bench/MatrixConvolutionBench.cpp ('k') | bench/MorphologyBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698