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

Side by Side Diff: bench/DisplacementBench.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/DecodingBench.cpp ('k') | bench/DrawBitmapAABench.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 "SkDisplacementMapEffect.h" 10 #include "SkDisplacementMapEffect.h"
11 #include "SkImageSource.h" 11 #include "SkImageSource.h"
12 #include "SkSurface.h" 12 #include "SkSurface.h"
13 13
14 #define FILTER_WIDTH_SMALL 32 14 #define FILTER_WIDTH_SMALL 32
15 #define FILTER_HEIGHT_SMALL 32 15 #define FILTER_HEIGHT_SMALL 32
16 #define FILTER_WIDTH_LARGE 256 16 #define FILTER_WIDTH_LARGE 256
17 #define FILTER_HEIGHT_LARGE 256 17 #define FILTER_HEIGHT_LARGE 256
18 18
19 class DisplacementBaseBench : public Benchmark { 19 class DisplacementBaseBench : public Benchmark {
20 public: 20 public:
21 DisplacementBaseBench(bool small) : 21 DisplacementBaseBench(bool small) :
22 fInitialized(false), fIsSmall(small) { 22 fInitialized(false), fIsSmall(small) {
23 } 23 }
24 24
25 protected: 25 protected:
26 void onPreDraw() override { 26 void onDelayedSetup() override {
27 if (!fInitialized) { 27 if (!fInitialized) {
28 this->makeBitmap(); 28 this->makeBitmap();
29 this->makeCheckerboard(); 29 this->makeCheckerboard();
30 fInitialized = true; 30 fInitialized = true;
31 } 31 }
32 } 32 }
33 33
34 void makeBitmap() { 34 void makeBitmap() {
35 const int w = this->isSmall() ? FILTER_WIDTH_SMALL : FILTER_WIDTH_LARGE; 35 const int w = this->isSmall() ? FILTER_WIDTH_SMALL : FILTER_WIDTH_LARGE;
36 const int h = this->isSmall() ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARG E; 36 const int h = this->isSmall() ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARG E;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 }; 170 };
171 171
172 /////////////////////////////////////////////////////////////////////////////// 172 ///////////////////////////////////////////////////////////////////////////////
173 173
174 DEF_BENCH( return new DisplacementZeroBench(true); ) 174 DEF_BENCH( return new DisplacementZeroBench(true); )
175 DEF_BENCH( return new DisplacementAlphaBench(true); ) 175 DEF_BENCH( return new DisplacementAlphaBench(true); )
176 DEF_BENCH( return new DisplacementFullBench(true); ) 176 DEF_BENCH( return new DisplacementFullBench(true); )
177 DEF_BENCH( return new DisplacementZeroBench(false); ) 177 DEF_BENCH( return new DisplacementZeroBench(false); )
178 DEF_BENCH( return new DisplacementAlphaBench(false); ) 178 DEF_BENCH( return new DisplacementAlphaBench(false); )
179 DEF_BENCH( return new DisplacementFullBench(false); ) 179 DEF_BENCH( return new DisplacementFullBench(false); )
OLDNEW
« no previous file with comments | « bench/DecodingBench.cpp ('k') | bench/DrawBitmapAABench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698