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

Side by Side Diff: tools/sk_tool_utils.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 | « tools/sk_tool_utils.h ('k') | tools/sk_tool_utils_font.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 2014 Google Inc. 2 * Copyright 2014 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 "sk_tool_utils.h" 8 #include "sk_tool_utils.h"
9 #include "sk_tool_utils_flags.h" 9 #include "sk_tool_utils_flags.h"
10 10
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 void emoji_typeface(SkAutoTUnref<SkTypeface>* tf) { 78 void emoji_typeface(SkAutoTUnref<SkTypeface>* tf) {
79 if (!strcmp(sk_tool_utils::platform_os_emoji(), "CBDT")) { 79 if (!strcmp(sk_tool_utils::platform_os_emoji(), "CBDT")) {
80 tf->reset(GetResourceAsTypeface("/fonts/Funkster.ttf")); 80 tf->reset(GetResourceAsTypeface("/fonts/Funkster.ttf"));
81 return; 81 return;
82 } 82 }
83 if (!strcmp(sk_tool_utils::platform_os_emoji(), "SBIX")) { 83 if (!strcmp(sk_tool_utils::platform_os_emoji(), "SBIX")) {
84 tf->reset(SkTypeface::CreateFromName("Apple Color Emoji", SkTypeface::kN ormal)); 84 tf->reset(SkTypeface::CreateFromName("Apple Color Emoji", SkTypeface::kN ormal));
85 return; 85 return;
86 } 86 }
87 tf->reset(NULL); 87 tf->reset(nullptr);
88 return; 88 return;
89 } 89 }
90 90
91 const char* emoji_sample_text() { 91 const char* emoji_sample_text() {
92 if (!strcmp(sk_tool_utils::platform_os_emoji(), "CBDT")) { 92 if (!strcmp(sk_tool_utils::platform_os_emoji(), "CBDT")) {
93 return "Hamburgefons"; 93 return "Hamburgefons";
94 } 94 }
95 if (!strcmp(sk_tool_utils::platform_os_emoji(), "SBIX")) { 95 if (!strcmp(sk_tool_utils::platform_os_emoji(), "SBIX")) {
96 return "\xF0\x9F\x92\xB0" "\xF0\x9F\x8F\xA1" "\xF0\x9F\x8E\x85" // 💰🏡🎅 96 return "\xF0\x9F\x92\xB0" "\xF0\x9F\x8F\xA1" "\xF0\x9F\x8E\x85" // 💰🏡🎅
97 "\xF0\x9F\x8D\xAA" "\xF0\x9F\x8D\x95" "\xF0\x9F\x9A\x80" // 🍪🍕🚀 97 "\xF0\x9F\x8D\xAA" "\xF0\x9F\x8D\x95" "\xF0\x9F\x9A\x80" // 🍪🍕🚀
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 194 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
195 canvas->drawPaint(paint); 195 canvas->drawPaint(paint);
196 } 196 }
197 197
198 void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const SkPain t& origPaint, 198 void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const SkPain t& origPaint,
199 SkScalar x, SkScalar y) { 199 SkScalar x, SkScalar y) {
200 SkPaint paint(origPaint); 200 SkPaint paint(origPaint);
201 SkTDArray<uint16_t> glyphs; 201 SkTDArray<uint16_t> glyphs;
202 202
203 size_t len = strlen(text); 203 size_t len = strlen(text);
204 glyphs.append(paint.textToGlyphs(text, len, NULL)); 204 glyphs.append(paint.textToGlyphs(text, len, nullptr));
205 paint.textToGlyphs(text, len, glyphs.begin()); 205 paint.textToGlyphs(text, len, glyphs.begin());
206 206
207 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); 207 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
208 const SkTextBlobBuilder::RunBuffer& run = builder->allocRun(paint, glyphs.co unt(), x, y, 208 const SkTextBlobBuilder::RunBuffer& run = builder->allocRun(paint, glyphs.co unt(), x, y,
209 NULL); 209 nullptr);
210 memcpy(run.glyphs, glyphs.begin(), glyphs.count() * sizeof(uint16_t)); 210 memcpy(run.glyphs, glyphs.begin(), glyphs.count() * sizeof(uint16_t));
211 } 211 }
212 212
213 static inline void norm_to_rgb(SkBitmap* bm, int x, int y, const SkVector3& norm ) { 213 static inline void norm_to_rgb(SkBitmap* bm, int x, int y, const SkVector3& norm ) {
214 SkASSERT(SkScalarNearlyEqual(norm.length(), 1.0f)); 214 SkASSERT(SkScalarNearlyEqual(norm.length(), 1.0f));
215 unsigned char r = static_cast<unsigned char>((0.5f * norm.fX + 0.5f) * 255); 215 unsigned char r = static_cast<unsigned char>((0.5f * norm.fX + 0.5f) * 255);
216 unsigned char g = static_cast<unsigned char>((-0.5f * norm.fY + 0.5f) * 255) ; 216 unsigned char g = static_cast<unsigned char>((-0.5f * norm.fY + 0.5f) * 255) ;
217 unsigned char b = static_cast<unsigned char>((0.5f * norm.fZ + 0.5f) * 255); 217 unsigned char b = static_cast<unsigned char>((0.5f * norm.fZ + 0.5f) * 255);
218 *bm->getAddr32(x, y) = SkPackARGB32(0xFF, r, g, b); 218 *bm->getAddr32(x, y) = SkPackARGB32(0xFF, r, g, b);
219 } 219 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 norm = leftUp; 312 norm = leftUp;
313 } 313 }
314 } 314 }
315 315
316 norm_to_rgb(bm, x, y, norm); 316 norm_to_rgb(bm, x, y, norm);
317 } 317 }
318 } 318 }
319 } 319 }
320 320
321 } // namespace sk_tool_utils 321 } // namespace sk_tool_utils
OLDNEW
« no previous file with comments | « tools/sk_tool_utils.h ('k') | tools/sk_tool_utils_font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698