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

Unified Diff: content/renderer/pepper/pepper_truetype_font_mac.mm

Issue 225903006: PPAPI: Run clang_format.py on content/renderer/pepper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/pepper/pepper_truetype_font_mac.mm
diff --git a/content/renderer/pepper/pepper_truetype_font_mac.mm b/content/renderer/pepper/pepper_truetype_font_mac.mm
index 19e74749506d440c7aa85a7b7f4428d7c4527f5d..0be3a23c70533fe6b6e5687c932dbf99da2735cb 100644
--- a/content/renderer/pepper/pepper_truetype_font_mac.mm
+++ b/content/renderer/pepper/pepper_truetype_font_mac.mm
@@ -24,11 +24,10 @@ namespace {
static bool FindFloat(CFDictionaryRef dict, CFStringRef name, float* value) {
CFNumberRef num;
- return
- CFDictionaryGetValueIfPresent(dict, name,
- reinterpret_cast<const void**>(&num)) &&
- CFNumberIsFloatType(num) &&
- CFNumberGetValue(num, kCFNumberFloatType, value);
+ return CFDictionaryGetValueIfPresent(
+ dict, name, reinterpret_cast<const void**>(&num)) &&
+ CFNumberIsFloatType(num) &&
+ CFNumberGetValue(num, kCFNumberFloatType, value);
}
float GetMacWeight(PP_TrueTypeFontWeight_Dev weight) {
@@ -58,7 +57,7 @@ PP_TrueTypeFontWidth_Dev GetPepperWidth(float width) {
// Perform the inverse mapping of GetMacWeight.
return static_cast<PP_TrueTypeFontWidth_Dev>(
width *
- (PP_TRUETYPEFONTWIDTH_ULTRAEXPANDED - PP_TRUETYPEFONTWIDTH_NORMAL) +
+ (PP_TRUETYPEFONTWIDTH_ULTRAEXPANDED - PP_TRUETYPEFONTWIDTH_NORMAL) +
PP_TRUETYPEFONTWIDTH_NORMAL);
}
@@ -102,13 +101,14 @@ class PepperTrueTypeFontMac : public PepperTrueTypeFont {
// PepperTrueTypeFont overrides.
virtual bool IsValid() OVERRIDE;
- virtual int32_t Describe(
- ppapi::proxy::SerializedTrueTypeFontDesc* desc) OVERRIDE;
+ virtual int32_t Describe(ppapi::proxy::SerializedTrueTypeFontDesc* desc)
+ OVERRIDE;
virtual int32_t GetTableTags(std::vector<uint32_t>* tags) OVERRIDE;
virtual int32_t GetTable(uint32_t table_tag,
int32_t offset,
int32_t max_data_length,
std::string* data) OVERRIDE;
+
private:
virtual int32_t GetEntireFont(int32_t offset,
int32_t max_data_length,
@@ -209,12 +209,9 @@ PepperTrueTypeFontMac::PepperTrueTypeFontMac(
font_ref_.reset(CTFontCreateWithFontDescriptor(desc_ref, 0, NULL));
}
-PepperTrueTypeFontMac::~PepperTrueTypeFontMac() {
-}
+PepperTrueTypeFontMac::~PepperTrueTypeFontMac() {}
-bool PepperTrueTypeFontMac::IsValid() {
- return font_ref_.get() != NULL;
-}
+bool PepperTrueTypeFontMac::IsValid() { return font_ref_.get() != NULL; }
int32_t PepperTrueTypeFontMac::Describe(
ppapi::proxy::SerializedTrueTypeFontDesc* desc) {
@@ -237,7 +234,7 @@ int32_t PepperTrueTypeFontMac::Describe(
CTFontSymbolicTraits symbolic_traits(CTFontGetSymbolicTraits(font_ref_));
if (symbolic_traits & kCTFontItalicTrait)
desc->style = static_cast<PP_TrueTypeFontStyle_Dev>(
- desc->style | PP_TRUETYPEFONTSTYLE_ITALIC);
+ desc->style | PP_TRUETYPEFONTSTYLE_ITALIC);
if (symbolic_traits & kCTFontBoldTrait) {
desc->weight = PP_TRUETYPEFONTWEIGHT_BOLD;
} else {
@@ -294,11 +291,11 @@ int32_t PepperTrueTypeFontMac::GetTable(uint32_t table_tag,
CFIndex table_size = CFDataGetLength(table_ref);
CFIndex safe_offset =
std::min(base::checked_cast<CFIndex>(offset), table_size);
- CFIndex safe_length =
- std::min(table_size - safe_offset,
- base::checked_cast<CFIndex>(max_data_length));
+ CFIndex safe_length = std::min(table_size - safe_offset,
+ base::checked_cast<CFIndex>(max_data_length));
data->resize(safe_length);
- CFDataGetBytes(table_ref, CFRangeMake(safe_offset, safe_length),
+ CFDataGetBytes(table_ref,
+ CFRangeMake(safe_offset, safe_length),
reinterpret_cast<UInt8*>(&(*data)[0]));
return safe_length;
@@ -314,8 +311,8 @@ int32_t PepperTrueTypeFontMac::GetEntireFont(int32_t offset,
return table_count; // PPAPI error code.
// Allocate enough room for the header and the table directory entries.
- std::string font(sizeof(FontHeader) +
- sizeof(FontDirectoryEntry) * table_count, 0);
+ std::string font(
+ sizeof(FontHeader) + sizeof(FontDirectoryEntry) * table_count, 0);
// Map the OS X font type value to a TrueType scalar type.
base::ScopedCFTypeRef<CFNumberRef> font_type_ref(
base::mac::CFCast<CFNumberRef>(
@@ -344,7 +341,7 @@ int32_t PepperTrueTypeFontMac::GetEntireFont(int32_t offset,
uint16_t num_tables = base::checked_cast<uint16_t>(table_count);
uint16_t entry_selector = 0;
uint16_t search_range = 1;
- while (search_range < num_tables >> 1) {
+ while (search_range<num_tables>> 1) {
entry_selector++;
search_range <<= 1;
}
@@ -362,9 +359,8 @@ int32_t PepperTrueTypeFontMac::GetEntireFont(int32_t offset,
for (int32_t i = 0; i < table_count; i++) {
// Get the table data.
std::string table;
- int32_t table_size = GetTable(table_tags[i],
- 0, std::numeric_limits<int32_t>::max(),
- &table);
+ int32_t table_size =
+ GetTable(table_tags[i], 0, std::numeric_limits<int32_t>::max(), &table);
if (table_size < 0)
return table_size; // PPAPI error code.
@@ -378,8 +374,8 @@ int32_t PepperTrueTypeFontMac::GetEntireFont(int32_t offset,
FontDirectoryEntry* entry = reinterpret_cast<FontDirectoryEntry*>(
&font[0] + sizeof(FontHeader) + i * sizeof(FontDirectoryEntry));
entry->tag = base::HostToNet32(table_tags[i]);
- entry->checksum = base::HostToNet32(
- CalculateChecksum(&font[table_offset], table_size));
+ entry->checksum =
+ base::HostToNet32(CalculateChecksum(&font[table_offset], table_size));
entry->offset = base::HostToNet32(table_offset);
entry->logical_length = base::HostToNet32(table_size);
// TODO(bbudge) set the 'head' table checksumAdjustment.

Powered by Google App Engine
This is Rietveld 408576698