Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GMSlide.cpp
Go to the documentation of this file.
1/*
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
15
17#include <utility>
18
19class SkCanvas;
20class SkMetaData;
21
22GMSlide::GMSlide(std::unique_ptr<skiagm::GM> gm) : fGM(std::move(gm)) {
23 fGM->setMode(skiagm::GM::kSample_Mode);
24
25 fName.printf("GM_%s", fGM->getName().c_str());
26}
27
28GMSlide::~GMSlide() = default;
29
31 fGM->gpuTeardown();
32}
33
34void GMSlide::draw(SkCanvas* canvas) {
35 SkString msg;
36
37 auto result = fGM->gpuSetup(canvas, &msg);
38 if (result != skiagm::GM::DrawResult::kOk) {
39 return;
40 }
41
42 fGM->draw(canvas, &msg);
43}
44
45bool GMSlide::animate(double nanos) { return fGM->animate(nanos); }
46
47bool GMSlide::onChar(SkUnichar c) { return fGM->onChar(c); }
48
50 return fGM->getControls(controls);
51}
52
53void GMSlide::onSetControls(const SkMetaData& controls) {
54 fGM->setControls(controls);
55}
56
int32_t SkUnichar
Definition SkTypes.h:175
GMSlide(std::unique_ptr< skiagm::GM > gm)
Definition GMSlide.cpp:22
void onSetControls(const SkMetaData &) override
Definition GMSlide.cpp:53
bool onGetControls(SkMetaData *) override
Definition GMSlide.cpp:49
void draw(SkCanvas *canvas) override
Definition GMSlide.cpp:34
bool animate(double nanos) override
Definition GMSlide.cpp:45
void gpuTeardown() override
Definition GMSlide.cpp:30
bool onChar(SkUnichar c) override
Definition GMSlide.cpp:47
~GMSlide() override
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition SkString.cpp:534
SkString fName
Definition Slide.h:54
@ kSample_Mode
Definition gm.h:120
GAsyncResult * result
Definition ref_ptr.h:256