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

Side by Side Diff: bench/SKDBench.cpp

Issue 918673002: Adding new benchmark to test image decoding performance. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SKDBench.h"
9 #include "SkImageDecoder.h"
10
11 /*
12 *
13 * This benchmark is designed to test the performance of image decoding.
14 * It is invoked from the nanobench.cpp file.
15 *
16 */
17 SKDBench::SKDBench(const char* name, SkString path, SkColorType colorType)
18 : fPath(path)
19 , fColorType(colorType) {
scroggo 2015/02/11 19:38:10 I don't think we've made it official, but we've be
msarett 2015/02/11 21:57:00 Done.
20 fName.printf("%s_%s_%u", name, path.c_str(), colorType);
scroggo 2015/02/11 19:38:10 We use indents of 4 spaces. It looks like for dec
msarett 2015/02/11 21:57:00 Done.
21 }
22
23 const char* SKDBench::onGetName() {
24 return fName.c_str();
25 }
26
27 bool SKDBench::isSuitableFor(Backend backend) {
28 return backend == kNonRendering_Backend;
mtklein 2015/02/11 19:15:36 Seems like we might want to say this is suitable f
scroggo 2015/02/11 19:38:10 That's what I did in DM, but I realized that I wan
scroggo 2015/02/11 19:38:10 Constants should go on the left side of == (see ht
msarett 2015/02/11 21:57:00 As discussed, we are not making this edit in order
msarett 2015/02/11 21:57:00 Done.
msarett 2015/02/11 21:57:01 Done.
29 }
30
31 void SKDBench::onDraw(const int n, SkCanvas* canvas) {
32 // Decode each image file n times
33 for (int i = 0; i < n; i++) {
34 SkBitmap bitmap;
35 SkImageDecoder::DecodeFile(fPath.c_str(), &bitmap, fColorType,
36 SkImageDecoder::kDecodePixels_Mode);
37 }
38 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698