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 14 #include "include/core/SkCanvas.h" 15 #include "tools/viewer/GMSlide.h" 16 GMSlide(std::unique_ptr<skiagm::GM> gm)17GMSlide::GMSlide(std::unique_ptr<skiagm::GM> gm) : fGM(std::move(gm)) { 18 fName.printf("GM_%s", fGM->getName()); 19 } 20 21 GMSlide::~GMSlide() = default; 22 draw(SkCanvas * canvas)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 } 29 animate(double nanos)30bool GMSlide::animate(double nanos) { return fGM->animate(nanos); } 31 onChar(SkUnichar c)32bool GMSlide::onChar(SkUnichar c) { return fGM->onChar(c); } 33 onGetControls(SkMetaData * controls)34bool GMSlide::onGetControls(SkMetaData* controls) { 35 return fGM->getControls(controls); 36 } 37 onSetControls(const SkMetaData & controls)38void GMSlide::onSetControls(const SkMetaData& controls) { 39 fGM->setControls(controls); 40 } 41 42