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>
diff --git a/src/core/SkDescriptor.h b/src/core/SkDescriptor.h
index 0e91c3c..1644890 100644
--- a/src/core/SkDescriptor.h
+++ b/src/core/SkDescriptor.h
@@ -162,8 +162,8 @@
 
     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 de2432e..9ddf70c 100644
--- a/src/core/SkGlyphCache.cpp
+++ b/src/core/SkGlyphCache.cpp
@@ -491,7 +491,7 @@
     // 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 fe26c0f..751bced 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1289,7 +1289,7 @@
 
 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 @@
 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 @@
 /**
  *  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 @@
     #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 @@
     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 @@
 }
 
 #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 @@
                                          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 (*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 @@
  * 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 460907f..30b66e6 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -67,7 +67,7 @@
 
 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 6f220fe..dc5bac0 100644
--- a/src/core/SkScalerContext.h
+++ b/src/core/SkScalerContext.h
@@ -179,8 +179,6 @@
 
 class SkScalerContext {
 public:
-    typedef SkScalerContextRec Rec;
-
     enum Flags {
         kFrameAndFill_Flag        = 0x0001,
         kDevKernText_Flag         = 0x0002,
@@ -265,12 +263,12 @@
                                   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 @@
     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 d5ed70a..046dcb8 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -339,7 +339,7 @@
     paint.setTextSize(textSize);
     paint.setLinearText(true);
 
-    SkScalerContext::Rec rec;
+    SkScalerContextRec rec;
     SkScalerContext::MakeRec(paint, nullptr, nullptr, &rec);
 
     SkAutoDescriptor ad(sizeof(rec) + SkDescriptor::ComputeOverhead(1));
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index 3e8f837..77b27c0 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -75,7 +75,7 @@
 //#define SK_FONTHOST_FREETYPE_RUNTIME_VERSION
 //#define SK_GAMMA_APPLY_TO_A8
 
-static bool isLCD(const SkScalerContext::Rec& rec) {
+static bool isLCD(const SkScalerContextRec& rec) {
     return SkMask::kLCD16_Format == rec.fMaskFormat;
 }
 
@@ -633,7 +633,7 @@
 }
 
 // returns false if there is any non-90-rotation or skew
-static bool isAxisAligned(const SkScalerContext::Rec& rec) {
+static bool isAxisAligned(const SkScalerContextRec& rec) {
     return 0 == rec.fPreSkewX &&
            (bothZero(rec.fPost2x2[0][1], rec.fPost2x2[1][0]) ||
             bothZero(rec.fPost2x2[0][0], rec.fPost2x2[1][1]));
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index 2318414..3cf42fd 100644
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -59,7 +59,7 @@
 // for rotated text, regardless of GDI's notions.
 //#define SK_ENFORCE_ROTATED_TEXT_AA_ON_WINDOWS
 
-static bool isLCD(const SkScalerContext::Rec& rec) {
+static bool isLCD(const SkScalerContextRec& rec) {
     return SkMask::kLCD16_Format == rec.fMaskFormat;
 }
 
@@ -68,13 +68,13 @@
 }
 
 // returns false if there is any non-90-rotation or skew
-static bool isAxisAligned(const SkScalerContext::Rec& rec) {
+static bool isAxisAligned(const SkScalerContextRec& rec) {
     return 0 == rec.fPreSkewX &&
            (bothZero(rec.fPost2x2[0][1], rec.fPost2x2[1][0]) ||
             bothZero(rec.fPost2x2[0][0], rec.fPost2x2[1][1]));
 }
 
-static bool needToRenderWithSkia(const SkScalerContext::Rec& rec) {
+static bool needToRenderWithSkia(const SkScalerContextRec& rec) {
 #ifdef SK_ENFORCE_ROTATED_TEXT_AA_ON_WINDOWS
     // What we really want to catch is when GDI will ignore the AA request and give
     // us BW instead. Smallish rotated text is one heuristic, so this code is just
@@ -592,7 +592,7 @@
     return SkFixedToFloat(SkFIXEDToFixed(x));
 }
 
-static BYTE compute_quality(const SkScalerContext::Rec& rec) {
+static BYTE compute_quality(const SkScalerContextRec& rec) {
     switch (rec.fMaskFormat) {
         case SkMask::kBW_Format:
             return NONANTIALIASED_QUALITY;
diff --git a/src/ports/SkScalerContext_win_dw.cpp b/src/ports/SkScalerContext_win_dw.cpp
index 3b207c2..319f566 100644
--- a/src/ports/SkScalerContext_win_dw.cpp
+++ b/src/ports/SkScalerContext_win_dw.cpp
@@ -42,7 +42,7 @@
 
 typedef SkAutoSharedMutexShared Shared;
 
-static bool isLCD(const SkScalerContext::Rec& rec) {
+static bool isLCD(const SkScalerContextRec& rec) {
     return SkMask::kLCD16_Format == rec.fMaskFormat;
 }
 
@@ -197,7 +197,7 @@
 }
 
 // returns false if there is any non-90-rotation or skew
-static bool is_axis_aligned(const SkScalerContext::Rec& rec) {
+static bool is_axis_aligned(const SkScalerContextRec& rec) {
     return 0 == rec.fPreSkewX &&
            (both_zero(rec.fPost2x2[0][1], rec.fPost2x2[1][0]) ||
             both_zero(rec.fPost2x2[0][0], rec.fPost2x2[1][1]));
diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp
index fe20cc9..02f02d6 100644
--- a/src/ports/SkTypeface_win_dw.cpp
+++ b/src/ports/SkTypeface_win_dw.cpp
@@ -251,7 +251,7 @@
     return new SkScalerContext_DW(sk_ref_sp(const_cast<DWriteFontTypeface*>(this)), effects, desc);
 }
 
-void DWriteFontTypeface::onFilterRec(SkScalerContext::Rec* rec) const {
+void DWriteFontTypeface::onFilterRec(SkScalerContextRec* rec) const {
     if (rec->fFlags & SkScalerContext::kLCD_Vertical_Flag) {
         rec->fMaskFormat = SkMask::kA8_Format;
         rec->fFlags |= SkScalerContext::kGenA8FromLCD_Flag;