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

Unified Diff: samplecode/SampleApp.cpp

Issue 1272063002: allow for stepping through a picture with 'n' and 'p' (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 | « samplecode/SampleApp.h ('k') | samplecode/SamplePictFile.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleApp.cpp
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 318a8224c0adeb075e55379953abd1666ce2b034..2d12bfd67293bbaccc9107befbdb11d3ad6e317a 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -823,9 +823,7 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
fMagnify = false;
fSaveToPdf = false;
-
- fTransitionNext = 6;
- fTransitionPrev = 2;
+ fSaveToSKP = false;
int sinkID = this->getSinkID();
fAppMenu = new SkOSMenu;
@@ -888,16 +886,7 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
fAppMenu->assignKeyEquivalentToItem(itemID, 'z');
itemID = fAppMenu->appendSwitch("Magnify", "Magnify" , sinkID, fMagnify);
fAppMenu->assignKeyEquivalentToItem(itemID, 'm');
- itemID =fAppMenu->appendList("Transition-Next", "Transition-Next", sinkID,
- fTransitionNext, "Up", "Up and Right", "Right",
- "Down and Right", "Down", "Down and Left",
- "Left", "Up and Left", NULL);
- fAppMenu->assignKeyEquivalentToItem(itemID, 'j');
- itemID =fAppMenu->appendList("Transition-Prev", "Transition-Prev", sinkID,
- fTransitionPrev, "Up", "Up and Right", "Right",
- "Down and Right", "Down", "Down and Left",
- "Left", "Up and Left", NULL);
- fAppMenu->assignKeyEquivalentToItem(itemID, 'k');
+
itemID = fAppMenu->appendAction("Save to PDF", sinkID);
fAppMenu->assignKeyEquivalentToItem(itemID, 'e');
@@ -1259,6 +1248,12 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
if (kPicture_DeviceType == fDeviceType) {
SkAutoTUnref<const SkPicture> picture(fRecorder.endRecording());
+ if (fSaveToSKP) {
+ SkFILEWStream stream("sample_app.skp");
+ picture->serialize(&stream);
+ fSaveToSKP = false;
+ }
+
if (true) {
if (true) {
SkImageInfo info;
@@ -1496,9 +1491,8 @@ bool SampleWindow::onEvent(const SkEvent& evt) {
SkOSMenu::FindListIndex(evt, "Hinting", &fHintingState) ||
SkOSMenu::FindSwitchState(evt, "Clip", &fUseClip) ||
SkOSMenu::FindSwitchState(evt, "Zoomer", &fShowZoomer) ||
- SkOSMenu::FindSwitchState(evt, "Magnify", &fMagnify) ||
- SkOSMenu::FindListIndex(evt, "Transition-Next", &fTransitionNext) ||
- SkOSMenu::FindListIndex(evt, "Transition-Prev", &fTransitionPrev)) {
+ SkOSMenu::FindSwitchState(evt, "Magnify", &fMagnify))
+ {
this->inval(NULL);
this->updateTitle();
return true;
@@ -1653,6 +1647,10 @@ bool SampleWindow::onHandleChar(SkUnichar uni) {
this->inval(NULL);
this->updateTitle();
return true;
+ case 'K':
+ fSaveToSKP = true;
+ this->inval(NULL);
+ return true;
#if SK_SUPPORT_GPU
case 'p':
{
« no previous file with comments | « samplecode/SampleApp.h ('k') | samplecode/SamplePictFile.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698