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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp

Issue 2761693002: Wrapped PassRefPtrs in move where passed to RefPtr constructor. (Closed)
Patch Set: Added move wraps for multiple instances in 1 line. Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2006 Alexey Proskuryakov 3 * Copyright (C) 2006 Alexey Proskuryakov
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 SimpleFontData::SimpleFontData(const FontPlatformData& platformData, 58 SimpleFontData::SimpleFontData(const FontPlatformData& platformData,
59 PassRefPtr<CustomFontData> customData, 59 PassRefPtr<CustomFontData> customData,
60 bool isTextOrientationFallback, 60 bool isTextOrientationFallback,
61 bool subpixelAscentDescent) 61 bool subpixelAscentDescent)
62 : m_maxCharWidth(-1), 62 : m_maxCharWidth(-1),
63 m_avgCharWidth(-1), 63 m_avgCharWidth(-1),
64 m_platformData(platformData), 64 m_platformData(platformData),
65 m_isTextOrientationFallback(isTextOrientationFallback), 65 m_isTextOrientationFallback(isTextOrientationFallback),
66 m_verticalData(nullptr), 66 m_verticalData(nullptr),
67 m_hasVerticalGlyphs(false), 67 m_hasVerticalGlyphs(false),
68 m_customFontData(customData) { 68 m_customFontData(std::move(customData)) {
69 platformInit(subpixelAscentDescent); 69 platformInit(subpixelAscentDescent);
70 platformGlyphInit(); 70 platformGlyphInit();
71 if (platformData.isVerticalAnyUpright() && !isTextOrientationFallback) { 71 if (platformData.isVerticalAnyUpright() && !isTextOrientationFallback) {
72 m_verticalData = platformData.verticalData(); 72 m_verticalData = platformData.verticalData();
73 m_hasVerticalGlyphs = 73 m_hasVerticalGlyphs =
74 m_verticalData.get() && m_verticalData->hasVerticalMetrics(); 74 m_verticalData.get() && m_verticalData->hasVerticalMetrics();
75 } 75 }
76 } 76 }
77 77
78 SimpleFontData::SimpleFontData(PassRefPtr<CustomFontData> customData, 78 SimpleFontData::SimpleFontData(PassRefPtr<CustomFontData> customData,
79 float fontSize, 79 float fontSize,
80 bool syntheticBold, 80 bool syntheticBold,
81 bool syntheticItalic) 81 bool syntheticItalic)
82 : m_platformData( 82 : m_platformData(
83 FontPlatformData(fontSize, syntheticBold, syntheticItalic)), 83 FontPlatformData(fontSize, syntheticBold, syntheticItalic)),
84 m_isTextOrientationFallback(false), 84 m_isTextOrientationFallback(false),
85 m_verticalData(nullptr), 85 m_verticalData(nullptr),
86 m_hasVerticalGlyphs(false), 86 m_hasVerticalGlyphs(false),
87 m_customFontData(customData) {} 87 m_customFontData(std::move(customData)) {}
88 88
89 void SimpleFontData::platformInit(bool subpixelAscentDescent) { 89 void SimpleFontData::platformInit(bool subpixelAscentDescent) {
90 if (!m_platformData.size()) { 90 if (!m_platformData.size()) {
91 m_fontMetrics.reset(); 91 m_fontMetrics.reset();
92 m_avgCharWidth = 0; 92 m_avgCharWidth = 0;
93 m_maxCharWidth = 0; 93 m_maxCharWidth = 0;
94 return; 94 return;
95 } 95 }
96 96
97 SkPaint::FontMetrics metrics; 97 SkPaint::FontMetrics metrics;
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 float SimpleFontData::platformWidthForGlyph(Glyph glyph) const { 385 float SimpleFontData::platformWidthForGlyph(Glyph glyph) const {
386 if (!m_platformData.size()) 386 if (!m_platformData.size())
387 return 0; 387 return 0;
388 388
389 static_assert(sizeof(glyph) == 2, "Glyph id should not be truncated."); 389 static_assert(sizeof(glyph) == 2, "Glyph id should not be truncated.");
390 390
391 return SkiaTextMetrics(&m_paint).getSkiaWidthForGlyph(glyph); 391 return SkiaTextMetrics(&m_paint).getSkiaWidthForGlyph(glyph);
392 } 392 }
393 393
394 } // namespace blink 394 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698