skia2/tools/viewer/GMSlide.cpp
Jim Van Verth 6f449692c1 Add more SampleApp support to viewer.
Fixes loading a Sample as first slide.
Adds char input.
Adds --slide and --list options.

Change-Id: I34b66818e3673fcfdc649443e7d9dfb74b478062
Reviewed-on: https://skia-review.googlesource.com/8445
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2017-02-14 21:25:01 +00:00

37 lines
850 B
C++

/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "GMSlide.h"
#include "SkCanvas.h"
GMSlide::GMSlide(skiagm::GM* gm) : fGM(gm) {
fName.printf("GM_%s", gm->getName());
}
GMSlide::~GMSlide() { delete fGM; }
void GMSlide::draw(SkCanvas* canvas) {
// Do we care about timing the draw of the background (once)?
// Does the GM ever rely on drawBackground to lazily compute something?
fGM->drawBackground(canvas);
fGM->drawContent(canvas);
}
bool GMSlide::animate(const SkAnimTimer& timer) {
return fGM->animate(timer);
}
bool GMSlide::onChar(SkUnichar c) {
return fGM->handleKey(c);
}