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

Side by Side Diff: src/core/SkFont.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 | « src/core/SkFlattenable.cpp ('k') | src/core/SkFontDescriptor.h » ('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 "SkFont.h" 8 #include "SkFont.h"
9 #include "SkTypeface.h" 9 #include "SkTypeface.h"
10 #include "SkUtils.h" 10 #include "SkUtils.h"
(...skipping 13 matching lines...) Expand all
24 { 24 {
25 SkASSERT(size > 0); 25 SkASSERT(size > 0);
26 SkASSERT(scaleX > 0); 26 SkASSERT(scaleX > 0);
27 SkASSERT(SkScalarIsFinite(skewX)); 27 SkASSERT(SkScalarIsFinite(skewX));
28 SkASSERT(0 == (flags & ~kAllFlags)); 28 SkASSERT(0 == (flags & ~kAllFlags));
29 } 29 }
30 30
31 SkFont* SkFont::Create(SkTypeface* face, SkScalar size, SkScalar scaleX, SkScala r skewX, 31 SkFont* SkFont::Create(SkTypeface* face, SkScalar size, SkScalar scaleX, SkScala r skewX,
32 MaskType mt, uint32_t flags) { 32 MaskType mt, uint32_t flags) {
33 if (size <= 0 || !SkScalarIsFinite(size)) { 33 if (size <= 0 || !SkScalarIsFinite(size)) {
34 return NULL; 34 return nullptr;
35 } 35 }
36 if (scaleX <= 0 || !SkScalarIsFinite(scaleX)) { 36 if (scaleX <= 0 || !SkScalarIsFinite(scaleX)) {
37 return NULL; 37 return nullptr;
38 } 38 }
39 if (!SkScalarIsFinite(skewX)) { 39 if (!SkScalarIsFinite(skewX)) {
40 return NULL; 40 return nullptr;
41 } 41 }
42 flags &= kAllFlags; 42 flags &= kAllFlags;
43 return new SkFont(face, size, scaleX, skewX, mt, flags); 43 return new SkFont(face, size, scaleX, skewX, mt, flags);
44 } 44 }
45 45
46 SkFont* SkFont::Create(SkTypeface* face, SkScalar size, MaskType mt, uint32_t fl ags) { 46 SkFont* SkFont::Create(SkTypeface* face, SkScalar size, MaskType mt, uint32_t fl ags) {
47 return SkFont::Create(face, size, 1, 0, mt, flags); 47 return SkFont::Create(face, size, 1, 0, mt, flags);
48 } 48 }
49 49
50 SkFont* SkFont::cloneWithSize(SkScalar newSize) const { 50 SkFont* SkFont::cloneWithSize(SkScalar newSize) const {
(...skipping 24 matching lines...) Expand all
75 case kUTF16_SkTextEncoding: 75 case kUTF16_SkTextEncoding:
76 count = SkUTF16_CountUnichars((const uint16_t*)text, SkToInt(byteLen gth >> 1)); 76 count = SkUTF16_CountUnichars((const uint16_t*)text, SkToInt(byteLen gth >> 1));
77 break; 77 break;
78 case kUTF32_SkTextEncoding: 78 case kUTF32_SkTextEncoding:
79 count = SkToInt(byteLength >> 2); 79 count = SkToInt(byteLength >> 2);
80 break; 80 break;
81 case kGlyphID_SkTextEncoding: 81 case kGlyphID_SkTextEncoding:
82 count = SkToInt(byteLength >> 1); 82 count = SkToInt(byteLength >> 1);
83 break; 83 break;
84 } 84 }
85 if (NULL == glyphs) { 85 if (nullptr == glyphs) {
86 return count; 86 return count;
87 } 87 }
88 88
89 // TODO: unify/eliminate SkTypeface::Encoding with SkTextEncoding 89 // TODO: unify/eliminate SkTypeface::Encoding with SkTextEncoding
90 SkTypeface::Encoding typeface_encoding; 90 SkTypeface::Encoding typeface_encoding;
91 switch (encoding) { 91 switch (encoding) {
92 case kUTF8_SkTextEncoding: 92 case kUTF8_SkTextEncoding:
93 typeface_encoding = SkTypeface::kUTF8_Encoding; 93 typeface_encoding = SkTypeface::kUTF8_Encoding;
94 break; 94 break;
95 case kUTF16_SkTextEncoding: 95 case kUTF16_SkTextEncoding:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 147
148 MaskType maskType = SkFont::kBW_MaskType; 148 MaskType maskType = SkFont::kBW_MaskType;
149 if (paint.isAntiAlias()) { 149 if (paint.isAntiAlias()) {
150 maskType = paint.isLCDRenderText() ? kLCD_MaskType : kA8_MaskType; 150 maskType = paint.isLCDRenderText() ? kLCD_MaskType : kA8_MaskType;
151 } 151 }
152 152
153 return Create(paint.getTypeface(), 153 return Create(paint.getTypeface(),
154 paint.getTextSize(), paint.getTextScaleX(), paint.getTextSkewX (), 154 paint.getTextSize(), paint.getTextScaleX(), paint.getTextSkewX (),
155 maskType, flags); 155 maskType, flags);
156 } 156 }
OLDNEW
« no previous file with comments | « src/core/SkFlattenable.cpp ('k') | src/core/SkFontDescriptor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698