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

Side by Side Diff: samplecode/SampleUnpremul.cpp

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web Created 5 years, 9 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 | « samplecode/SampleTextOnPath.cpp ('k') | samplecode/SampleVertices.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 9
10 #include "sk_tool_utils.h" 10 #include "sk_tool_utils.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 public: 42 public:
43 UnpremulView(SkString res) 43 UnpremulView(SkString res)
44 : fResPath(res) 44 : fResPath(res)
45 , fPremul(true) 45 , fPremul(true)
46 , fDecodeSucceeded(false) { 46 , fDecodeSucceeded(false) {
47 this->nextImage(); 47 this->nextImage();
48 } 48 }
49 49
50 protected: 50 protected:
51 // overrides from SkEventSink 51 // overrides from SkEventSink
52 bool onQuery(SkEvent* evt) SK_OVERRIDE { 52 bool onQuery(SkEvent* evt) override {
53 if (SampleCode::TitleQ(*evt)) { 53 if (SampleCode::TitleQ(*evt)) {
54 SampleCode::TitleR(evt, "unpremul"); 54 SampleCode::TitleR(evt, "unpremul");
55 return true; 55 return true;
56 } 56 }
57 SkUnichar uni; 57 SkUnichar uni;
58 if (SampleCode::CharQ(*evt, &uni)) { 58 if (SampleCode::CharQ(*evt, &uni)) {
59 char utf8[kMaxBytesInUTF8Sequence]; 59 char utf8[kMaxBytesInUTF8Sequence];
60 size_t size = SkUTF8_FromUnichar(uni, utf8); 60 size_t size = SkUTF8_FromUnichar(uni, utf8);
61 // Only consider events for single char keys 61 // Only consider events for single char keys
62 if (1 == size) { 62 if (1 == size) {
63 switch (utf8[0]) { 63 switch (utf8[0]) {
64 case fNextImageChar: 64 case fNextImageChar:
65 this->nextImage(); 65 this->nextImage();
66 return true; 66 return true;
67 case fTogglePremulChar: 67 case fTogglePremulChar:
68 this->togglePremul(); 68 this->togglePremul();
69 return true; 69 return true;
70 default: 70 default:
71 break; 71 break;
72 } 72 }
73 } 73 }
74 } 74 }
75 return this->INHERITED::onQuery(evt); 75 return this->INHERITED::onQuery(evt);
76 } 76 }
77 77
78 void onDrawBackground(SkCanvas* canvas) SK_OVERRIDE { 78 void onDrawBackground(SkCanvas* canvas) override {
79 sk_tool_utils::draw_checkerboard(canvas, 0xFFCCCCCC, 0xFFFFFFFF, 12); 79 sk_tool_utils::draw_checkerboard(canvas, 0xFFCCCCCC, 0xFFFFFFFF, 12);
80 } 80 }
81 81
82 void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { 82 void onDrawContent(SkCanvas* canvas) override {
83 SkPaint paint; 83 SkPaint paint;
84 paint.setAntiAlias(true); 84 paint.setAntiAlias(true);
85 paint.setTextSize(SkIntToScalar(24)); 85 paint.setTextSize(SkIntToScalar(24));
86 SkAutoTUnref<SkBlurDrawLooper> looper( 86 SkAutoTUnref<SkBlurDrawLooper> looper(
87 SkBlurDrawLooper::Create(SK_ColorBLUE, 87 SkBlurDrawLooper::Create(SK_ColorBLUE,
88 SkBlurMask::ConvertRadiusToSigma(SkIntToSca lar(2)), 88 SkBlurMask::ConvertRadiusToSigma(SkIntToSca lar(2)),
89 0, 0)); 89 0, 0));
90 paint.setLooper(looper); 90 paint.setLooper(looper);
91 SkScalar height = paint.getFontMetrics(NULL); 91 SkScalar height = paint.getFontMetrics(NULL);
92 if (!fDecodeSucceeded) { 92 if (!fDecodeSucceeded) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 188
189 typedef SampleView INHERITED; 189 typedef SampleView INHERITED;
190 }; 190 };
191 191
192 ////////////////////////////////////////////////////////////////////////////// 192 //////////////////////////////////////////////////////////////////////////////
193 193
194 static SkView* MyFactory() { 194 static SkView* MyFactory() {
195 return new UnpremulView(GetResourcePath()); 195 return new UnpremulView(GetResourcePath());
196 } 196 }
197 static SkViewRegister reg(MyFactory); 197 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleTextOnPath.cpp ('k') | samplecode/SampleVertices.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698