2011-07-28 14:26:00 +00:00
|
|
|
|
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
|
|
|
*/
|
|
|
|
|
2011-07-28 14:26:00 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
#ifndef SkScalerContext_DEFINED
|
|
|
|
#define SkScalerContext_DEFINED
|
|
|
|
|
|
|
|
#include "SkMask.h"
|
|
|
|
#include "SkMatrix.h"
|
|
|
|
#include "SkPaint.h"
|
|
|
|
#include "SkPath.h"
|
|
|
|
#include "SkPoint.h"
|
2012-06-01 12:52:26 +00:00
|
|
|
#include "SkTypeface.h"
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2012-02-10 22:01:45 +00:00
|
|
|
//#define SK_USE_COLOR_LUMINANCE
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
class SkDescriptor;
|
|
|
|
class SkMaskFilter;
|
|
|
|
class SkPathEffect;
|
|
|
|
class SkRasterizer;
|
|
|
|
|
|
|
|
// needs to be != to any valid SkMask::Format
|
2011-01-13 16:33:36 +00:00
|
|
|
#define MASK_FORMAT_UNKNOWN (0xFF)
|
|
|
|
#define MASK_FORMAT_JUST_ADVANCE MASK_FORMAT_UNKNOWN
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2010-10-18 23:29:36 +00:00
|
|
|
#define kMaxGlyphWidth (1<<13)
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
struct SkGlyph {
|
|
|
|
void* fImage;
|
|
|
|
SkPath* fPath;
|
|
|
|
SkFixed fAdvanceX, fAdvanceY;
|
|
|
|
|
|
|
|
uint32_t fID;
|
|
|
|
uint16_t fWidth, fHeight;
|
|
|
|
int16_t fTop, fLeft;
|
|
|
|
|
|
|
|
uint8_t fMaskFormat;
|
|
|
|
int8_t fRsbDelta, fLsbDelta; // used by auto-kerning
|
2010-12-20 18:26:13 +00:00
|
|
|
|
|
|
|
void init(uint32_t id) {
|
|
|
|
fID = id;
|
|
|
|
fImage = NULL;
|
|
|
|
fPath = NULL;
|
2011-01-13 16:33:36 +00:00
|
|
|
fMaskFormat = MASK_FORMAT_UNKNOWN;
|
2010-12-20 18:26:13 +00:00
|
|
|
}
|
|
|
|
|
2011-03-10 15:06:27 +00:00
|
|
|
/**
|
|
|
|
* Compute the rowbytes for the specified width and mask-format.
|
|
|
|
*/
|
|
|
|
static unsigned ComputeRowBytes(unsigned width, SkMask::Format format) {
|
|
|
|
unsigned rb = width;
|
|
|
|
if (SkMask::kBW_Format == format) {
|
2008-12-17 15:59:43 +00:00
|
|
|
rb = (rb + 7) >> 3;
|
2011-06-22 13:19:43 +00:00
|
|
|
} else if (SkMask::kARGB32_Format == format ||
|
|
|
|
SkMask::kLCD32_Format == format)
|
|
|
|
{
|
2010-12-20 18:26:13 +00:00
|
|
|
rb <<= 2;
|
2011-03-10 15:06:27 +00:00
|
|
|
} else if (SkMask::kLCD16_Format == format) {
|
|
|
|
rb = SkAlign4(rb << 1);
|
2008-12-17 15:59:43 +00:00
|
|
|
} else {
|
|
|
|
rb = SkAlign4(rb);
|
|
|
|
}
|
|
|
|
return rb;
|
|
|
|
}
|
2011-01-13 16:33:36 +00:00
|
|
|
|
2011-03-10 15:06:27 +00:00
|
|
|
unsigned rowBytes() const {
|
|
|
|
return ComputeRowBytes(fWidth, (SkMask::Format)fMaskFormat);
|
|
|
|
}
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
bool isJustAdvance() const {
|
|
|
|
return MASK_FORMAT_JUST_ADVANCE == fMaskFormat;
|
|
|
|
}
|
2011-01-13 16:33:36 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
bool isFullMetrics() const {
|
|
|
|
return MASK_FORMAT_JUST_ADVANCE != fMaskFormat;
|
|
|
|
}
|
2011-01-13 16:33:36 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
uint16_t getGlyphID() const {
|
|
|
|
return ID2Code(fID);
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned getGlyphID(unsigned baseGlyphCount) const {
|
|
|
|
unsigned code = ID2Code(fID);
|
|
|
|
SkASSERT(code >= baseGlyphCount);
|
|
|
|
return code - baseGlyphCount;
|
|
|
|
}
|
2011-01-13 16:33:36 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
unsigned getSubX() const {
|
|
|
|
return ID2SubX(fID);
|
|
|
|
}
|
2011-01-13 16:33:36 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
SkFixed getSubXFixed() const {
|
|
|
|
return SubToFixed(ID2SubX(fID));
|
|
|
|
}
|
2011-01-13 16:33:36 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
SkFixed getSubYFixed() const {
|
|
|
|
return SubToFixed(ID2SubY(fID));
|
|
|
|
}
|
2011-01-13 16:33:36 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
size_t computeImageSize() const;
|
2011-01-13 16:33:36 +00:00
|
|
|
|
2009-02-11 15:07:19 +00:00
|
|
|
/** Call this to set all of the metrics fields to 0 (e.g. if the scaler
|
|
|
|
encounters an error measuring a glyph). Note: this does not alter the
|
|
|
|
fImage, fPath, fID, fMaskFormat fields.
|
|
|
|
*/
|
|
|
|
void zeroMetrics();
|
2011-01-13 16:33:36 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
enum {
|
|
|
|
kSubBits = 2,
|
|
|
|
kSubMask = ((1 << kSubBits) - 1),
|
|
|
|
kSubShift = 24, // must be large enough for glyphs and unichars
|
|
|
|
kCodeMask = ((1 << kSubShift) - 1),
|
|
|
|
// relative offsets for X and Y subpixel bits
|
|
|
|
kSubShiftX = kSubBits,
|
|
|
|
kSubShiftY = 0
|
|
|
|
};
|
|
|
|
|
|
|
|
static unsigned ID2Code(uint32_t id) {
|
|
|
|
return id & kCodeMask;
|
|
|
|
}
|
2011-01-13 16:33:36 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
static unsigned ID2SubX(uint32_t id) {
|
|
|
|
return id >> (kSubShift + kSubShiftX);
|
|
|
|
}
|
2011-01-13 16:33:36 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
static unsigned ID2SubY(uint32_t id) {
|
|
|
|
return (id >> (kSubShift + kSubShiftY)) & kSubMask;
|
|
|
|
}
|
2011-01-13 16:33:36 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
static unsigned FixedToSub(SkFixed n) {
|
|
|
|
return (n >> (16 - kSubBits)) & kSubMask;
|
|
|
|
}
|
2011-01-13 16:33:36 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
static SkFixed SubToFixed(unsigned sub) {
|
|
|
|
SkASSERT(sub <= kSubMask);
|
|
|
|
return sub << (16 - kSubBits);
|
|
|
|
}
|
2011-01-13 16:33:36 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
static uint32_t MakeID(unsigned code) {
|
|
|
|
return code;
|
|
|
|
}
|
2011-01-13 16:33:36 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
static uint32_t MakeID(unsigned code, SkFixed x, SkFixed y) {
|
|
|
|
SkASSERT(code <= kCodeMask);
|
|
|
|
x = FixedToSub(x);
|
|
|
|
y = FixedToSub(y);
|
|
|
|
return (x << (kSubShift + kSubShiftX)) |
|
|
|
|
(y << (kSubShift + kSubShiftY)) |
|
|
|
|
code;
|
|
|
|
}
|
2011-01-13 16:33:36 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
void toMask(SkMask* mask) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SkScalerContext {
|
|
|
|
public:
|
|
|
|
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,
|
|
|
|
kAutohinting_Flag = 0x0020,
|
|
|
|
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
|
|
|
|
2011-06-27 16:44:46 +00:00
|
|
|
// these should only ever be set if fMaskFormat is LCD16 or LCD32
|
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
|
|
|
|
2012-01-18 17:06:35 +00:00
|
|
|
// Generate A8 from LCD source (for GDI), only meaningful if fMaskFormat is kA8
|
|
|
|
// Perhaps we can store this (instead) in fMaskFormat, in hight bit?
|
|
|
|
kGenA8FromLCD_Flag = 0x0800,
|
|
|
|
|
2012-02-10 22:01:45 +00:00
|
|
|
#ifdef SK_USE_COLOR_LUMINANCE
|
2012-06-01 13:15:47 +00:00
|
|
|
kLuminance_Bits = 3
|
2012-02-07 21:25:33 +00:00
|
|
|
#else
|
2011-11-22 19:42:41 +00:00
|
|
|
// luminance : 0 for black text, kLuminance_Max for white text
|
2012-01-18 17:06:35 +00:00
|
|
|
kLuminance_Shift = 13, // shift to land in the high 3-bits of Flags
|
2012-06-01 13:15:47 +00:00
|
|
|
kLuminance_Bits = 3 // ensure Flags doesn't exceed 16bits
|
2012-02-07 21:25:33 +00:00
|
|
|
#endif
|
2008-12-17 15:59:43 +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,
|
2012-02-10 22:01:45 +00:00
|
|
|
#ifdef SK_USE_COLOR_LUMINANCE
|
|
|
|
#else
|
2011-11-22 19:42:41 +00:00
|
|
|
kLuminance_Max = (1 << kLuminance_Bits) - 1,
|
2012-06-01 13:15:47 +00:00
|
|
|
kLuminance_Mask = kLuminance_Max << kLuminance_Shift
|
2012-02-07 21:25:33 +00:00
|
|
|
#endif
|
2009-07-27 16:39:38 +00:00
|
|
|
};
|
2011-11-22 19:42:41 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
struct Rec {
|
2011-06-13 13:01:10 +00:00
|
|
|
uint32_t fOrigFontID;
|
2008-12-17 15:59:43 +00:00
|
|
|
uint32_t fFontID;
|
|
|
|
SkScalar fTextSize, fPreScaleX, fPreSkewX;
|
|
|
|
SkScalar fPost2x2[2][2];
|
|
|
|
SkScalar fFrameWidth, fMiterLimit;
|
2012-02-10 22:01:45 +00:00
|
|
|
#ifdef SK_USE_COLOR_LUMINANCE
|
2012-02-07 21:25:33 +00:00
|
|
|
uint32_t fLumBits;
|
|
|
|
#endif
|
2008-12-17 15:59:43 +00:00
|
|
|
uint8_t fMaskFormat;
|
|
|
|
uint8_t fStrokeJoin;
|
2010-06-17 20:49:17 +00:00
|
|
|
uint16_t fFlags;
|
2010-01-04 23:56:43 +00:00
|
|
|
// 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.
|
2009-07-21 17:41:32 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
void getMatrixFrom2x2(SkMatrix*) const;
|
|
|
|
void getLocalMatrix(SkMatrix*) const;
|
|
|
|
void getSingleMatrix(SkMatrix*) const;
|
2009-07-21 17:41:32 +00:00
|
|
|
|
|
|
|
SkPaint::Hinting getHinting() const {
|
2011-11-22 19:42:41 +00:00
|
|
|
unsigned hint = (fFlags & kHinting_Mask) >> kHinting_Shift;
|
2011-11-21 19:46:00 +00:00
|
|
|
return static_cast<SkPaint::Hinting>(hint);
|
2009-07-21 17:41:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void setHinting(SkPaint::Hinting hinting) {
|
2011-11-22 19:42:41 +00:00
|
|
|
fFlags = (fFlags & ~kHinting_Mask) | (hinting << kHinting_Shift);
|
|
|
|
}
|
2012-02-07 21:25:33 +00:00
|
|
|
|
|
|
|
SkMask::Format getFormat() const {
|
|
|
|
return static_cast<SkMask::Format>(fMaskFormat);
|
|
|
|
}
|
|
|
|
|
2012-02-10 22:01:45 +00:00
|
|
|
#ifdef SK_USE_COLOR_LUMINANCE
|
|
|
|
SkColor getLuminanceColor() const {
|
2012-02-07 21:25:33 +00:00
|
|
|
return fLumBits;
|
|
|
|
}
|
|
|
|
|
2012-02-10 22:01:45 +00:00
|
|
|
void setLuminanceColor(SkColor c) {
|
|
|
|
fLumBits = c;
|
2012-02-07 21:25:33 +00:00
|
|
|
}
|
|
|
|
#else
|
2011-11-22 19:42:41 +00:00
|
|
|
unsigned getLuminanceBits() const {
|
|
|
|
return (fFlags & kLuminance_Mask) >> kLuminance_Shift;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setLuminanceBits(unsigned lum) {
|
|
|
|
SkASSERT(lum <= kLuminance_Max);
|
|
|
|
fFlags = (fFlags & ~kLuminance_Mask) | (lum << kLuminance_Shift);
|
|
|
|
}
|
|
|
|
|
|
|
|
U8CPU getLuminanceByte() const {
|
|
|
|
SkASSERT(3 == kLuminance_Bits);
|
|
|
|
unsigned lum = this->getLuminanceBits();
|
|
|
|
lum |= (lum << kLuminance_Bits);
|
|
|
|
lum |= (lum << kLuminance_Bits*2);
|
|
|
|
return lum >> (4*kLuminance_Bits - 8);
|
2009-07-21 17:41:32 +00:00
|
|
|
}
|
2012-02-10 22:01:45 +00:00
|
|
|
#endif
|
2008-12-17 15:59:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
SkScalerContext(const SkDescriptor* desc);
|
|
|
|
virtual ~SkScalerContext();
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2009-03-17 17:59:53 +00:00
|
|
|
// remember our glyph offset/base
|
2008-12-17 15:59:43 +00:00
|
|
|
void setBaseGlyphCount(unsigned baseGlyphCount) {
|
|
|
|
fBaseGlyphCount = baseGlyphCount;
|
|
|
|
}
|
|
|
|
|
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.
|
|
|
|
*/
|
2011-11-22 19:42:41 +00:00
|
|
|
uint16_t charToGlyphID(SkUnichar 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.
|
|
|
|
*/
|
|
|
|
SkUnichar glyphIDToChar(uint16_t glyphID);
|
|
|
|
|
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*);
|
|
|
|
void getFontMetrics(SkPaint::FontMetrics* mX,
|
|
|
|
SkPaint::FontMetrics* mY);
|
|
|
|
|
2012-02-15 18:49:15 +00:00
|
|
|
#ifdef SK_BUILD_FOR_ANDROID
|
|
|
|
unsigned getBaseGlyphCount(SkUnichar charCode);
|
2012-06-01 12:52:26 +00:00
|
|
|
|
|
|
|
// This function must be public for SkTypeface_android.h, but should not be
|
|
|
|
// called by other callers
|
|
|
|
SkFontID findTypefaceIdForChar(SkUnichar uni) {
|
|
|
|
SkScalerContext* ctx = this;
|
|
|
|
while (NULL != ctx) {
|
|
|
|
if (ctx->generateCharToGlyph(uni)) {
|
|
|
|
return ctx->fRec.fFontID;
|
|
|
|
}
|
|
|
|
ctx = ctx->getNextContext();
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2012-02-15 18:49:15 +00:00
|
|
|
#endif
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
static inline void MakeRec(const SkPaint&, const SkMatrix*, Rec* rec);
|
2012-03-01 22:32:51 +00:00
|
|
|
static inline void PostMakeRec(Rec*);
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
static SkScalerContext* Create(const SkDescriptor*);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Rec fRec;
|
|
|
|
unsigned fBaseGlyphCount;
|
|
|
|
|
2011-03-04 19:04:57 +00:00
|
|
|
virtual unsigned generateGlyphCount() = 0;
|
2008-12-17 15:59:43 +00:00
|
|
|
virtual uint16_t generateCharToGlyph(SkUnichar) = 0;
|
|
|
|
virtual void generateAdvance(SkGlyph*) = 0;
|
|
|
|
virtual void generateMetrics(SkGlyph*) = 0;
|
|
|
|
virtual void generateImage(const SkGlyph&) = 0;
|
|
|
|
virtual void generatePath(const SkGlyph&, SkPath*) = 0;
|
|
|
|
virtual void generateFontMetrics(SkPaint::FontMetrics* mX,
|
|
|
|
SkPaint::FontMetrics* mY) = 0;
|
2010-01-08 14:07:42 +00:00
|
|
|
// default impl returns 0, indicating failure.
|
|
|
|
virtual SkUnichar generateGlyphToChar(uint16_t);
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2011-08-05 21:40:26 +00:00
|
|
|
void forceGenerateImageFromPath() { fGenerateImageFromPath = true; }
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
private:
|
|
|
|
SkPathEffect* fPathEffect;
|
|
|
|
SkMaskFilter* fMaskFilter;
|
|
|
|
SkRasterizer* fRasterizer;
|
|
|
|
|
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);
|
|
|
|
|
2009-03-17 17:59:53 +00:00
|
|
|
// return the next context, treating fNextContext as a cache of the answer
|
|
|
|
SkScalerContext* getNextContext();
|
2008-12-17 15:59:43 +00:00
|
|
|
|
2009-03-17 17:59:53 +00:00
|
|
|
// returns the right context from our link-list for this glyph. If no match
|
|
|
|
// is found, just returns the original context (this)
|
|
|
|
SkScalerContext* getGlyphContext(const SkGlyph& glyph);
|
|
|
|
|
|
|
|
// link-list of context, to handle missing chars. null-terminated.
|
|
|
|
SkScalerContext* fNextContext;
|
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
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
enum SkAxisAlignment {
|
|
|
|
kNone_SkAxisAlignment,
|
|
|
|
kX_SkAxisAlignment,
|
|
|
|
kY_SkAxisAlignment
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the axis (if any) that the baseline for horizontal text will land on
|
|
|
|
* after running through the specified matrix.
|
|
|
|
*
|
|
|
|
* As an example, the identity matrix will return kX_SkAxisAlignment
|
|
|
|
*/
|
2011-08-24 15:38:46 +00:00
|
|
|
SkAxisAlignment SkComputeAxisAlignmentForHText(const SkMatrix& matrix);
|
2011-08-23 21:30:47 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
#endif
|
|
|
|
|