Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c74a550

Browse files
HalCanarySkia Commit-Bot
authored andcommitted
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>
1 parent 62e37f1 commit c74a550

File tree

7 files changed

+11
-13
lines changed

7 files changed

+11
-13
lines changed

gm/gm.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,11 @@ void GM::modifyGrContextOptions(GrContextOptions* options) {}
147147
void GM::onOnceBeforeDraw() {}
148148

149149
bool GM::onAnimate(const AnimTimer&) { return false; }
150-
bool GM::onHandleKey(SkUnichar uni) { return false; }
150+
151+
bool GM::onChar(SkUnichar uni) { return false; }
152+
151153
bool GM::onGetControls(SkMetaData*) { return false; }
154+
152155
void GM::onSetControls(const SkMetaData&) {}
153156

154157
/////////////////////////////////////////////////////////////////////////////////////////////

gm/gm.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,7 @@ namespace skiagm {
145145
}
146146

147147
bool animate(const AnimTimer&);
148-
bool handleKey(SkUnichar uni) {
149-
return this->onHandleKey(uni);
150-
}
148+
virtual bool onChar(SkUnichar);
151149

152150
bool getControls(SkMetaData* controls) { return this->onGetControls(controls); }
153151
void setControls(const SkMetaData& controls) { this->onSetControls(controls); }
@@ -163,7 +161,6 @@ namespace skiagm {
163161
virtual SkString onShortName() = 0;
164162

165163
virtual bool onAnimate(const AnimTimer&);
166-
virtual bool onHandleKey(SkUnichar uni);
167164
virtual bool onGetControls(SkMetaData*);
168165
virtual void onSetControls(const SkMetaData&);
169166

gm/mac_aa_explorer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class MacAAFontsGM : public skiagm::GM {
117117

118118
SkString onShortName() override { return SkString("macaatest"); }
119119

120-
bool onHandleKey(SkUnichar uni) override {
120+
bool onChar(SkUnichar uni) override {
121121
switch (uni) {
122122
case 'i': fSize += 1; return true;
123123
case 'k': fSize -= 1; return true;

modules/skottie/gm/3dgm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ class GM3d : public skiagm::GM {
204204
fAnimT = fmod(timer.secs(), dur) / dur;
205205
return true;
206206
}
207-
bool onHandleKey(SkUnichar uni) override {
207+
bool onChar(SkUnichar uni) override {
208208
switch (uni) {
209209
case 'a': fEye.fX += 0.125f; return true;
210210
case 'd': fEye.fX -= 0.125f; return true;

modules/skottie/gm/SkottieGM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class SkottieColorizeGM : public skiagm::GM {
135135
return true;
136136
}
137137

138-
bool onHandleKey(SkUnichar uni) override {
138+
bool onChar(SkUnichar uni) override {
139139
static constexpr SkColor kColors[] = {
140140
SK_ColorBLACK,
141141
SK_ColorRED,

tools/viewer/GMSlide.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ GMSlide::GMSlide(skiagm::GM* gm) : fGM(gm) {
1818
fName.printf("GM_%s", gm->getName());
1919
}
2020

21-
GMSlide::~GMSlide() { delete fGM; }
21+
GMSlide::~GMSlide() = default;
2222

2323
void GMSlide::draw(SkCanvas* canvas) {
2424
// Do we care about timing the draw of the background (once)?
@@ -29,9 +29,7 @@ void GMSlide::draw(SkCanvas* canvas) {
2929

3030
bool GMSlide::animate(const AnimTimer& timer) { return fGM->animate(timer); }
3131

32-
bool GMSlide::onChar(SkUnichar c) {
33-
return fGM->handleKey(c);
34-
}
32+
bool GMSlide::onChar(SkUnichar c) { return fGM->onChar(c); }
3533

3634
bool GMSlide::onGetControls(SkMetaData* controls) {
3735
return fGM->getControls(controls);

tools/viewer/GMSlide.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class GMSlide : public Slide {
2727
void onSetControls(const SkMetaData&) override;
2828

2929
private:
30-
skiagm::GM* fGM;
30+
std::unique_ptr<skiagm::GM> fGM;
3131
};
3232

3333

0 commit comments

Comments
 (0)