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

Unified Diff: tools/VisualBench/VisualBench.cpp

Issue 1336043003: Add viewer mode to VisualBench. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix init order Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/VisualBench/VisualBench.h ('k') | tools/VisualBench/VisualInteractiveModule.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/VisualBench/VisualBench.cpp
diff --git a/tools/VisualBench/VisualBench.cpp b/tools/VisualBench/VisualBench.cpp
index 3c4120469b758a91300cef74415e8309b0f3cb52..c4b7c2401383db5c21ccc4ff49b1f429633295fe 100644
--- a/tools/VisualBench/VisualBench.cpp
+++ b/tools/VisualBench/VisualBench.cpp
@@ -18,15 +18,21 @@
#include "SkStream.h"
#include "Stats.h"
#include "VisualLightweightBenchModule.h"
+#include "VisualInteractiveModule.h"
#include "gl/GrGLInterface.h"
DEFINE_bool2(fullscreen, f, true, "Run fullscreen.");
+DEFINE_bool2(interactive, n, false, "Run in interactive mode.");
VisualBench::VisualBench(void* hwnd, int argc, char** argv)
: INHERITED(hwnd)
, fModule(new VisualLightweightBenchModule(this)) {
SkCommandLineFlags::Parse(argc, argv);
+ if (FLAGS_interactive) {
+ fModule.reset(new VisualInteractiveModule(this));
+ }
+
this->setTitle();
this->setupBackend();
}
@@ -98,12 +104,27 @@ void VisualBench::draw(SkCanvas* canvas) {
this->inval(nullptr);
}
+void VisualBench::clear(SkCanvas* canvas, SkColor color, int frames) {
+ canvas->clear(color);
+ for (int i = 0; i < frames - 1; ++i) {
+ canvas->flush();
+ this->present();
+ canvas->clear(color);
+ }
+}
+
void VisualBench::onSizeChange() {
this->setupRenderTarget();
}
bool VisualBench::onHandleChar(SkUnichar unichar) {
- return true;
+ static const auto kEscKey = 27;
+ if (kEscKey == unichar) {
+ this->closeWindow();
+ return true;
+ }
+
+ return fModule->onHandleChar(unichar);
}
// Externally declared entry points
« no previous file with comments | « tools/VisualBench/VisualBench.h ('k') | tools/VisualBench/VisualInteractiveModule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698