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

Side by Side Diff: samplecode/SampleFontCache.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 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 | « samplecode/SampleFilterQuality.cpp ('k') | samplecode/SampleFontScalerTest.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 y += m.fDescent - m.fAscent; 56 y += m.fDescent - m.fAscent;
57 } 57 }
58 } 58 }
59 59
60 static bool gDone; 60 static bool gDone;
61 61
62 static void* measure_proc(void* context) { 62 static void* measure_proc(void* context) {
63 while (!gDone) { 63 while (!gDone) {
64 call_measure(); 64 call_measure();
65 } 65 }
66 return NULL; 66 return nullptr;
67 } 67 }
68 68
69 static void* draw_proc(void* context) { 69 static void* draw_proc(void* context) {
70 SkBitmap* bm = (SkBitmap*)context; 70 SkBitmap* bm = (SkBitmap*)context;
71 SkCanvas canvas(*bm); 71 SkCanvas canvas(*bm);
72 72
73 while (!gDone) { 73 while (!gDone) {
74 call_draw(&canvas); 74 call_draw(&canvas);
75 } 75 }
76 return NULL; 76 return nullptr;
77 } 77 }
78 78
79 class FontCacheView : public SampleView { 79 class FontCacheView : public SampleView {
80 public: 80 public:
81 enum { N = 4 }; 81 enum { N = 4 };
82 82
83 pthread_t fMThreads[N]; 83 pthread_t fMThreads[N];
84 pthread_t fDThreads[N]; 84 pthread_t fDThreads[N];
85 SkBitmap fBitmaps[N]; 85 SkBitmap fBitmaps[N];
86 86
87 FontCacheView() { 87 FontCacheView() {
88 gDone = false; 88 gDone = false;
89 for (int i = 0; i < N; i++) { 89 for (int i = 0; i < N; i++) {
90 int status; 90 int status;
91 91
92 status = pthread_create(&fMThreads[i], NULL, measure_proc, NULL); 92 status = pthread_create(&fMThreads[i], nullptr, measure_proc, nullp tr);
93 SkASSERT(0 == status); 93 SkASSERT(0 == status);
94 94
95 fBitmaps[i].allocPixels(SkImageInfo::Make(320, 240, 95 fBitmaps[i].allocPixels(SkImageInfo::Make(320, 240,
96 kRGB_565_SkColorType, 96 kRGB_565_SkColorType,
97 kOpaque_SkAlphaType)); 97 kOpaque_SkAlphaType));
98 status = pthread_create(&fDThreads[i], NULL, draw_proc, &fBitmaps[i ]); 98 status = pthread_create(&fDThreads[i], nullptr, draw_proc, &fBitmap s[i]);
99 SkASSERT(0 == status); 99 SkASSERT(0 == status);
100 } 100 }
101 this->setBGColor(0xFFDDDDDD); 101 this->setBGColor(0xFFDDDDDD);
102 } 102 }
103 103
104 virtual ~FontCacheView() { 104 virtual ~FontCacheView() {
105 gDone = true; 105 gDone = true;
106 for (int i = 0; i < N; i++) { 106 for (int i = 0; i < N; i++) {
107 void* ret; 107 void* ret;
108 int status = pthread_join(fMThreads[i], &ret); 108 int status = pthread_join(fMThreads[i], &ret);
(...skipping 13 matching lines...) Expand all
122 return this->INHERITED::onQuery(evt); 122 return this->INHERITED::onQuery(evt);
123 } 123 }
124 124
125 virtual void onDrawContent(SkCanvas* canvas) { 125 virtual void onDrawContent(SkCanvas* canvas) {
126 SkScalar x = 0; 126 SkScalar x = 0;
127 SkScalar y = 0; 127 SkScalar y = 0;
128 for (int i = 0; i < N; i++) { 128 for (int i = 0; i < N; i++) {
129 canvas->drawBitmap(fBitmaps[i], x, y); 129 canvas->drawBitmap(fBitmaps[i], x, y);
130 x += SkIntToScalar(fBitmaps[i].width()); 130 x += SkIntToScalar(fBitmaps[i].width());
131 } 131 }
132 this->inval(NULL); 132 this->inval(nullptr);
133 } 133 }
134 134
135 private: 135 private:
136 typedef SampleView INHERITED; 136 typedef SampleView INHERITED;
137 }; 137 };
138 138
139 ////////////////////////////////////////////////////////////////////////////// 139 //////////////////////////////////////////////////////////////////////////////
140 140
141 static SkView* MyFactory() { return new FontCacheView; } 141 static SkView* MyFactory() { return new FontCacheView; }
142 static SkViewRegister reg(MyFactory); 142 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleFilterQuality.cpp ('k') | samplecode/SampleFontScalerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698