aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2017-11-01 11:47:39 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-01 17:51:20 +0000
commit3e45a2f48ed8dbf3a55e980c43d97d29afeb93a0 (patch)
tree88a3c6ad3bc329d8255cb8f0415bf746026a123a /src/core
parent89ab2406f7845b8e62fb8dd479e5fff5bf5ccf10 (diff)
Directly use SkScalerContextRec.
Some time ago SkScalerContext::Rec was made SkScalerContextRec so that it could be forward declared. However, SkScalerContext::Rec remains as a typedef to SkScalerContextRec. This removes the typedef and updates the users to use the SkScalerContextRec type directly. This change was prompted by my own confusion when looking at some code which mixed these two, by IntelliSense's confusion when declaring an argument with one and defining with the other, and reducing the general proliferation of nested 'Rec' types in Skia. Change-Id: I3a23a4bdd83a591807c78cea6aa7a0117544b614 Reviewed-on: https://skia-review.googlesource.com/66153 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkDescriptor.h4
-rw-r--r--src/core/SkGlyphCache.cpp2
-rw-r--r--src/core/SkPaint.cpp18
-rw-r--r--src/core/SkScalerContext.cpp2
-rw-r--r--src/core/SkScalerContext.h12
-rw-r--r--src/core/SkTypeface.cpp2
6 files changed, 19 insertions, 21 deletions
diff --git a/src/core/SkDescriptor.h b/src/core/SkDescriptor.h
index 0e91c3c2cf..164489049d 100644
--- a/src/core/SkDescriptor.h
+++ b/src/core/SkDescriptor.h
@@ -162,8 +162,8 @@ private:
enum {
kStorageSize = sizeof(SkDescriptor)
- + sizeof(SkDescriptor::Entry) + sizeof(SkScalerContext::Rec) // for rec
- + sizeof(SkDescriptor::Entry) + sizeof(void*) // for typeface
+ + sizeof(SkDescriptor::Entry) + sizeof(SkScalerContextRec) // for rec
+ + sizeof(SkDescriptor::Entry) + sizeof(void*) // for typeface
+ 32 // slop for occational small extras
};
SkDescriptor* fDesc;
diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp
index de2432e558..9ddf70cc4d 100644
--- a/src/core/SkGlyphCache.cpp
+++ b/src/core/SkGlyphCache.cpp
@@ -491,7 +491,7 @@ SkGlyphCache* SkGlyphCache::VisitCache(SkTypeface* typeface,
// Precondition: the typeface id must be the fFontID in the descriptor
SkDEBUGCODE(
uint32_t length = 0;
- const SkScalerContext::Rec* rec = static_cast<const SkScalerContext::Rec*>(
+ const SkScalerContextRec* rec = static_cast<const SkScalerContextRec*>(
desc->findEntry(kRec_SkDescriptorTag, &length));
SkASSERT(rec);
SkASSERT(length == sizeof(*rec));
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index fe26c0f776..751bcedcf6 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1289,7 +1289,7 @@ SkColor SkPaint::computeLuminanceColor() const {
const SkScalar gMaxSize2ForLCDText = SK_MAX_SIZE_FOR_LCDTEXT * SK_MAX_SIZE_FOR_LCDTEXT;
-static bool too_big_for_lcd(const SkScalerContext::Rec& rec, bool checkPost2x2) {
+static bool too_big_for_lcd(const SkScalerContextRec& rec, bool checkPost2x2) {
if (checkPost2x2) {
SkScalar area = rec.fPost2x2[0][0] * rec.fPost2x2[1][1] -
rec.fPost2x2[1][0] * rec.fPost2x2[0][1];
@@ -1313,7 +1313,7 @@ static SkScalar sk_relax(SkScalar x) {
void SkScalerContext::MakeRec(const SkPaint& paint,
const SkSurfaceProps* surfaceProps,
const SkMatrix* deviceMatrix,
- Rec* rec) {
+ SkScalerContextRec* rec) {
SkASSERT(deviceMatrix == nullptr || !deviceMatrix->hasPerspective());
SkTypeface* typeface = paint.getTypeface();
@@ -1515,7 +1515,7 @@ static const SkMaskGamma& cachedMaskGamma(SkScalar contrast, SkScalar paintGamma
/**
* We ensure that the rec is self-consistent and efficient (where possible)
*/
-void SkScalerContext::PostMakeRec(const SkPaint&, SkScalerContext::Rec* rec) {
+void SkScalerContext::PostMakeRec(const SkPaint&, SkScalerContextRec* rec) {
/**
* If we're asking for A8, we force the colorlum to be gray, since that
* limits the number of unique entries, and the scaler will only look at
@@ -1553,7 +1553,7 @@ void SkScalerContext::PostMakeRec(const SkPaint&, SkScalerContext::Rec* rec) {
#define TEST_DESC
#endif
-static void write_out_descriptor(SkDescriptor* desc, const SkScalerContext::Rec& rec,
+static void write_out_descriptor(SkDescriptor* desc, const SkScalerContextRec& rec,
const SkPathEffect* pe, SkBinaryWriteBuffer* peBuffer,
const SkMaskFilter* mf, SkBinaryWriteBuffer* mfBuffer,
const SkRasterizer* ra, SkBinaryWriteBuffer* raBuffer,
@@ -1574,7 +1574,7 @@ static void write_out_descriptor(SkDescriptor* desc, const SkScalerContext::Rec&
desc->computeChecksum();
}
-static size_t fill_out_rec(const SkPaint& paint, SkScalerContext::Rec* rec,
+static size_t fill_out_rec(const SkPaint& paint, SkScalerContextRec* rec,
const SkSurfaceProps* surfaceProps,
bool fakeGamma, bool boostContrast,
const SkMatrix* deviceMatrix,
@@ -1626,7 +1626,7 @@ static size_t fill_out_rec(const SkPaint& paint, SkScalerContext::Rec* rec,
}
#ifdef TEST_DESC
-static void test_desc(const SkScalerContext::Rec& rec,
+static void test_desc(const SkScalerContextRec& rec,
const SkPathEffect* pe, SkBinaryWriteBuffer* peBuffer,
const SkMaskFilter* mf, SkBinaryWriteBuffer* mfBuffer,
const SkRasterizer* ra, SkBinaryWriteBuffer* raBuffer,
@@ -1678,7 +1678,7 @@ void SkPaint::getScalerContextDescriptor(SkScalerContextEffects* effects,
const SkSurfaceProps& surfaceProps,
uint32_t scalerContextFlags,
const SkMatrix* deviceMatrix) const {
- SkScalerContext::Rec rec;
+ SkScalerContextRec rec;
SkPathEffect* pe = this->getPathEffect();
SkMaskFilter* mf = this->getMaskFilter();
@@ -1717,7 +1717,7 @@ void SkPaint::descriptorProc(const SkSurfaceProps* surfaceProps,
void (*proc)(SkTypeface*, const SkScalerContextEffects&,
const SkDescriptor*, void*),
void* context) const {
- SkScalerContext::Rec rec;
+ SkScalerContextRec rec;
SkPathEffect* pe = this->getPathEffect();
SkMaskFilter* mf = this->getMaskFilter();
@@ -1755,7 +1755,7 @@ SkGlyphCache* SkPaint::detachCache(const SkSurfaceProps* surfaceProps,
* Expands fDeviceGamma, fPaintGamma, fContrast, and fLumBits into a mask pre-blend.
*/
//static
-SkMaskGamma::PreBlend SkScalerContext::GetMaskPreBlend(const SkScalerContext::Rec& rec) {
+SkMaskGamma::PreBlend SkScalerContext::GetMaskPreBlend(const SkScalerContextRec& rec) {
SkAutoMutexAcquire ama(gMaskGammaCacheMutex);
const SkMaskGamma& maskGamma = cachedMaskGamma(rec.getContrast(),
rec.getPaintGamma(),
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index 460907f164..30b66e6b07 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -67,7 +67,7 @@ void SkGlyph::zeroMetrics() {
SkScalerContext::SkScalerContext(sk_sp<SkTypeface> typeface, const SkScalerContextEffects& effects,
const SkDescriptor* desc)
- : fRec(*static_cast<const Rec*>(desc->findEntry(kRec_SkDescriptorTag, nullptr)))
+ : fRec(*static_cast<const SkScalerContextRec*>(desc->findEntry(kRec_SkDescriptorTag, nullptr)))
, fTypeface(std::move(typeface))
, fPathEffect(sk_ref_sp(effects.fPathEffect))
diff --git a/src/core/SkScalerContext.h b/src/core/SkScalerContext.h
index 6f220fe1c0..dc5bac0a29 100644
--- a/src/core/SkScalerContext.h
+++ b/src/core/SkScalerContext.h
@@ -179,8 +179,6 @@ typedef SkTMaskGamma<3, 3, 3> SkMaskGamma;
class SkScalerContext {
public:
- typedef SkScalerContextRec Rec;
-
enum Flags {
kFrameAndFill_Flag = 0x0001,
kDevKernText_Flag = 0x0002,
@@ -265,12 +263,12 @@ public:
uint8_t* data);
static void MakeRec(const SkPaint&, const SkSurfaceProps* surfaceProps,
- const SkMatrix*, Rec* rec);
- static inline void PostMakeRec(const SkPaint&, Rec*);
+ const SkMatrix*, SkScalerContextRec* rec);
+ static inline void PostMakeRec(const SkPaint&, SkScalerContextRec*);
- static SkMaskGamma::PreBlend GetMaskPreBlend(const Rec& rec);
+ static SkMaskGamma::PreBlend GetMaskPreBlend(const SkScalerContextRec& rec);
- const Rec& getRec() const { return fRec; }
+ const SkScalerContextRec& getRec() const { return fRec; }
SkScalerContextEffects getEffects() const {
return { fPathEffect.get(), fMaskFilter.get(), fRasterizer.get() };
@@ -283,7 +281,7 @@ public:
SkAxisAlignment computeAxisAlignmentForHText();
protected:
- Rec fRec;
+ SkScalerContextRec fRec;
/** Generates the contents of glyph.fAdvanceX and glyph.fAdvanceY.
* May call getMetrics if that would be just as fast.
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index d5ed70a5b5..046dcb869f 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -339,7 +339,7 @@ bool SkTypeface::onComputeBounds(SkRect* bounds) const {
paint.setTextSize(textSize);
paint.setLinearText(true);
- SkScalerContext::Rec rec;
+ SkScalerContextRec rec;
SkScalerContext::MakeRec(paint, nullptr, nullptr, &rec);
SkAutoDescriptor ad(sizeof(rec) + SkDescriptor::ComputeOverhead(1));