#include "SkDrawLooper.h"
#include "SkMatrix.h"
#include "SkXfermode.h"
-#ifdef SK_BUILD_FOR_ANDROID
-#include "SkPaintOptionsAndroid.h"
-#endif
class SkAnnotation;
class SkAutoGlyphCache;
SkPaint& operator=(const SkPaint&);
+ /** operator== may give false negatives: two paints that draw equivalently
+ may return false. It will never give false positives: two paints that
+ are not equivalent always return false.
+ */
SK_API friend bool operator==(const SkPaint& a, const SkPaint& b);
friend bool operator!=(const SkPaint& a, const SkPaint& b) {
return !(a == b);
};
Hinting getHinting() const {
- return static_cast<Hinting>(fHinting);
+ return static_cast<Hinting>(fBitfields.fHinting);
}
void setHinting(Hinting hintingLevel);
/** Return the paint's flags. Use the Flag enum to test flag values.
@return the paint's flags (see enums ending in _Flag for bit masks)
*/
- uint32_t getFlags() const { return fFlags; }
+ uint32_t getFlags() const { return fBitfields.fFlags; }
/** Set the paint's flags. Use the Flag enum to specific flag values.
@param flags The new flag bits for the paint (see Flags enum)
* Return the filter level. This affects the quality (and performance) of
* drawing scaled images.
*/
- FilterLevel getFilterLevel() const { return (FilterLevel)fFilterLevel; }
+ FilterLevel getFilterLevel() const {
+ return (FilterLevel)fBitfields.fFilterLevel;
+ }
/**
* Set the filter level. This affects the quality (and performance) of
kFill_Style).
@return the paint's Style
*/
- Style getStyle() const { return (Style)fStyle; }
+ Style getStyle() const { return (Style)fBitfields.fStyle; }
/** Set the paint's style, used for controlling how primitives'
geometries are interpreted (except for drawBitmap, which always assumes
@return the line cap style for the paint, used whenever the paint's
style is Stroke or StrokeAndFill.
*/
- Cap getStrokeCap() const { return (Cap)fCapType; }
+ Cap getStrokeCap() const { return (Cap)fBitfields.fCapType; }
/** Set the paint's stroke cap type.
@param cap set the paint's line cap style, used whenever the paint's
@return the paint's line join style, used whenever the paint's style is
Stroke or StrokeAndFill.
*/
- Join getStrokeJoin() const { return (Join)fJoinType; }
+ Join getStrokeJoin() const { return (Join)fBitfields.fJoinType; }
/** Set the paint's stroke join type.
@param join set the paint's line join style, used whenever the paint's
/** Return the paint's Align value for drawing text.
@return the paint's Align value for drawing text.
*/
- Align getTextAlign() const { return (Align)fTextAlign; }
+ Align getTextAlign() const { return (Align)fBitfields.fTextAlign; }
/** Set the paint's text alignment.
@param align set the paint's Align value for drawing text.
kGlyphID_TextEncoding //!< the text parameters are glyph indices
};
- TextEncoding getTextEncoding() const { return (TextEncoding)fTextEncoding; }
+ TextEncoding getTextEncoding() const {
+ return (TextEncoding)fBitfields.fTextEncoding;
+ }
void setTextEncoding(TextEncoding encoding);
* @param length Number of bytes of text to measure
* @param bounds If not NULL, returns the bounds of the text,
* relative to (0, 0).
- * @param scale If not 0, return width as if the canvas were scaled
- * by this value
* @return The advance width of the text
*/
- SkScalar measureText(const void* text, size_t length,
- SkRect* bounds, SkScalar scale = 0) const;
+ SkScalar measureText(const void* text, size_t length, SkRect* bounds) const;
/** Return the width of the text. This will return the vertical measure
* if isVerticalText() is true, in which case the returned value should
* @return The advance width of the text
*/
SkScalar measureText(const void* text, size_t length) const {
- return this->measureText(text, length, NULL, 0);
+ return this->measureText(text, length, NULL);
}
/** Specify the direction the text buffer should be processed in breakText()
#ifdef SK_BUILD_FOR_ANDROID
uint32_t getGenerationID() const;
void setGenerationID(uint32_t generationID);
-
- /** Returns the base glyph count for the strike associated with this paint
- */
- unsigned getBaseGlyphCount(SkUnichar text) const;
-
- const SkPaintOptionsAndroid& getPaintOptionsAndroid() const {
- return fPaintOptionsAndroid;
- }
- void setPaintOptionsAndroid(const SkPaintOptionsAndroid& options);
#endif
// returns true if the paint's settings (e.g. xfermode + alpha) resolve to
unsigned fHinting : 2;
unsigned fFilterLevel : 2;
//unsigned fFreeBits : 2;
- };
- uint32_t fBitfields;
+ } fBitfields;
+ uint32_t fBitfieldsUInt;
};
uint32_t fDirtyBits;
- uint32_t getBitfields() const { return fBitfields; }
- void setBitfields(uint32_t bitfields);
-
SkDrawCacheProc getDrawCacheProc() const;
SkMeasureCacheProc getMeasureCacheProc(TextBufferDirection dir,
bool needFullMetrics) const;
SkScalar measure_text(SkGlyphCache*, const char* text, size_t length,
int* count, SkRect* bounds) const;
- SkGlyphCache* detachCache(const SkDeviceProperties* deviceProperties, const SkMatrix*) const;
+ SkGlyphCache* detachCache(const SkDeviceProperties* deviceProperties, const SkMatrix*,
+ bool ignoreGamma) const;
void descriptorProc(const SkDeviceProperties* deviceProperties, const SkMatrix* deviceMatrix,
void (*proc)(SkTypeface*, const SkDescriptor*, void*),
static bool TooBigToUseCache(const SkMatrix& ctm, const SkMatrix& textM);
- bool tooBigToUseCache() const;
- bool tooBigToUseCache(const SkMatrix& ctm) const;
-
// Set flags/hinting/textSize up to use for drawing text as paths.
// Returns scale factor to restore the original textSize, since will will
// have change it to kCanonicalTextSizeForPaths.
}
friend class SkAutoGlyphCache;
+ friend class SkAutoGlyphCacheNoGamma;
friend class SkCanvas;
friend class SkDraw;
friend class SkGraphics; // So Term() can be called.
friend class SkPDFDevice;
friend class GrBitmapTextContext;
friend class GrDistanceFieldTextContext;
+ friend class GrStencilAndCoverTextContext;
+ friend class GrPathRendering;
+ friend class GrGLPathRendering;
friend class SkTextToPathIter;
friend class SkCanonicalizePaint;
#ifdef SK_BUILD_FOR_ANDROID
- SkPaintOptionsAndroid fPaintOptionsAndroid;
-
// In order for the == operator to work properly this must be the last field
// in the struct so that we can do a memcmp to this field's offset.
uint32_t fGenerationID;