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

Side by Side Diff: bench/AndroidCodecBench.cpp

Issue 2333713002: change SkStreams to work with sk_sp<SkData> instead of SkData* (Closed)
Patch Set: fix xpsdevice Created 4 years, 3 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 | « no previous file | bench/BitmapRegionDecoderBench.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 2016 Google Inc. 2 * Copyright 2016 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 "AndroidCodecBench.h" 8 #include "AndroidCodecBench.h"
9 #include "CodecBenchPriv.h" 9 #include "CodecBenchPriv.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 11 matching lines...) Expand all
22 22
23 const char* AndroidCodecBench::onGetName() { 23 const char* AndroidCodecBench::onGetName() {
24 return fName.c_str(); 24 return fName.c_str();
25 } 25 }
26 26
27 bool AndroidCodecBench::isSuitableFor(Backend backend) { 27 bool AndroidCodecBench::isSuitableFor(Backend backend) {
28 return kNonRendering_Backend == backend; 28 return kNonRendering_Backend == backend;
29 } 29 }
30 30
31 void AndroidCodecBench::onDelayedSetup() { 31 void AndroidCodecBench::onDelayedSetup() {
32 SkAutoTDelete<SkAndroidCodec> codec(SkAndroidCodec::NewFromData(fData.get()) ); 32 SkAutoTDelete<SkAndroidCodec> codec(SkAndroidCodec::NewFromData(fData));
33 SkISize scaledSize = codec->getSampledDimensions(fSampleSize); 33 SkISize scaledSize = codec->getSampledDimensions(fSampleSize);
34 34
35 fInfo = codec->getInfo().makeWH(scaledSize.width(), scaledSize.height()) 35 fInfo = codec->getInfo().makeWH(scaledSize.width(), scaledSize.height())
36 .makeColorType(kN32_SkColorType); 36 .makeColorType(kN32_SkColorType);
37 if (kUnpremul_SkAlphaType == fInfo.alphaType()) { 37 if (kUnpremul_SkAlphaType == fInfo.alphaType()) {
38 fInfo = fInfo.makeAlphaType(kPremul_SkAlphaType); 38 fInfo = fInfo.makeAlphaType(kPremul_SkAlphaType);
39 } 39 }
40 40
41 fPixelStorage.reset(fInfo.getSafeSize(fInfo.minRowBytes())); 41 fPixelStorage.reset(fInfo.getSafeSize(fInfo.minRowBytes()));
42 } 42 }
43 43
44 void AndroidCodecBench::onDraw(int n, SkCanvas* canvas) { 44 void AndroidCodecBench::onDraw(int n, SkCanvas* canvas) {
45 SkAutoTDelete<SkAndroidCodec> codec; 45 SkAutoTDelete<SkAndroidCodec> codec;
46 SkAndroidCodec::AndroidOptions options; 46 SkAndroidCodec::AndroidOptions options;
47 options.fSampleSize = fSampleSize; 47 options.fSampleSize = fSampleSize;
48 for (int i = 0; i < n; i++) { 48 for (int i = 0; i < n; i++) {
49 codec.reset(SkAndroidCodec::NewFromData(fData.get())); 49 codec.reset(SkAndroidCodec::NewFromData(fData));
50 #ifdef SK_DEBUG 50 #ifdef SK_DEBUG
51 const SkCodec::Result result = 51 const SkCodec::Result result =
52 #endif 52 #endif
53 codec->getAndroidPixels(fInfo, fPixelStorage.get(), fInfo.minRowBytes(), &options); 53 codec->getAndroidPixels(fInfo, fPixelStorage.get(), fInfo.minRowBytes(), &options);
54 SkASSERT(result == SkCodec::kSuccess || result == SkCodec::kIncompleteIn put); 54 SkASSERT(result == SkCodec::kSuccess || result == SkCodec::kIncompleteIn put);
55 } 55 }
56 } 56 }
OLDNEW
« no previous file with comments | « no previous file | bench/BitmapRegionDecoderBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698