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

Side by Side Diff: gm/vertices.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 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 | « gm/variedtext.cpp ('k') | gm/verttext.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 2013 Google Inc. 2 * Copyright 2013 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 "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkGradientShader.h" 10 #include "SkGradientShader.h"
(...skipping 20 matching lines...) Expand all
31 31
32 public: 32 public:
33 VerticesGM(unsigned alpha) : fShader(NULL), fAlpha(alpha) { 33 VerticesGM(unsigned alpha) : fShader(NULL), fAlpha(alpha) {
34 } 34 }
35 35
36 virtual ~VerticesGM() { 36 virtual ~VerticesGM() {
37 SkSafeUnref(fShader); 37 SkSafeUnref(fShader);
38 } 38 }
39 39
40 protected: 40 protected:
41 virtual uint32_t onGetFlags() const SK_OVERRIDE { 41 uint32_t onGetFlags() const SK_OVERRIDE {
42 return kSkipTiled_Flag; 42 return kSkipTiled_Flag;
43 } 43 }
44 44
45 virtual void onOnceBeforeDraw() SK_OVERRIDE { 45 void onOnceBeforeDraw() SK_OVERRIDE {
46 const SkScalar X = 150; 46 const SkScalar X = 150;
47 const SkScalar Y = 150; 47 const SkScalar Y = 150;
48 48
49 fPts[0].set(0, 0); fPts[1].set(X/2, 10); fPts[2].set(X, 0); 49 fPts[0].set(0, 0); fPts[1].set(X/2, 10); fPts[2].set(X, 0);
50 fPts[3].set(10, Y/2); fPts[4].set(X/2, Y/2); fPts[5].set(X-10, Y/2); 50 fPts[3].set(10, Y/2); fPts[4].set(X/2, Y/2); fPts[5].set(X-10, Y/2);
51 fPts[6].set(0, Y); fPts[7].set(X/2, Y-10); fPts[8].set(X, Y); 51 fPts[6].set(0, Y); fPts[7].set(X/2, Y-10); fPts[8].set(X, Y);
52 52
53 const SkScalar w = 200; 53 const SkScalar w = 200;
54 const SkScalar h = 200; 54 const SkScalar h = 200;
55 55
56 fTexs[0].set(0, 0); fTexs[1].set(w/2, 0); fTexs[2].set(w, 0); 56 fTexs[0].set(0, 0); fTexs[1].set(w/2, 0); fTexs[2].set(w, 0);
57 fTexs[3].set(0, h/2); fTexs[4].set(w/2, h/2); fTexs[5].set(w, h/2); 57 fTexs[3].set(0, h/2); fTexs[4].set(w/2, h/2); fTexs[5].set(w, h/2);
58 fTexs[6].set(0, h); fTexs[7].set(w/2, h); fTexs[8].set(w, h); 58 fTexs[6].set(0, h); fTexs[7].set(w/2, h); fTexs[8].set(w, h);
59 59
60 fShader = make_shader(w, h); 60 fShader = make_shader(w, h);
61 61
62 SkRandom rand; 62 SkRandom rand;
63 for (size_t i = 0; i < SK_ARRAY_COUNT(fColors); ++i) { 63 for (size_t i = 0; i < SK_ARRAY_COUNT(fColors); ++i) {
64 fColors[i] = rand.nextU() | 0xFF000000; 64 fColors[i] = rand.nextU() | 0xFF000000;
65 } 65 }
66 } 66 }
67 67
68 virtual SkString onShortName() SK_OVERRIDE { 68 SkString onShortName() SK_OVERRIDE {
69 SkString name("vertices"); 69 SkString name("vertices");
70 if (0xFF != fAlpha) { 70 if (0xFF != fAlpha) {
71 name.appendf("_%02X", fAlpha); 71 name.appendf("_%02X", fAlpha);
72 } 72 }
73 return name; 73 return name;
74 } 74 }
75 75
76 virtual SkISize onISize() SK_OVERRIDE { 76 SkISize onISize() SK_OVERRIDE {
77 return SkISize::Make(600, 600); 77 return SkISize::Make(600, 600);
78 } 78 }
79 79
80 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 80 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
81 // start with the center of a 3x3 grid 81 // start with the center of a 3x3 grid
82 static const uint16_t fan[] = { 82 static const uint16_t fan[] = {
83 4, 83 4,
84 0, 1, 2, 5, 8, 7, 6, 3, 0 84 0, 1, 2, 5, 8, 7, 6, 3, 0
85 }; 85 };
86 86
87 const struct { 87 const struct {
88 const SkColor* fColors; 88 const SkColor* fColors;
89 const SkPoint* fTexs; 89 const SkPoint* fTexs;
90 } rec[] = { 90 } rec[] = {
(...skipping 30 matching lines...) Expand all
121 } 121 }
122 122
123 private: 123 private:
124 typedef skiagm::GM INHERITED; 124 typedef skiagm::GM INHERITED;
125 }; 125 };
126 126
127 //////////////////////////////////////////////////////////////////////////////// ///// 127 //////////////////////////////////////////////////////////////////////////////// /////
128 128
129 DEF_GM( return SkNEW_ARGS(VerticesGM, (0xFF)); ) 129 DEF_GM( return SkNEW_ARGS(VerticesGM, (0xFF)); )
130 DEF_GM( return SkNEW_ARGS(VerticesGM, (0x80)); ) 130 DEF_GM( return SkNEW_ARGS(VerticesGM, (0x80)); )
OLDNEW
« no previous file with comments | « gm/variedtext.cpp ('k') | gm/verttext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698