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

Side by Side Diff: bench/PremulAndUnpremulAlphaOpsBench.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/PicturePlaybackBench.cpp ('k') | bench/RTreeBench.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 "SkConfig8888.h" 10 #include "SkConfig8888.h"
(...skipping 11 matching lines...) Expand all
22 PremulAndUnpremulAlphaOpsBench(SkColorType ct) { 22 PremulAndUnpremulAlphaOpsBench(SkColorType ct) {
23 fColorType = ct; 23 fColorType = ct;
24 fName.printf("premul_and_unpremul_alpha_%s", sk_tool_utils::colortype_na me(ct)); 24 fName.printf("premul_and_unpremul_alpha_%s", sk_tool_utils::colortype_na me(ct));
25 } 25 }
26 26
27 protected: 27 protected:
28 const char* onGetName() override { 28 const char* onGetName() override {
29 return fName.c_str(); 29 return fName.c_str();
30 } 30 }
31 31
32 void onPreDraw() override { 32 void onDelayedSetup() override {
33 SkImageInfo info = SkImageInfo::Make(W, H, fColorType, kUnpremul_SkAlpha Type); 33 SkImageInfo info = SkImageInfo::Make(W, H, fColorType, kUnpremul_SkAlpha Type);
34 fBmp1.allocPixels(info); // used in writePixels 34 fBmp1.allocPixels(info); // used in writePixels
35 35
36 for (int h = 0; h < H; ++h) { 36 for (int h = 0; h < H; ++h) {
37 for (int w = 0; w < W; ++w) { 37 for (int w = 0; w < W; ++w) {
38 // SkColor places A in the right slot for either RGBA or BGRA 38 // SkColor places A in the right slot for either RGBA or BGRA
39 *fBmp1.getAddr32(w, h) = SkColorSetARGB(h & 0xFF, w & 0xFF, w & 0xFF, w & 0xFF); 39 *fBmp1.getAddr32(w, h) = SkColorSetARGB(h & 0xFF, w & 0xFF, w & 0xFF, w & 0xFF);
40 } 40 }
41 } 41 }
42 42
(...skipping 14 matching lines...) Expand all
57 private: 57 private:
58 SkColorType fColorType; 58 SkColorType fColorType;
59 SkString fName; 59 SkString fName;
60 60
61 typedef Benchmark INHERITED; 61 typedef Benchmark INHERITED;
62 }; 62 };
63 63
64 64
65 DEF_BENCH(return new PremulAndUnpremulAlphaOpsBench(kRGBA_8888_SkColorType)); 65 DEF_BENCH(return new PremulAndUnpremulAlphaOpsBench(kRGBA_8888_SkColorType));
66 DEF_BENCH(return new PremulAndUnpremulAlphaOpsBench(kBGRA_8888_SkColorType)); 66 DEF_BENCH(return new PremulAndUnpremulAlphaOpsBench(kBGRA_8888_SkColorType));
OLDNEW
« no previous file with comments | « bench/PicturePlaybackBench.cpp ('k') | bench/RTreeBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698