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

Side by Side Diff: gm/dftext.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, 8 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/dcshader.cpp ('k') | gm/discard.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 2011 Google Inc. 2 * Copyright 2011 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 #include "gm.h" 7 #include "gm.h"
8 #include "Resources.h" 8 #include "Resources.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkStream.h" 10 #include "SkStream.h"
11 #include "SkSurface.h" 11 #include "SkSurface.h"
12 #include "SkTypeface.h" 12 #include "SkTypeface.h"
13 13
14 class DFTextGM : public skiagm::GM { 14 class DFTextGM : public skiagm::GM {
15 public: 15 public:
16 DFTextGM() { 16 DFTextGM() {
17 this->setBGColor(0xFFFFFFFF); 17 this->setBGColor(0xFFFFFFFF);
18 fTypeface = NULL; 18 fTypeface = NULL;
19 } 19 }
20 20
21 virtual ~DFTextGM() { 21 virtual ~DFTextGM() {
22 SkSafeUnref(fTypeface); 22 SkSafeUnref(fTypeface);
23 } 23 }
24 24
25 protected: 25 protected:
26 void onOnceBeforeDraw() SK_OVERRIDE { 26 void onOnceBeforeDraw() override {
27 SkString filename = GetResourcePath("/Funkster.ttf"); 27 SkString filename = GetResourcePath("/Funkster.ttf");
28 SkAutoTDelete<SkFILEStream> stream(new SkFILEStream(filename.c_str())); 28 SkAutoTDelete<SkFILEStream> stream(new SkFILEStream(filename.c_str()));
29 if (!stream->isValid()) { 29 if (!stream->isValid()) {
30 SkDebugf("Could not find Funkster.ttf, please set --resourcePath cor rectly.\n"); 30 SkDebugf("Could not find Funkster.ttf, please set --resourcePath cor rectly.\n");
31 return; 31 return;
32 } 32 }
33 33
34 fTypeface = SkTypeface::CreateFromStream(stream.detach()); 34 fTypeface = SkTypeface::CreateFromStream(stream.detach());
35 } 35 }
36 36
37 SkString onShortName() SK_OVERRIDE { 37 SkString onShortName() override {
38 return SkString("dftext"); 38 return SkString("dftext");
39 } 39 }
40 40
41 SkISize onISize() SK_OVERRIDE { 41 SkISize onISize() override {
42 return SkISize::Make(1024, 768); 42 return SkISize::Make(1024, 768);
43 } 43 }
44 44
45 static void rotate_about(SkCanvas* canvas, 45 static void rotate_about(SkCanvas* canvas,
46 SkScalar degrees, 46 SkScalar degrees,
47 SkScalar px, SkScalar py) { 47 SkScalar px, SkScalar py) {
48 canvas->translate(px, py); 48 canvas->translate(px, py);
49 canvas->rotate(degrees); 49 canvas->rotate(degrees);
50 canvas->translate(-px, -py); 50 canvas->translate(-px, -py);
51 } 51 }
52 52
53 virtual void onDraw(SkCanvas* inputCanvas) SK_OVERRIDE { 53 virtual void onDraw(SkCanvas* inputCanvas) override {
54 #ifdef SK_BUILD_FOR_ANDROID 54 #ifdef SK_BUILD_FOR_ANDROID
55 SkScalar textSizes[] = { 9.0f, 9.0f*2.0f, 9.0f*5.0f, 9.0f*2.0f*5.0f }; 55 SkScalar textSizes[] = { 9.0f, 9.0f*2.0f, 9.0f*5.0f, 9.0f*2.0f*5.0f };
56 #else 56 #else
57 SkScalar textSizes[] = { 11.0f, 11.0f*2.0f, 11.0f*5.0f, 11.0f*2.0f*5.0f }; 57 SkScalar textSizes[] = { 11.0f, 11.0f*2.0f, 11.0f*5.0f, 11.0f*2.0f*5.0f };
58 #endif 58 #endif
59 SkScalar scales[] = { 2.0f*5.0f, 5.0f, 2.0f, 1.0f }; 59 SkScalar scales[] = { 2.0f*5.0f, 5.0f, 2.0f, 1.0f };
60 60
61 // set up offscreen rendering with distance field text 61 // set up offscreen rendering with distance field text
62 #if SK_SUPPORT_GPU 62 #if SK_SUPPORT_GPU
63 GrContext* ctx = inputCanvas->getGrContext(); 63 GrContext* ctx = inputCanvas->getGrContext();
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 #endif 234 #endif
235 } 235 }
236 236
237 private: 237 private:
238 SkTypeface* fTypeface; 238 SkTypeface* fTypeface;
239 239
240 typedef skiagm::GM INHERITED; 240 typedef skiagm::GM INHERITED;
241 }; 241 };
242 242
243 DEF_GM( return SkNEW(DFTextGM); ) 243 DEF_GM( return SkNEW(DFTextGM); )
OLDNEW
« no previous file with comments | « gm/dcshader.cpp ('k') | gm/discard.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698