This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +11
-13
lines changed Expand file tree Collapse file tree 7 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -147,8 +147,11 @@ void GM::modifyGrContextOptions(GrContextOptions* options) {}
147
147
void GM::onOnceBeforeDraw () {}
148
148
149
149
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
+
151
153
bool GM::onGetControls (SkMetaData*) { return false ; }
154
+
152
155
void GM::onSetControls (const SkMetaData&) {}
153
156
154
157
// ///////////////////////////////////////////////////////////////////////////////////////////
Original file line number Diff line number Diff line change @@ -145,9 +145,7 @@ namespace skiagm {
145
145
}
146
146
147
147
bool animate (const AnimTimer&);
148
- bool handleKey (SkUnichar uni) {
149
- return this ->onHandleKey (uni);
150
- }
148
+ virtual bool onChar (SkUnichar);
151
149
152
150
bool getControls (SkMetaData* controls) { return this ->onGetControls (controls); }
153
151
void setControls (const SkMetaData& controls) { this ->onSetControls (controls); }
@@ -163,7 +161,6 @@ namespace skiagm {
163
161
virtual SkString onShortName () = 0;
164
162
165
163
virtual bool onAnimate (const AnimTimer&);
166
- virtual bool onHandleKey (SkUnichar uni);
167
164
virtual bool onGetControls (SkMetaData*);
168
165
virtual void onSetControls (const SkMetaData&);
169
166
Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ class MacAAFontsGM : public skiagm::GM {
117
117
118
118
SkString onShortName () override { return SkString (" macaatest" ); }
119
119
120
- bool onHandleKey (SkUnichar uni) override {
120
+ bool onChar (SkUnichar uni) override {
121
121
switch (uni) {
122
122
case ' i' : fSize += 1 ; return true ;
123
123
case ' k' : fSize -= 1 ; return true ;
Original file line number Diff line number Diff line change @@ -204,7 +204,7 @@ class GM3d : public skiagm::GM {
204
204
fAnimT = fmod (timer.secs (), dur) / dur;
205
205
return true ;
206
206
}
207
- bool onHandleKey (SkUnichar uni) override {
207
+ bool onChar (SkUnichar uni) override {
208
208
switch (uni) {
209
209
case ' a' : fEye .fX += 0 .125f ; return true ;
210
210
case ' d' : fEye .fX -= 0 .125f ; return true ;
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ class SkottieColorizeGM : public skiagm::GM {
135
135
return true ;
136
136
}
137
137
138
- bool onHandleKey (SkUnichar uni) override {
138
+ bool onChar (SkUnichar uni) override {
139
139
static constexpr SkColor kColors [] = {
140
140
SK_ColorBLACK,
141
141
SK_ColorRED,
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ GMSlide::GMSlide(skiagm::GM* gm) : fGM(gm) {
18
18
fName .printf (" GM_%s" , gm->getName ());
19
19
}
20
20
21
- GMSlide::~GMSlide () { delete fGM ; }
21
+ GMSlide::~GMSlide () = default ;
22
22
23
23
void GMSlide::draw (SkCanvas* canvas) {
24
24
// Do we care about timing the draw of the background (once)?
@@ -29,9 +29,7 @@ void GMSlide::draw(SkCanvas* canvas) {
29
29
30
30
bool GMSlide::animate (const AnimTimer& timer) { return fGM ->animate (timer); }
31
31
32
- bool GMSlide::onChar (SkUnichar c) {
33
- return fGM ->handleKey (c);
34
- }
32
+ bool GMSlide::onChar (SkUnichar c) { return fGM ->onChar (c); }
35
33
36
34
bool GMSlide::onGetControls (SkMetaData* controls) {
37
35
return fGM ->getControls (controls);
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ class GMSlide : public Slide {
27
27
void onSetControls (const SkMetaData&) override ;
28
28
29
29
private:
30
- skiagm::GM* fGM ;
30
+ std::unique_ptr< skiagm::GM> fGM ;
31
31
};
32
32
33
33
You can’t perform that action at this time.
0 commit comments