Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(607)

Side by Side Diff: samplecode/GMSampleView.cpp

Issue 2316593003: Add GM/slide to simulate Android-style reveal clip (Closed)
Patch Set: address code review comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/effects/SkGaussianEdgeShader.h ('k') | src/effects/SkGaussianEdgeShader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GMSampleView.h" 8 #include "GMSampleView.h"
9 9
10 GMSampleView::GMSampleView(GM* gm) : fShowSize(false), fGM(gm) {} 10 GMSampleView::GMSampleView(GM* gm) : fShowSize(false), fGM(gm) {}
11 11
12 GMSampleView::~GMSampleView() { 12 GMSampleView::~GMSampleView() {
13 delete fGM; 13 delete fGM;
14 } 14 }
15 15
16 SkEvent* GMSampleView::NewShowSizeEvt(bool doShowSize) { 16 SkEvent* GMSampleView::NewShowSizeEvt(bool doShowSize) {
17 SkEvent* evt = new SkEvent("GMSampleView::showSize"); 17 SkEvent* evt = new SkEvent("GMSampleView::showSize");
18 evt->setFast32(doShowSize); 18 evt->setFast32(doShowSize);
19 return evt; 19 return evt;
20 } 20 }
21 21
22 bool GMSampleView::onQuery(SkEvent* evt) { 22 bool GMSampleView::onQuery(SkEvent* evt) {
23 if (SampleCode::TitleQ(*evt)) { 23 if (SampleCode::TitleQ(*evt)) {
24 SkString name("GM:"); 24 SkString name("GM:");
25 name.append(fGM->getName()); 25 name.append(fGM->getName());
26 SampleCode::TitleR(evt, name.c_str()); 26 SampleCode::TitleR(evt, name.c_str());
27 return true; 27 return true;
28 } 28 }
29
30 SkUnichar uni;
31 if (SampleCode::CharQ(*evt, &uni)) {
32 if (fGM->handleKey(uni)) {
33 this->inval(nullptr);
34 return true;
35 }
36 }
37
29 return this->INHERITED::onQuery(evt); 38 return this->INHERITED::onQuery(evt);
30 } 39 }
31 40
32 bool GMSampleView::onEvent(const SkEvent& evt) { 41 bool GMSampleView::onEvent(const SkEvent& evt) {
33 if (evt.isType("GMSampleView::showSize")) { 42 if (evt.isType("GMSampleView::showSize")) {
34 fShowSize = SkToBool(evt.getFast32()); 43 fShowSize = SkToBool(evt.getFast32());
35 return true; 44 return true;
36 } 45 }
37 return this->INHERITED::onEvent(evt); 46 return this->INHERITED::onEvent(evt);
38 } 47 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 89 }
81 } 90 }
82 91
83 void GMSampleView::onDrawBackground(SkCanvas* canvas) { 92 void GMSampleView::onDrawBackground(SkCanvas* canvas) {
84 fGM->drawBackground(canvas); 93 fGM->drawBackground(canvas);
85 } 94 }
86 95
87 bool GMSampleView::onAnimate(const SkAnimTimer& timer) { 96 bool GMSampleView::onAnimate(const SkAnimTimer& timer) {
88 return fGM->animate(timer); 97 return fGM->animate(timer);
89 } 98 }
OLDNEW
« no previous file with comments | « include/effects/SkGaussianEdgeShader.h ('k') | src/effects/SkGaussianEdgeShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698