blob: 0fb583594d6a68d7e54640c9ce683e0818acaf1d [file] [log] [blame]
jvanverth2bb3b6d2016-04-08 07:24:09 -07001/*
2* Copyright 2016 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* Copyright 2014 Google Inc.
9*
10* Use of this source code is governed by a BSD-style license that can be
11* found in the LICENSE file.
12*/
13
Mike Kleinc0bd9f92019-04-23 12:05:21 -050014#include "include/core/SkCanvas.h"
15#include "tools/viewer/GMSlide.h"
jvanverth2bb3b6d2016-04-08 07:24:09 -070016
17GMSlide::GMSlide(skiagm::GM* gm) : fGM(gm) {
18 fName.printf("GM_%s", gm->getName());
19}
20
Hal Canaryc74a5502019-07-08 14:55:15 -040021GMSlide::~GMSlide() = default;
jvanverth2bb3b6d2016-04-08 07:24:09 -070022
23void GMSlide::draw(SkCanvas* canvas) {
24 // Do we care about timing the draw of the background (once)?
25 // Does the GM ever rely on drawBackground to lazily compute something?
26 fGM->drawBackground(canvas);
27 fGM->drawContent(canvas);
28}
jvanverthc265a922016-04-08 12:51:45 -070029
Hal Canary41248072019-07-11 16:32:53 -040030bool GMSlide::animate(double nanos) { return fGM->animate(nanos); }
Jim Van Verth6f449692017-02-14 15:16:46 -050031
Hal Canaryc74a5502019-07-08 14:55:15 -040032bool GMSlide::onChar(SkUnichar c) { return fGM->onChar(c); }
Mike Reed81f60ec2018-05-15 10:09:52 -040033
34bool GMSlide::onGetControls(SkMetaData* controls) {
35 return fGM->getControls(controls);
36}
37
38void GMSlide::onSetControls(const SkMetaData& controls) {
39 fGM->setControls(controls);
40}
41