2008-12-17 15:59:43 +00:00
|
|
|
/*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Copyright 2006 The Android Open Source Project
|
2008-12-17 15:59:43 +00:00
|
|
|
*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
2008-12-17 15:59:43 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SkScalerContext_DEFINED
|
|
|
|
#define SkScalerContext_DEFINED
|
|
|
|
|
|
|
|
#include "SkMask.h"
|
2012-07-30 20:40:50 +00:00
|
|
|
#include "SkMaskGamma.h"
|
2008-12-17 15:59:43 +00:00
|
|
|
#include "SkMatrix.h"
|
|
|
|
#include "SkPaint.h"
|
2013-03-19 16:06:52 +00:00
|
|
|
#include "SkTypeface.h"
|
2012-07-24 21:18:54 +00:00
|
|
|
|
2015-02-25 14:47:06 +00:00
|
|
|
class SkGlyph;
|
2008-12-17 15:59:43 +00:00
|
|
|
class SkDescriptor;
|
|
|
|
class SkMaskFilter;
|
|
|
|
class SkPathEffect;
|
|
|
|
class SkRasterizer;
|
|
|
|
|
2016-04-12 13:47:05 +00:00
|
|
|
struct SkScalerContextEffects {
|
|
|
|
SkScalerContextEffects() : fPathEffect(nullptr), fMaskFilter(nullptr), fRasterizer(nullptr) {}
|
|
|
|
SkScalerContextEffects(SkPathEffect* pe, SkMaskFilter* mf, SkRasterizer* ra)
|
|
|
|
: fPathEffect(pe), fMaskFilter(mf), fRasterizer(ra) {}
|
|
|
|
|
|
|
|
SkPathEffect* fPathEffect;
|
|
|
|
SkMaskFilter* fMaskFilter;
|
|
|
|
SkRasterizer* fRasterizer;
|
|
|
|
};
|
|
|
|
|
2016-02-29 19:22:55 +00:00
|
|
|
enum SkAxisAlignment {
|
|
|
|
kNone_SkAxisAlignment,
|
|
|
|
kX_SkAxisAlignment,
|
|
|
|
kY_SkAxisAlignment
|
|
|
|
};
|
|
|
|
|
2012-08-14 19:13:55 +00:00
|
|
|
/*
|
|
|
|
* To allow this to be forward-declared, it must be its own typename, rather
|
|
|
|
* than a nested struct inside SkScalerContext (where it started).
|
|
|
|
*/
|
|
|
|
struct SkScalerContextRec {
|
|
|
|
uint32_t fFontID;
|
|
|
|
SkScalar fTextSize, fPreScaleX, fPreSkewX;
|
|
|
|
SkScalar fPost2x2[2][2];
|
|
|
|
SkScalar fFrameWidth, fMiterLimit;
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2012-08-14 19:13:55 +00:00
|
|
|
//These describe the parameters to create (uniquely identify) the pre-blend.
|
|
|
|
uint32_t fLumBits;
|
|
|
|
uint8_t fDeviceGamma; //2.6, (0.0, 4.0) gamma, 0.0 for sRGB
|
|
|
|
uint8_t fPaintGamma; //2.6, (0.0, 4.0) gamma, 0.0 for sRGB
|
|
|
|
uint8_t fContrast; //0.8+1, [0.0, 1.0] artificial contrast
|
|
|
|
uint8_t fReservedAlign;
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2012-08-14 19:13:55 +00:00
|
|
|
SkScalar getDeviceGamma() const {
|
|
|
|
return SkIntToScalar(fDeviceGamma) / (1 << 6);
|
|
|
|
}
|
|
|
|
void setDeviceGamma(SkScalar dg) {
|
|
|
|
SkASSERT(0 <= dg && dg < SkIntToScalar(4));
|
|
|
|
fDeviceGamma = SkScalarFloorToInt(dg * (1 << 6));
|
|
|
|
}
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2012-08-14 19:13:55 +00:00
|
|
|
SkScalar getPaintGamma() const {
|
|
|
|
return SkIntToScalar(fPaintGamma) / (1 << 6);
|
|
|
|
}
|
|
|
|
void setPaintGamma(SkScalar pg) {
|
|
|
|
SkASSERT(0 <= pg && pg < SkIntToScalar(4));
|
|
|
|
fPaintGamma = SkScalarFloorToInt(pg * (1 << 6));
|
|
|
|
}
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2012-08-14 19:13:55 +00:00
|
|
|
SkScalar getContrast() const {
|
|
|
|
return SkIntToScalar(fContrast) / ((1 << 8) - 1);
|
|
|
|
}
|
|
|
|
void setContrast(SkScalar c) {
|
|
|
|
SkASSERT(0 <= c && c <= SK_Scalar1);
|
|
|
|
fContrast = SkScalarRoundToInt(c * ((1 << 8) - 1));
|
|
|
|
}
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2012-08-14 19:13:55 +00:00
|
|
|
/**
|
2016-04-08 13:47:54 +00:00
|
|
|
* Causes the luminance color to be ignored, and the paint and device
|
|
|
|
* gamma to be effectively 1.0
|
2012-08-14 19:13:55 +00:00
|
|
|
*/
|
2016-04-08 13:47:54 +00:00
|
|
|
void ignoreGamma() {
|
2012-12-06 21:47:40 +00:00
|
|
|
setLuminanceColor(SK_ColorTRANSPARENT);
|
2012-08-14 19:13:55 +00:00
|
|
|
setPaintGamma(SK_Scalar1);
|
|
|
|
setDeviceGamma(SK_Scalar1);
|
2016-04-08 13:47:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Causes the luminance color and contrast to be ignored, and the
|
|
|
|
* paint and device gamma to be effectively 1.0.
|
|
|
|
*/
|
|
|
|
void ignorePreBlend() {
|
|
|
|
ignoreGamma();
|
2012-08-14 19:13:55 +00:00
|
|
|
setContrast(0);
|
|
|
|
}
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2012-08-14 19:13:55 +00:00
|
|
|
uint8_t fMaskFormat;
|
2016-03-16 14:34:02 +00:00
|
|
|
uint8_t fStrokeJoin : 4;
|
|
|
|
uint8_t fStrokeCap : 4;
|
2012-08-14 19:13:55 +00:00
|
|
|
uint16_t fFlags;
|
|
|
|
// Warning: when adding members note that the size of this structure
|
|
|
|
// must be a multiple of 4. SkDescriptor requires that its arguments be
|
|
|
|
// multiples of four and this structure is put in an SkDescriptor in
|
|
|
|
// SkPaint::MakeRec.
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2012-08-14 19:13:55 +00:00
|
|
|
void getMatrixFrom2x2(SkMatrix*) const;
|
|
|
|
void getLocalMatrix(SkMatrix*) const;
|
|
|
|
void getSingleMatrix(SkMatrix*) const;
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2014-12-05 20:26:44 +00:00
|
|
|
/** The kind of scale which will be applied by the underlying port (pre-matrix). */
|
|
|
|
enum PreMatrixScale {
|
|
|
|
kFull_PreMatrixScale, // The underlying port can apply both x and y scale.
|
|
|
|
kVertical_PreMatrixScale, // The underlying port can only apply a y scale.
|
|
|
|
kVerticalInteger_PreMatrixScale // The underlying port can only apply an integer y scale.
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* Compute useful matrices for use with sizing in underlying libraries.
|
|
|
|
*
|
|
|
|
* There are two kinds of text size, a 'requested/logical size' which is like asking for size
|
|
|
|
* '12' and a 'real' size which is the size after the matrix is applied. The matrices produced
|
|
|
|
* by this method are based on the 'real' size. This method effectively finds the total device
|
|
|
|
* matrix and decomposes it in various ways.
|
|
|
|
*
|
|
|
|
* The most useful decomposition is into 'scale' and 'remaining'. The 'scale' is applied first
|
|
|
|
* and then the 'remaining' to fully apply the total matrix. This decomposition is useful when
|
|
|
|
* the text size ('scale') may have meaning apart from the total matrix. This is true when
|
|
|
|
* hinting, and sometimes true for other properties as well.
|
|
|
|
*
|
|
|
|
* The second (optional) decomposition is of 'remaining' into a non-rotational part
|
|
|
|
* 'remainingWithoutRotation' and a rotational part 'remainingRotation'. The 'scale' is applied
|
|
|
|
* first, then 'remainingWithoutRotation', then 'remainingRotation' to fully apply the total
|
|
|
|
* matrix. This decomposition is helpful when only horizontal metrics can be trusted, so the
|
|
|
|
* 'scale' and 'remainingWithoutRotation' will be handled by the underlying library, but
|
|
|
|
* the final rotation 'remainingRotation' will be handled manually.
|
|
|
|
*
|
|
|
|
* The 'total' matrix is also (optionally) available. This is useful in cases where the
|
|
|
|
* underlying library will not be used, often when working directly with font data.
|
|
|
|
*
|
2015-08-27 14:41:13 +00:00
|
|
|
* The parameters 'scale' and 'remaining' are required, the other pointers may be nullptr.
|
2014-12-05 20:26:44 +00:00
|
|
|
*
|
|
|
|
* @param preMatrixScale the kind of scale to extract from the total matrix.
|
|
|
|
* @param scale the scale extracted from the total matrix (both values positive).
|
|
|
|
* @param remaining apply after scale to apply the total matrix.
|
|
|
|
* @param remainingWithoutRotation apply after scale to apply the total matrix sans rotation.
|
|
|
|
* @param remainingRotation apply after remainingWithoutRotation to apply the total matrix.
|
|
|
|
* @param total the total matrix.
|
2016-08-24 19:01:31 +00:00
|
|
|
* @return false if the matrix was singular. The output will be valid but not invertible.
|
2014-12-05 20:26:44 +00:00
|
|
|
*/
|
2016-08-23 20:19:01 +00:00
|
|
|
bool computeMatrices(PreMatrixScale preMatrixScale,
|
2014-12-05 20:26:44 +00:00
|
|
|
SkVector* scale, SkMatrix* remaining,
|
2015-08-27 14:41:13 +00:00
|
|
|
SkMatrix* remainingWithoutRotation = nullptr,
|
|
|
|
SkMatrix* remainingRotation = nullptr,
|
|
|
|
SkMatrix* total = nullptr);
|
2014-12-05 20:26:44 +00:00
|
|
|
|
2012-08-14 19:13:55 +00:00
|
|
|
inline SkPaint::Hinting getHinting() const;
|
|
|
|
inline void setHinting(SkPaint::Hinting);
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2012-08-14 19:13:55 +00:00
|
|
|
SkMask::Format getFormat() const {
|
|
|
|
return static_cast<SkMask::Format>(fMaskFormat);
|
|
|
|
}
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2012-08-14 19:13:55 +00:00
|
|
|
SkColor getLuminanceColor() const {
|
|
|
|
return fLumBits;
|
|
|
|
}
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2012-08-14 19:13:55 +00:00
|
|
|
void setLuminanceColor(SkColor c) {
|
|
|
|
fLumBits = c;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-07-30 20:40:50 +00:00
|
|
|
//The following typedef hides from the rest of the implementation the number of
|
|
|
|
//most significant bits to consider when creating mask gamma tables. Two bits
|
|
|
|
//per channel was chosen as a balance between fidelity (more bits) and cache
|
2012-08-24 17:46:11 +00:00
|
|
|
//sizes (fewer bits). Three bits per channel was chosen when #303942; (used by
|
|
|
|
//the Chrome UI) turned out too green.
|
|
|
|
typedef SkTMaskGamma<3, 3, 3> SkMaskGamma;
|
2012-07-30 20:40:50 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
class SkScalerContext {
|
|
|
|
public:
|
2012-08-14 19:13:55 +00:00
|
|
|
typedef SkScalerContextRec Rec;
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
enum Flags {
|
2011-11-21 19:32:29 +00:00
|
|
|
kFrameAndFill_Flag = 0x0001,
|
|
|
|
kDevKernText_Flag = 0x0002,
|
|
|
|
kEmbeddedBitmapText_Flag = 0x0004,
|
|
|
|
kEmbolden_Flag = 0x0008,
|
|
|
|
kSubpixelPositioning_Flag = 0x0010,
|
2014-01-23 19:01:36 +00:00
|
|
|
kForceAutohinting_Flag = 0x0020, // Use auto instead of bytcode hinting if hinting.
|
2011-11-21 19:32:29 +00:00
|
|
|
kVertical_Flag = 0x0040,
|
2011-11-22 19:42:41 +00:00
|
|
|
|
2009-07-21 17:41:32 +00:00
|
|
|
// together, these two flags resulting in a two bit value which matches
|
|
|
|
// up with the SkPaint::Hinting enum.
|
2011-11-22 19:42:41 +00:00
|
|
|
kHinting_Shift = 7, // to shift into the other flags above
|
2011-11-21 19:32:29 +00:00
|
|
|
kHintingBit1_Flag = 0x0080,
|
|
|
|
kHintingBit2_Flag = 0x0100,
|
2011-11-22 19:42:41 +00:00
|
|
|
|
2013-07-27 20:37:56 +00:00
|
|
|
// Pixel geometry information.
|
2014-11-13 22:39:58 +00:00
|
|
|
// only meaningful if fMaskFormat is kLCD16
|
2011-11-21 19:32:29 +00:00
|
|
|
kLCD_Vertical_Flag = 0x0200, // else Horizontal
|
|
|
|
kLCD_BGROrder_Flag = 0x0400, // else RGB order
|
2011-11-22 19:42:41 +00:00
|
|
|
|
2013-07-27 20:37:56 +00:00
|
|
|
// Generate A8 from LCD source (for GDI and CoreGraphics).
|
|
|
|
// only meaningful if fMaskFormat is kA8
|
|
|
|
kGenA8FromLCD_Flag = 0x0800, // could be 0x200 (bit meaning dependent on fMaskFormat)
|
2008-12-17 15:59:43 +00:00
|
|
|
};
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2011-11-22 19:42:41 +00:00
|
|
|
// computed values
|
2009-07-27 16:39:38 +00:00
|
|
|
enum {
|
2011-11-22 19:42:41 +00:00
|
|
|
kHinting_Mask = kHintingBit1_Flag | kHintingBit2_Flag,
|
2009-07-27 16:39:38 +00:00
|
|
|
};
|
2011-11-22 19:42:41 +00:00
|
|
|
|
2016-04-12 13:47:05 +00:00
|
|
|
SkScalerContext(SkTypeface*, const SkScalerContextEffects&, const SkDescriptor*);
|
2008-12-17 15:59:43 +00:00
|
|
|
virtual ~SkScalerContext();
|
|
|
|
|
2013-03-19 16:06:52 +00:00
|
|
|
SkTypeface* getTypeface() const { return fTypeface.get(); }
|
|
|
|
|
2011-03-15 15:40:16 +00:00
|
|
|
SkMask::Format getMaskFormat() const {
|
|
|
|
return (SkMask::Format)fRec.fMaskFormat;
|
|
|
|
}
|
|
|
|
|
2012-01-03 19:43:20 +00:00
|
|
|
bool isSubpixel() const {
|
|
|
|
return SkToBool(fRec.fFlags & kSubpixelPositioning_Flag);
|
|
|
|
}
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2014-07-07 15:16:37 +00:00
|
|
|
bool isVertical() const {
|
|
|
|
return SkToBool(fRec.fFlags & kVertical_Flag);
|
|
|
|
}
|
|
|
|
|
2009-03-17 17:59:53 +00:00
|
|
|
/** Return the corresponding glyph for the specified unichar. Since contexts
|
|
|
|
may be chained (under the hood), the glyphID that is returned may in
|
|
|
|
fact correspond to a different font/context. In that case, we use the
|
|
|
|
base-glyph-count to know how to translate back into local glyph space.
|
|
|
|
*/
|
2014-08-06 13:58:06 +00:00
|
|
|
uint16_t charToGlyphID(SkUnichar uni) {
|
|
|
|
return generateCharToGlyph(uni);
|
|
|
|
}
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2010-01-08 14:07:42 +00:00
|
|
|
/** Map the glyphID to its glyph index, and then to its char code. Unmapped
|
|
|
|
glyphs return zero.
|
|
|
|
*/
|
2014-08-06 13:58:06 +00:00
|
|
|
SkUnichar glyphIDToChar(uint16_t glyphID) {
|
|
|
|
return (glyphID < getGlyphCount()) ? generateGlyphToChar(glyphID) : 0;
|
|
|
|
}
|
2010-01-08 14:07:42 +00:00
|
|
|
|
2011-03-04 19:04:57 +00:00
|
|
|
unsigned getGlyphCount() { return this->generateGlyphCount(); }
|
2008-12-17 15:59:43 +00:00
|
|
|
void getAdvance(SkGlyph*);
|
|
|
|
void getMetrics(SkGlyph*);
|
|
|
|
void getImage(const SkGlyph&);
|
|
|
|
void getPath(const SkGlyph&, SkPath*);
|
2013-05-08 14:19:08 +00:00
|
|
|
void getFontMetrics(SkPaint::FontMetrics*);
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2014-06-10 13:42:56 +00:00
|
|
|
/** Return the size in bytes of the associated gamma lookup table
|
|
|
|
*/
|
|
|
|
static size_t GetGammaLUTSize(SkScalar contrast, SkScalar paintGamma, SkScalar deviceGamma,
|
|
|
|
int* width, int* height);
|
|
|
|
|
|
|
|
/** Get the associated gamma lookup table. The 'data' pointer must point to pre-allocated
|
|
|
|
memory, with size in bytes greater than or equal to the return value of getGammaLUTSize().
|
|
|
|
*/
|
|
|
|
static void GetGammaLUTData(SkScalar contrast, SkScalar paintGamma, SkScalar deviceGamma,
|
|
|
|
void* data);
|
|
|
|
|
2015-06-19 18:49:52 +00:00
|
|
|
static void MakeRec(const SkPaint&, const SkSurfaceProps* surfaceProps,
|
2014-04-08 20:14:32 +00:00
|
|
|
const SkMatrix*, Rec* rec);
|
2012-07-30 20:40:50 +00:00
|
|
|
static inline void PostMakeRec(const SkPaint&, Rec*);
|
2012-03-01 22:32:51 +00:00
|
|
|
|
2012-07-30 20:40:50 +00:00
|
|
|
static SkMaskGamma::PreBlend GetMaskPreBlend(const Rec& rec);
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2015-01-28 21:28:53 +00:00
|
|
|
const Rec& getRec() const { return fRec; }
|
|
|
|
|
2016-04-12 13:47:05 +00:00
|
|
|
SkScalerContextEffects getEffects() const {
|
|
|
|
return { fPathEffect.get(), fMaskFilter.get(), fRasterizer.get() };
|
|
|
|
}
|
|
|
|
|
2016-02-29 19:22:55 +00:00
|
|
|
/**
|
|
|
|
* Return the axis (if any) that the baseline for horizontal text should land on.
|
|
|
|
* As an example, the identity matrix will return kX_SkAxisAlignment
|
|
|
|
*/
|
|
|
|
SkAxisAlignment computeAxisAlignmentForHText();
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
protected:
|
|
|
|
Rec fRec;
|
|
|
|
|
2013-12-02 13:50:38 +00:00
|
|
|
/** Generates the contents of glyph.fAdvanceX and glyph.fAdvanceY.
|
|
|
|
* May call getMetrics if that would be just as fast.
|
|
|
|
*/
|
|
|
|
virtual void generateAdvance(SkGlyph* glyph) = 0;
|
|
|
|
|
|
|
|
/** Generates the contents of glyph.fWidth, fHeight, fTop, fLeft,
|
|
|
|
* as well as fAdvanceX and fAdvanceY if not already set.
|
|
|
|
*
|
|
|
|
* TODO: fMaskFormat is set by getMetrics later; cannot be set here.
|
|
|
|
*/
|
|
|
|
virtual void generateMetrics(SkGlyph* glyph) = 0;
|
|
|
|
|
|
|
|
/** Generates the contents of glyph.fImage.
|
|
|
|
* When called, glyph.fImage will be pointing to a pre-allocated,
|
|
|
|
* uninitialized region of memory of size glyph.computeImageSize().
|
|
|
|
* This method may change glyph.fMaskFormat if the new image size is
|
|
|
|
* less than or equal to the old image size.
|
|
|
|
*
|
|
|
|
* Because glyph.computeImageSize() will determine the size of fImage,
|
|
|
|
* generateMetrics will be called before generateImage.
|
|
|
|
*/
|
|
|
|
virtual void generateImage(const SkGlyph& glyph) = 0;
|
|
|
|
|
|
|
|
/** Sets the passed path to the glyph outline.
|
|
|
|
* If this cannot be done the path is set to empty;
|
|
|
|
* this is indistinguishable from a glyph with an empty path.
|
|
|
|
* This does not set glyph.fPath.
|
|
|
|
*
|
|
|
|
* TODO: path is always glyph.fPath, no reason to pass separately.
|
|
|
|
*/
|
|
|
|
virtual void generatePath(const SkGlyph& glyph, SkPath* path) = 0;
|
|
|
|
|
2014-07-07 15:16:37 +00:00
|
|
|
/** Retrieves font metrics. */
|
|
|
|
virtual void generateFontMetrics(SkPaint::FontMetrics*) = 0;
|
2013-12-02 13:50:38 +00:00
|
|
|
|
|
|
|
/** Returns the number of glyphs in the font. */
|
|
|
|
virtual unsigned generateGlyphCount() = 0;
|
|
|
|
|
|
|
|
/** Returns the glyph id for the given unichar.
|
|
|
|
* If there is no 1:1 mapping from the unichar to a glyph id, returns 0.
|
|
|
|
*/
|
|
|
|
virtual uint16_t generateCharToGlyph(SkUnichar unichar) = 0;
|
|
|
|
|
|
|
|
/** Returns the unichar for the given glyph id.
|
|
|
|
* If there is no 1:1 mapping from the glyph id to a unichar, returns 0.
|
|
|
|
* The default implementation always returns 0, indicating failure.
|
|
|
|
*/
|
|
|
|
virtual SkUnichar generateGlyphToChar(uint16_t glyphId);
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2011-08-05 21:40:26 +00:00
|
|
|
void forceGenerateImageFromPath() { fGenerateImageFromPath = true; }
|
2015-07-29 17:14:58 +00:00
|
|
|
void forceOffGenerateImageFromPath() { fGenerateImageFromPath = false; }
|
2011-08-05 21:40:26 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
private:
|
2015-07-31 18:45:22 +00:00
|
|
|
friend class SkRandomScalerContext; // For debug purposes
|
|
|
|
|
2013-03-19 16:06:52 +00:00
|
|
|
// never null
|
2016-04-12 13:47:05 +00:00
|
|
|
sk_sp<SkTypeface> fTypeface;
|
2013-03-20 07:01:02 +00:00
|
|
|
|
2016-04-12 13:47:05 +00:00
|
|
|
// optional objects, which may be null
|
|
|
|
sk_sp<SkPathEffect> fPathEffect;
|
|
|
|
sk_sp<SkMaskFilter> fMaskFilter;
|
|
|
|
sk_sp<SkRasterizer> fRasterizer;
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2011-08-05 21:40:26 +00:00
|
|
|
// if this is set, we draw the image from a path, rather than
|
|
|
|
// calling generateImage.
|
|
|
|
bool fGenerateImageFromPath;
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
void internalGetPath(const SkGlyph& glyph, SkPath* fillPath,
|
|
|
|
SkPath* devPath, SkMatrix* fillToDevMatrix);
|
|
|
|
|
2013-03-08 18:35:13 +00:00
|
|
|
// returns the right context from our link-list for this char. If no match
|
2015-08-27 14:41:13 +00:00
|
|
|
// is found it returns nullptr. If a match is found then the glyphID param is
|
2013-03-08 18:35:13 +00:00
|
|
|
// set to the glyphID that maps to the provided char.
|
|
|
|
SkScalerContext* getContextFromChar(SkUnichar uni, uint16_t* glyphID);
|
|
|
|
|
2012-10-26 19:35:54 +00:00
|
|
|
// SkMaskGamma::PreBlend converts linear masks to gamma correcting masks.
|
|
|
|
protected:
|
|
|
|
// Visible to subclasses so that generateImage can apply the pre-blend directly.
|
|
|
|
const SkMaskGamma::PreBlend fPreBlend;
|
|
|
|
private:
|
|
|
|
// When there is a filter, previous steps must create a linear mask
|
|
|
|
// and the pre-blend applied as a final step.
|
|
|
|
const SkMaskGamma::PreBlend fPreBlendForFilter;
|
2008-12-17 15:59:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define kRec_SkDescriptorTag SkSetFourByteTag('s', 'r', 'e', 'c')
|
|
|
|
#define kPathEffect_SkDescriptorTag SkSetFourByteTag('p', 't', 'h', 'e')
|
|
|
|
#define kMaskFilter_SkDescriptorTag SkSetFourByteTag('m', 's', 'k', 'f')
|
|
|
|
#define kRasterizer_SkDescriptorTag SkSetFourByteTag('r', 'a', 's', 't')
|
|
|
|
|
2011-08-23 21:30:47 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-08-14 19:13:55 +00:00
|
|
|
SkPaint::Hinting SkScalerContextRec::getHinting() const {
|
|
|
|
unsigned hint = (fFlags & SkScalerContext::kHinting_Mask) >>
|
|
|
|
SkScalerContext::kHinting_Shift;
|
|
|
|
return static_cast<SkPaint::Hinting>(hint);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SkScalerContextRec::setHinting(SkPaint::Hinting hinting) {
|
|
|
|
fFlags = (fFlags & ~SkScalerContext::kHinting_Mask) |
|
|
|
|
(hinting << SkScalerContext::kHinting_Shift);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
#endif
|