GM: s/handleKey/onChar/

Change-Id: I917de2705807f61e6a6c3f76d52e290e8194d204
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/225936
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
This commit is contained in:
Hal Canary 2019-07-08 14:55:15 -04:00 committed by Skia Commit-Bot
parent 62e37f1ec5
commit c74a55057b
7 changed files with 11 additions and 13 deletions

View File

@ -147,8 +147,11 @@ void GM::modifyGrContextOptions(GrContextOptions* options) {}
void GM::onOnceBeforeDraw() {}
bool GM::onAnimate(const AnimTimer&) { return false; }
bool GM::onHandleKey(SkUnichar uni) { return false; }
bool GM::onChar(SkUnichar uni) { return false; }
bool GM::onGetControls(SkMetaData*) { return false; }
void GM::onSetControls(const SkMetaData&) {}
/////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -145,9 +145,7 @@ namespace skiagm {
}
bool animate(const AnimTimer&);
bool handleKey(SkUnichar uni) {
return this->onHandleKey(uni);
}
virtual bool onChar(SkUnichar);
bool getControls(SkMetaData* controls) { return this->onGetControls(controls); }
void setControls(const SkMetaData& controls) { this->onSetControls(controls); }
@ -163,7 +161,6 @@ namespace skiagm {
virtual SkString onShortName() = 0;
virtual bool onAnimate(const AnimTimer&);
virtual bool onHandleKey(SkUnichar uni);
virtual bool onGetControls(SkMetaData*);
virtual void onSetControls(const SkMetaData&);

View File

@ -117,7 +117,7 @@ protected:
SkString onShortName() override { return SkString("macaatest"); }
bool onHandleKey(SkUnichar uni) override {
bool onChar(SkUnichar uni) override {
switch (uni) {
case 'i': fSize += 1; return true;
case 'k': fSize -= 1; return true;

View File

@ -204,7 +204,7 @@ protected:
fAnimT = fmod(timer.secs(), dur) / dur;
return true;
}
bool onHandleKey(SkUnichar uni) override {
bool onChar(SkUnichar uni) override {
switch (uni) {
case 'a': fEye.fX += 0.125f; return true;
case 'd': fEye.fX -= 0.125f; return true;

View File

@ -135,7 +135,7 @@ protected:
return true;
}
bool onHandleKey(SkUnichar uni) override {
bool onChar(SkUnichar uni) override {
static constexpr SkColor kColors[] = {
SK_ColorBLACK,
SK_ColorRED,

View File

@ -18,7 +18,7 @@ GMSlide::GMSlide(skiagm::GM* gm) : fGM(gm) {
fName.printf("GM_%s", gm->getName());
}
GMSlide::~GMSlide() { delete fGM; }
GMSlide::~GMSlide() = default;
void GMSlide::draw(SkCanvas* canvas) {
// Do we care about timing the draw of the background (once)?
@ -29,9 +29,7 @@ void GMSlide::draw(SkCanvas* canvas) {
bool GMSlide::animate(const AnimTimer& timer) { return fGM->animate(timer); }
bool GMSlide::onChar(SkUnichar c) {
return fGM->handleKey(c);
}
bool GMSlide::onChar(SkUnichar c) { return fGM->onChar(c); }
bool GMSlide::onGetControls(SkMetaData* controls) {
return fGM->getControls(controls);

View File

@ -27,7 +27,7 @@ public:
void onSetControls(const SkMetaData&) override;
private:
skiagm::GM* fGM;
std::unique_ptr<skiagm::GM> fGM;
};