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

Side by Side Diff: tools/VisualBench.cpp

Issue 1164403002: Visual bench on native android (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tiny cleanup Created 5 years, 6 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 | « src/views/SkWindow.cpp ('k') | no next file » | 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 8
9 #include "VisualBench.h" 9 #include "VisualBench.h"
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // load all SKPs 49 // load all SKPs
50 SkTArray<SkString> skps; 50 SkTArray<SkString> skps;
51 for (int i = 0; i < FLAGS_skps.count(); i++) { 51 for (int i = 0; i < FLAGS_skps.count(); i++) {
52 if (SkStrEndsWith(FLAGS_skps[i], ".skp")) { 52 if (SkStrEndsWith(FLAGS_skps[i], ".skp")) {
53 skps.push_back() = FLAGS_skps[i]; 53 skps.push_back() = FLAGS_skps[i];
54 fTimings.push_back().fName = FLAGS_skps[i]; 54 fTimings.push_back().fName = FLAGS_skps[i];
55 } else { 55 } else {
56 SkOSFile::Iter it(FLAGS_skps[i], ".skp"); 56 SkOSFile::Iter it(FLAGS_skps[i], ".skp");
57 SkString path; 57 SkString path;
58 while (it.next(&path)) { 58 while (it.next(&path)) {
59 skps.push_back() = SkOSPath::Join(FLAGS_skps[0], path.c_str()); 59 skps.push_back() = SkOSPath::Join(FLAGS_skps[i], path.c_str());
60 fTimings.push_back().fName = path.c_str(); 60 fTimings.push_back().fName = path.c_str();
61 } 61 }
62 } 62 }
63 } 63 }
64 64
65 for (int i = 0; i < skps.count(); i++) { 65 for (int i = 0; i < skps.count(); i++) {
66 SkFILEStream stream(skps[i].c_str()); 66 SkFILEStream stream(skps[i].c_str());
67 if (stream.isValid()) { 67 if (stream.isValid()) {
68 fPictures.push_back(SkPicture::CreateFromStream(&stream)); 68 fPictures.push_back(SkPicture::CreateFromStream(&stream));
69 } else { 69 } else {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 // setup contexts 120 // setup contexts
121 fContext.reset(GrContext::Create(kOpenGL_GrBackend, (GrBackendContext)fInter face.get())); 121 fContext.reset(GrContext::Create(kOpenGL_GrBackend, (GrBackendContext)fInter face.get()));
122 SkASSERT(fContext); 122 SkASSERT(fContext);
123 123
124 // setup rendertargets 124 // setup rendertargets
125 this->setupRenderTarget(); 125 this->setupRenderTarget();
126 } 126 }
127 127
128 void VisualBench::setupRenderTarget() { 128 void VisualBench::setupRenderTarget() {
129 fRenderTarget.reset(this->renderTarget(fAttachmentInfo, fInterface, fContext )); 129 if (fContext) {
130 fRenderTarget.reset(this->renderTarget(fAttachmentInfo, fInterface, fCon text));
131 }
130 } 132 }
131 133
132 inline void VisualBench::renderFrame(SkCanvas* canvas) { 134 inline void VisualBench::renderFrame(SkCanvas* canvas) {
133 canvas->drawPicture(fPictures[fCurrentPicture]); 135 canvas->drawPicture(fPictures[fCurrentPicture]);
134 fContext->flush(); 136 fContext->flush();
135 INHERITED::present(); 137 INHERITED::present();
136 } 138 }
137 139
138 void VisualBench::printStats() { 140 void VisualBench::printStats() {
139 const SkTArray<double>& measurements = fTimings[fCurrentPicture].fMeasuremen ts; 141 const SkTArray<double>& measurements = fTimings[fCurrentPicture].fMeasuremen ts;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 224
223 void application_term() { 225 void application_term() {
224 SkEvent::Term(); 226 SkEvent::Term();
225 SkGraphics::Term(); 227 SkGraphics::Term();
226 } 228 }
227 229
228 SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) { 230 SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) {
229 return new VisualBench(hwnd, argc, argv); 231 return new VisualBench(hwnd, argc, argv);
230 } 232 }
231 233
OLDNEW
« no previous file with comments | « src/views/SkWindow.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698