aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2017-10-12 17:11:54 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-13 15:49:18 +0000
commitd40b3b0af1d24cc7fbe3a6bdcbe35d382425b209 (patch)
tree45329f76fdf6fa30ab15e85f1c1fef46f88ae9fc /src/core
parent2563ff942c0af72be399da87f15e0153ef2a4df3 (diff)
Make SkTypeface::Style and FromOldStyle private.
These are no longer used outside of Skia, so make them private. Change-Id: I735bb39c10553885cc6051aebddeff150ba4caa9 Reviewed-on: https://skia-review.googlesource.com/59180 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkFontDescriptor.cpp23
-rw-r--r--src/core/SkFontStyle.cpp18
-rw-r--r--src/core/SkPaint.cpp2
-rw-r--r--src/core/SkTypeface.cpp12
4 files changed, 14 insertions, 41 deletions
diff --git a/src/core/SkFontDescriptor.cpp b/src/core/SkFontDescriptor.cpp
index 519e8f2fe7..14b0318def 100644
--- a/src/core/SkFontDescriptor.cpp
+++ b/src/core/SkFontDescriptor.cpp
@@ -20,7 +20,6 @@ enum {
// defines for names in its 'name' table.
kFontAxes = 0xFC,
kFontIndex = 0xFD,
- kFontFileName = 0xFE, // Remove when MIN_PICTURE_VERSION > 41
kSentinel = 0xFF,
};
@@ -34,14 +33,6 @@ static void read_string(SkStream* stream, SkString* string) {
}
}
-// Remove when MIN_PICTURE_VERSION > 41
-static void skip_string(SkStream* stream) {
- const uint32_t length = SkToU32(stream->readPackedUInt());
- if (length > 0) {
- stream->skip(length);
- }
-}
-
static void write_string(SkWStream* stream, const SkString& string, uint32_t id) {
if (!string.isEmpty()) {
stream->writePackedUInt(id);
@@ -61,14 +52,9 @@ static void write_uint(SkWStream* stream, size_t n, uint32_t id) {
bool SkFontDescriptor::Deserialize(SkStream* stream, SkFontDescriptor* result) {
size_t styleBits = stream->readPackedUInt();
- if (styleBits <= 2) {
- // Remove this branch when MIN_PICTURE_VERSION > 45
- result->fStyle = SkFontStyle::FromOldStyle(styleBits);
- } else {
- result->fStyle = SkFontStyle((styleBits >> 16) & 0xFFFF,
- (styleBits >> 8 ) & 0xFF,
- static_cast<SkFontStyle::Slant>(styleBits & 0xFF));
- }
+ result->fStyle = SkFontStyle((styleBits >> 16) & 0xFFFF,
+ (styleBits >> 8 ) & 0xFF,
+ static_cast<SkFontStyle::Slant>(styleBits & 0xFF));
SkAutoSTMalloc<4, SkFixed> axis;
size_t axisCount = 0;
@@ -94,9 +80,6 @@ bool SkFontDescriptor::Deserialize(SkStream* stream, SkFontDescriptor* result) {
case kFontIndex:
index = read_uint(stream);
break;
- case kFontFileName: // Remove when MIN_PICTURE_VERSION > 41
- skip_string(stream);
- break;
default:
SkDEBUGFAIL("Unknown id used by a font descriptor");
return false;
diff --git a/src/core/SkFontStyle.cpp b/src/core/SkFontStyle.cpp
deleted file mode 100644
index 996d383402..0000000000
--- a/src/core/SkFontStyle.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkFontStyle.h"
-#include "SkTypeface.h"
-#include "SkTypes.h"
-
-/*static*/SkFontStyle SkFontStyle::FromOldStyle(unsigned oldStyle) {
- return SkFontStyle((oldStyle & SkTypeface::kBold) ? SkFontStyle::kBold_Weight
- : SkFontStyle::kNormal_Weight,
- SkFontStyle::kNormal_Width,
- (oldStyle & SkTypeface::kItalic) ? SkFontStyle::kItalic_Slant
- : SkFontStyle::kUpright_Slant);
-}
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index a41e6b55fb..fe26c0f776 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1869,7 +1869,7 @@ void SkPaint::flatten(SkWriteBuffer& buffer) const {
// since the other process may have a different notion of default.
SkTypeface* tf = this->getTypeface();
if (!tf && buffer.isCrossProcess()) {
- tf = SkTypeface::GetDefaultTypeface(SkTypeface::kNormal);
+ tf = SkTypeface::GetDefaultTypeface();
}
uint8_t flatFlags = 0;
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index 0c8c4b96ae..d5ed70a5b5 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -86,6 +86,14 @@ protected:
}
+SkFontStyle SkTypeface::FromOldStyle(Style oldStyle) {
+ return SkFontStyle((oldStyle & SkTypeface::kBold) ? SkFontStyle::kBold_Weight
+ : SkFontStyle::kNormal_Weight,
+ SkFontStyle::kNormal_Width,
+ (oldStyle & SkTypeface::kItalic) ? SkFontStyle::kItalic_Slant
+ : SkFontStyle::kUpright_Slant);
+}
+
SkTypeface* SkTypeface::GetDefaultTypeface(Style style) {
static SkOnce once[4];
static sk_sp<SkTypeface> defaults[4];
@@ -93,14 +101,14 @@ SkTypeface* SkTypeface::GetDefaultTypeface(Style style) {
SkASSERT((int)style < 4);
once[style]([style] {
sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault());
- auto t = fm->legacyMakeTypeface(nullptr, SkFontStyle::FromOldStyle(style));
+ auto t = fm->legacyMakeTypeface(nullptr, FromOldStyle(style));
defaults[style] = t ? t : SkEmptyTypeface::Make();
});
return defaults[style].get();
}
sk_sp<SkTypeface> SkTypeface::MakeDefault() {
- return sk_ref_sp(GetDefaultTypeface(SkTypeface::kNormal));
+ return sk_ref_sp(GetDefaultTypeface());
}
uint32_t SkTypeface::UniqueID(const SkTypeface* face) {