aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/viewer/GMSlide.cpp
blob: 40a9c99d0b61c61f0289df0f7a15dc864277ec8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
* 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);
}