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

Side by Side Diff: bench/MergeBench.cpp

Issue 1379853003: Fix for nexus 5 crashing in GL benches (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 2 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/MatrixBench.cpp ('k') | bench/MipMapBench.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 7
8 #include "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkImageSource.h" 10 #include "SkImageSource.h"
11 #include "SkMergeImageFilter.h" 11 #include "SkMergeImageFilter.h"
12 #include "SkSurface.h" 12 #include "SkSurface.h"
13 13
14 #define FILTER_WIDTH_SMALL SkIntToScalar(32) 14 #define FILTER_WIDTH_SMALL SkIntToScalar(32)
15 #define FILTER_HEIGHT_SMALL SkIntToScalar(32) 15 #define FILTER_HEIGHT_SMALL SkIntToScalar(32)
16 #define FILTER_WIDTH_LARGE SkIntToScalar(256) 16 #define FILTER_WIDTH_LARGE SkIntToScalar(256)
17 #define FILTER_HEIGHT_LARGE SkIntToScalar(256) 17 #define FILTER_HEIGHT_LARGE SkIntToScalar(256)
18 18
19 class MergeBench : public Benchmark { 19 class MergeBench : public Benchmark {
20 public: 20 public:
21 MergeBench(bool small) : fIsSmall(small), fInitialized(false) { } 21 MergeBench(bool small) : fIsSmall(small), fInitialized(false) { }
22 22
23 protected: 23 protected:
24 const char* onGetName() override { 24 const char* onGetName() override {
25 return fIsSmall ? "merge_small" : "merge_large"; 25 return fIsSmall ? "merge_small" : "merge_large";
26 } 26 }
27 27
28 void onPreDraw() override { 28 void onDelayedSetup() override {
29 if (!fInitialized) { 29 if (!fInitialized) {
30 make_bitmap(); 30 make_bitmap();
31 make_checkerboard(); 31 make_checkerboard();
32 fInitialized = true; 32 fInitialized = true;
33 } 33 }
34 } 34 }
35 35
36 void onDraw(const int loops, SkCanvas* canvas) override { 36 void onDraw(const int loops, SkCanvas* canvas) override {
37 SkRect r = fIsSmall ? SkRect::MakeWH(FILTER_WIDTH_SMALL, FILTER_HEIGHT_S MALL) : 37 SkRect r = fIsSmall ? SkRect::MakeWH(FILTER_WIDTH_SMALL, FILTER_HEIGHT_S MALL) :
38 SkRect::MakeWH(FILTER_WIDTH_LARGE, FILTER_HEIGHT_L ARGE); 38 SkRect::MakeWH(FILTER_WIDTH_LARGE, FILTER_HEIGHT_L ARGE);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 bool fInitialized; 89 bool fInitialized;
90 SkAutoTUnref<SkImage> fImage, fCheckerboard; 90 SkAutoTUnref<SkImage> fImage, fCheckerboard;
91 91
92 typedef Benchmark INHERITED; 92 typedef Benchmark INHERITED;
93 }; 93 };
94 94
95 /////////////////////////////////////////////////////////////////////////////// 95 ///////////////////////////////////////////////////////////////////////////////
96 96
97 DEF_BENCH( return new MergeBench(true); ) 97 DEF_BENCH( return new MergeBench(true); )
98 DEF_BENCH( return new MergeBench(false); ) 98 DEF_BENCH( return new MergeBench(false); )
OLDNEW
« no previous file with comments | « bench/MatrixBench.cpp ('k') | bench/MipMapBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698