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

Side by Side Diff: bench/DecodingBench.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.h ('k') | bench/DisplacementBench.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 2015 Google Inc. 2 * Copyright 2015 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 "CodecBenchPriv.h" 8 #include "CodecBenchPriv.h"
9 #include "DecodingBench.h" 9 #include "DecodingBench.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 26 matching lines...) Expand all
37 } 37 }
38 38
39 const char* DecodingBench::onGetName() { 39 const char* DecodingBench::onGetName() {
40 return fName.c_str(); 40 return fName.c_str();
41 } 41 }
42 42
43 bool DecodingBench::isSuitableFor(Backend backend) { 43 bool DecodingBench::isSuitableFor(Backend backend) {
44 return kNonRendering_Backend == backend; 44 return kNonRendering_Backend == backend;
45 } 45 }
46 46
47 void DecodingBench::onPreDraw() { 47 void DecodingBench::onDelayedSetup() {
48 // Allocate the pixels now, to remove it from the loop. 48 // Allocate the pixels now, to remove it from the loop.
49 SkAutoTDelete<SkStreamRewindable> stream(new SkMemoryStream(fData)); 49 SkAutoTDelete<SkStreamRewindable> stream(new SkMemoryStream(fData));
50 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream)); 50 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream));
51 SkBitmap bm; 51 SkBitmap bm;
52 #ifdef SK_DEBUG 52 #ifdef SK_DEBUG
53 SkImageDecoder::Result result = 53 SkImageDecoder::Result result =
54 #endif 54 #endif
55 decoder->decode(stream, &bm, fColorType, SkImageDecoder::kDecodeBounds_Mode) ; 55 decoder->decode(stream, &bm, fColorType, SkImageDecoder::kDecodeBounds_Mode) ;
56 SkASSERT(SkImageDecoder::kFailure != result); 56 SkASSERT(SkImageDecoder::kFailure != result);
57 57
(...skipping 30 matching lines...) Expand all
88 for (int i = 0; i < n; i++) { 88 for (int i = 0; i < n; i++) {
89 // create a new stream and a new decoder to mimic the behavior of 89 // create a new stream and a new decoder to mimic the behavior of
90 // CodecBench. 90 // CodecBench.
91 stream.reset(new SkMemoryStream(fData)); 91 stream.reset(new SkMemoryStream(fData));
92 decoder.reset(SkImageDecoder::Factory(stream)); 92 decoder.reset(SkImageDecoder::Factory(stream));
93 decoder->setAllocator(&allocator); 93 decoder->setAllocator(&allocator);
94 decoder->decode(stream, &bitmap, fColorType, 94 decoder->decode(stream, &bitmap, fColorType,
95 SkImageDecoder::kDecodePixels_Mode); 95 SkImageDecoder::kDecodePixels_Mode);
96 } 96 }
97 } 97 }
OLDNEW
« no previous file with comments | « bench/DecodingBench.h ('k') | bench/DisplacementBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698