blob: 582cd813b20f4a2d2599ec7bb8712f9f71227e84 [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
21GMSlide::~GMSlide() { delete fGM; }
22
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
Mike Kleincd5104e2019-03-20 11:55:08 -050030bool GMSlide::animate(const AnimTimer& timer) { return fGM->animate(timer); }
Jim Van Verth6f449692017-02-14 15:16:46 -050031
32bool GMSlide::onChar(SkUnichar c) {
33 return fGM->handleKey(c);
34}
Mike Reed81f60ec2018-05-15 10:09:52 -040035
36bool GMSlide::onGetControls(SkMetaData* controls) {
37 return fGM->getControls(controls);
38}
39
40void GMSlide::onSetControls(const SkMetaData& controls) {
41 fGM->setControls(controls);
42}
43