skia2/tools/viewer/GMSlide.cpp
Ben Wagner 406ff500a4 Clean up some gm factory use.
Mostly use unique_ptr more consistently.

Change-Id: I6e11b272a7904eb662dea59b03fbc309a4cfc25d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/233984
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-08-13 15:57:37 +00:00

42 lines
1.0 KiB
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 "include/core/SkCanvas.h"
#include "tools/viewer/GMSlide.h"
GMSlide::GMSlide(std::unique_ptr<skiagm::GM> gm) : fGM(std::move(gm)) {
fName.printf("GM_%s", fGM->getName());
}
GMSlide::~GMSlide() = default;
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(double nanos) { return fGM->animate(nanos); }
bool GMSlide::onChar(SkUnichar c) { return fGM->onChar(c); }
bool GMSlide::onGetControls(SkMetaData* controls) {
return fGM->getControls(controls);
}
void GMSlide::onSetControls(const SkMetaData& controls) {
fGM->setControls(controls);
}