diff options
author | Derek Sollenberger <djsollen@google.com> | 2011-03-17 15:18:13 -0400 |
---|---|---|
committer | Derek Sollenberger <djsollen@google.com> | 2011-03-17 15:18:13 -0400 |
commit | 137a4ca42423bbb6d683067ea544c9a48f18f06c (patch) | |
tree | 91758d54677b69a0256a076cf8ed209a84a601d0 /include | |
parent | 74620984a3d6d6d9ca2e564a487a00b987a9eb33 (diff) | |
download | external_skia-137a4ca42423bbb6d683067ea544c9a48f18f06c.zip external_skia-137a4ca42423bbb6d683067ea544c9a48f18f06c.tar.gz external_skia-137a4ca42423bbb6d683067ea544c9a48f18f06c.tar.bz2 |
Skia Merge (revision 950)
This merge will allow us to now import the sample app
infrastructure in skia to do on device measurements.
Change-Id: Idcab6b1524f371521717cde61a6e98a12d897e6b
Diffstat (limited to 'include')
38 files changed, 291 insertions, 112 deletions
diff --git a/include/config/SkUserConfig.h b/include/config/SkUserConfig.h new file mode 100644 index 0000000..13169ca --- /dev/null +++ b/include/config/SkUserConfig.h @@ -0,0 +1,145 @@ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SkUserConfig_DEFINED +#define SkUserConfig_DEFINED + +/* SkTypes.h, the root of the public header files, does the following trick: + + #include "SkPreConfig.h" + #include "SkUserConfig.h" + #include "SkPostConfig.h" + + SkPreConfig.h runs first, and it is responsible for initializing certain + skia defines. + + SkPostConfig.h runs last, and its job is to just check that the final + defines are consistent (i.e. that we don't have mutually conflicting + defines). + + SkUserConfig.h (this file) runs in the middle. It gets to change or augment + the list of flags initially set in preconfig, and then postconfig checks + that everything still makes sense. + + Below are optional defines that add, subtract, or change default behavior + in Skia. Your port can locally edit this file to enable/disable flags as + you choose, or these can be delared on your command line (i.e. -Dfoo). + + By default, this include file will always default to having all of the flags + commented out, so including it will have no effect. +*/ + +/////////////////////////////////////////////////////////////////////////////// + +/* Scalars (the fractional value type in skia) can be implemented either as + floats or 16.16 integers (fixed). Exactly one of these two symbols must be + defined. +*/ +//#define SK_SCALAR_IS_FLOAT +//#define SK_SCALAR_IS_FIXED + + +/* Somewhat independent of how SkScalar is implemented, Skia also wants to know + if it can use floats at all. Naturally, if SK_SCALAR_IS_FLOAT is defined, + then so muse SK_CAN_USE_FLOAT, but if scalars are fixed, SK_CAN_USE_FLOAT + can go either way. + */ +//#define SK_CAN_USE_FLOAT + +/* For some performance-critical scalar operations, skia will optionally work + around the standard float operators if it knows that the CPU does not have + native support for floats. If your environment uses software floating point, + define this flag. + */ +//#define SK_SOFTWARE_FLOAT + + +/* Skia has lots of debug-only code. Often this is just null checks or other + parameter checking, but sometimes it can be quite intrusive (e.g. check that + each 32bit pixel is in premultiplied form). This code can be very useful + during development, but will slow things down in a shipping product. + + By default, these mutually exclusive flags are defined in SkPreConfig.h, + based on the presence or absence of NDEBUG, but that decision can be changed + here. + */ +//#define SK_DEBUG +//#define SK_RELEASE + + +/* If, in debugging mode, Skia needs to stop (presumably to invoke a debugger) + it will call SK_CRASH(). If this is not defined it, it is defined in + SkPostConfig.h to write to an illegal address + */ +//#define SK_CRASH() *(int *)(uintptr_t)0 = 0 + + +/* preconfig will have attempted to determine the endianness of the system, + but you can change these mutually exclusive flags here. + */ +//#define SK_CPU_BENDIAN +//#define SK_CPU_LENDIAN + + +/* Some compilers don't support long long for 64bit integers. If yours does + not, define this to the appropriate type. + */ +//#define SkLONGLONG int64_t + + +/* Some envorinments do not suport writable globals (eek!). If yours does not, + define this flag. + */ +//#define SK_USE_RUNTIME_GLOBALS + + +/* To write debug messages to a console, skia will call SkDebugf(...) following + printf conventions (e.g. const char* format, ...). If you want to redirect + this to something other than printf, define yours here + */ +//#define SkDebugf(...) MyFunction(__VA_ARGS__) + +/* To enable additional blitters (and fontscaler code) to support separate + alpha channels for R G B channels, define SK_SUPPORT_LCDTEXT + */ +//#define SK_SUPPORT_LCDTEXT + +/* If zlib is available and you want to support the flate compression + algorithm (used in PDF generation), define SK_ZLIB_INCLUDE to be the + include path. + */ +//#define SK_ZLIB_INCLUDE <zlib.h> + +/* Define this to allow PDF scalars above 32k. The PDF/A spec doesn't allow + them, but modern PDF interpreters should handle them just fine. + */ +//#define SK_ALLOW_LARGE_PDF_SCALARS + +/* Define this to remove dimension checks on bitmaps. Not all blits will be + correct yet, so this is mostly for debugging the implementation. + */ +//#define SK_ALLOW_OVER_32K_BITMAPS + +/* If SK_DEBUG is defined, then you can optionally define SK_SUPPORT_UNITTEST + which will run additional self-tests at startup. These can take a long time, + so this flag is optional. + */ +#ifdef SK_DEBUG +//#define SK_SUPPORT_UNITTEST +#endif + +#endif + diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index 1d21a2f..349489e 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -40,7 +40,7 @@ class SkGpuTexture; Bitmaps can be drawn into a SkCanvas, but they are also used to specify the target of a SkCanvas' drawing operations. */ -class SkBitmap { +class SK_API SkBitmap { public: class Allocator; diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 5aecacb..0a1b393 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -51,7 +51,7 @@ class SkShape; color, typeface, textSize, strokeWidth, shader (e.g. gradients, patterns), etc. */ -class SkCanvas : public SkRefCnt { +class SK_API SkCanvas : public SkRefCnt { public: /** Construct a canvas with the given device factory. @param factory Specify the factory for generating additional devices. @@ -758,7 +758,7 @@ public: call made on the canvas. Ownership of all pointers in the iterator stays with the canvas, so none of them should be modified or deleted. */ - class LayerIter /*: SkNoncopyable*/ { + class SK_API LayerIter /*: SkNoncopyable*/ { public: /** Initialize iterator with canvas, and set values for 1st device */ LayerIter(SkCanvas*, bool skipEmptyClips); diff --git a/include/core/SkClipStack.h b/include/core/SkClipStack.h index db42e4d..850a3f0 100644 --- a/include/core/SkClipStack.h +++ b/include/core/SkClipStack.h @@ -7,7 +7,7 @@ struct SkRect; class SkPath; -class SkClipStack { +class SK_API SkClipStack { public: SkClipStack(); ~SkClipStack() {} diff --git a/include/core/SkColor.h b/include/core/SkColor.h index c17068f..6b86e7e 100644 --- a/include/core/SkColor.h +++ b/include/core/SkColor.h @@ -152,12 +152,12 @@ typedef uint32_t SkPMColor; /** Return a SkPMColor value from unpremultiplied 8 bit component values */ -SkPMColor SkPreMultiplyARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b); +SK_API SkPMColor SkPreMultiplyARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b); /** Return a SkPMColor value from a SkColor value. This is done by multiplying the color components by the color's alpha, and by arranging the bytes in a configuration dependent order, to match the format of kARGB32 bitmaps. */ -SkPMColor SkPreMultiplyColor(SkColor c); +SK_API SkPMColor SkPreMultiplyColor(SkColor c); /** Define a function pointer type for combining two premultiplied colors */ diff --git a/include/core/SkColorPriv.h b/include/core/SkColorPriv.h index bd407da..f9e02a2 100644 --- a/include/core/SkColorPriv.h +++ b/include/core/SkColorPriv.h @@ -234,7 +234,7 @@ static inline SkPMColor SkPackARGB32NoCheck(U8CPU a, U8CPU r, U8CPU g, U8CPU b) (g << SK_G32_SHIFT) | (b << SK_B32_SHIFT); } -extern const uint32_t gMask_00FF00FF; +SK_API extern const uint32_t gMask_00FF00FF; static inline uint32_t SkAlphaMulQ(uint32_t c, unsigned scale) { uint32_t mask = gMask_00FF00FF; diff --git a/include/core/SkColorShader.h b/include/core/SkColorShader.h index f7251ff..b7537e1 100644 --- a/include/core/SkColorShader.h +++ b/include/core/SkColorShader.h @@ -24,7 +24,7 @@ accomplished by just using the color field on the paint, but if an actual shader object is needed, this provides that feature. */ -class SkColorShader : public SkShader { +class SK_API SkColorShader : public SkShader { public: /** Create a ColorShader that will inherit its color from the Paint at draw time. diff --git a/include/core/SkDeque.h b/include/core/SkDeque.h index 92d5153..8bf8b5b 100644 --- a/include/core/SkDeque.h +++ b/include/core/SkDeque.h @@ -19,7 +19,7 @@ #include "SkTypes.h" -class SkDeque : SkNoncopyable { +class SK_API SkDeque : SkNoncopyable { public: explicit SkDeque(size_t elemSize); SkDeque(size_t elemSize, void* storage, size_t storageSize); diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h index 55d823b..2f95015 100644 --- a/include/core/SkDevice.h +++ b/include/core/SkDevice.h @@ -49,7 +49,7 @@ public: int height, bool isOpaque, bool isLayer); }; -class SkDevice : public SkRefCnt { +class SK_API SkDevice : public SkRefCnt { public: SkDevice(SkCanvas*); /** Construct a new device, extracting the width/height/config/isOpaque values from @@ -214,6 +214,21 @@ public: SkRefDict& getRefDict() { return fRefDict; } + struct TextFlags { + uint32_t fFlags; // SkPaint::getFlags() + SkPaint::Hinting fHinting; + }; + + /** + * Device may filter the text flags for drawing text here. If it wants to + * make a change to the specified values, it should write them into the + * textflags parameter (output) and return true. If the paint is fine as + * is, then ignore the textflags parameter and return false. + * + * The baseclass SkDevice filters based on its depth and blitters. + */ + virtual bool filterTextFlags(const SkPaint& paint, TextFlags*); + protected: /** Update as needed the pixel value in the bitmap, so that the caller can access the pixels directly. Note: only the pixels field should be altered. The config/width/height/rowbytes diff --git a/include/core/SkDrawLooper.h b/include/core/SkDrawLooper.h index 333fb41..87eb5cb 100644 --- a/include/core/SkDrawLooper.h +++ b/include/core/SkDrawLooper.h @@ -32,7 +32,7 @@ class SkPaint; invoked multiple times (hence the name loop-er), allow it to perform effects like shadows or frame/fills, that require more than one pass. */ -class SkDrawLooper : public SkFlattenable { +class SK_API SkDrawLooper : public SkFlattenable { public: /** Called right before something is being drawn to the specified canvas with the specified paint. Subclass that want to modify either parameter diff --git a/include/core/SkFlattenable.h b/include/core/SkFlattenable.h index 6958462..ad4062f 100644 --- a/include/core/SkFlattenable.h +++ b/include/core/SkFlattenable.h @@ -33,7 +33,7 @@ class SkString; into a data stream for either transport or as part of the key to the font cache. */ -class SkFlattenable : public SkRefCnt { +class SK_API SkFlattenable : public SkRefCnt { public: typedef SkFlattenable* (*Factory)(SkFlattenableReadBuffer&); diff --git a/include/core/SkFloatBits.h b/include/core/SkFloatBits.h index 1628f6e..288f2d8 100644 --- a/include/core/SkFloatBits.h +++ b/include/core/SkFloatBits.h @@ -51,17 +51,17 @@ int32_t SkFloatBits_toIntCast(int32_t floatBits); /** Given the bit representation of a float, return its floor as an int. If the value is out of range, or NaN, return return +/- SK_MaxS32 */ -int32_t SkFloatBits_toIntFloor(int32_t floatBits); +SK_API int32_t SkFloatBits_toIntFloor(int32_t floatBits); /** Given the bit representation of a float, return it rounded to an int. If the value is out of range, or NaN, return return +/- SK_MaxS32 */ -int32_t SkFloatBits_toIntRound(int32_t floatBits); +SK_API int32_t SkFloatBits_toIntRound(int32_t floatBits); /** Given the bit representation of a float, return its ceiling as an int. If the value is out of range, or NaN, return return +/- SK_MaxS32 */ -int32_t SkFloatBits_toIntCeil(int32_t floatBits); +SK_API int32_t SkFloatBits_toIntCeil(int32_t floatBits); #ifdef SK_CAN_USE_FLOAT diff --git a/include/core/SkGeometry.h b/include/core/SkGeometry.h index a209783..d4b13fb 100644 --- a/include/core/SkGeometry.h +++ b/include/core/SkGeometry.h @@ -90,7 +90,7 @@ int SkChopQuadAtMaxCurvature(const SkPoint src[3], SkPoint dst[5]); convert it into the cubic fitting the same curve. The new cubic curve is returned in dst[0..3]. */ -void SkConvertQuadToCubic(const SkPoint src[3], SkPoint dst[4]); +SK_API void SkConvertQuadToCubic(const SkPoint src[3], SkPoint dst[4]); //////////////////////////////////////////////////////////////////////////////////////// diff --git a/include/core/SkMask.h b/include/core/SkMask.h index 4d48376..ebb870f 100644 --- a/include/core/SkMask.h +++ b/include/core/SkMask.h @@ -142,8 +142,7 @@ struct SkMask { }; static bool FormatIsLCD(Format fm) { - return kHorizontalLCD_Format == fm || kVerticalLCD_Format == fm || - kLCD16_Format == fm; + return kHorizontalLCD_Format == fm || kVerticalLCD_Format == fm; } }; diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h index 5c82d78..5ba9223 100644 --- a/include/core/SkMatrix.h +++ b/include/core/SkMatrix.h @@ -28,7 +28,7 @@ class SkString; using either reset() - to construct an identity matrix, or one of the set functions (e.g. setTranslate, setRotate, etc.). */ -class SkMatrix { +class SK_API SkMatrix { public: /** Enum of bit fields for the mask return by getType(). Use this to identify the complexity of the matrix. diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index 3c847de..eec11cf 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -48,7 +48,7 @@ typedef const SkGlyph& (*SkMeasureCacheProc)(SkGlyphCache*, const char**); The SkPaint class holds the style and color information about how to draw geometries, text and bitmaps. */ -class SkPaint { +class SK_API SkPaint { public: SkPaint(); SkPaint(const SkPaint& paint); @@ -56,12 +56,11 @@ public: SkPaint& operator=(const SkPaint&); - friend int operator==(const SkPaint& a, const SkPaint& b); - friend int operator!=(const SkPaint& a, const SkPaint& b) - { + SK_API friend int operator==(const SkPaint& a, const SkPaint& b); + friend int operator!=(const SkPaint& a, const SkPaint& b) { return !(a == b); } - + void flatten(SkFlattenableWriteBuffer&) const; void unflatten(SkFlattenableReadBuffer&); @@ -86,13 +85,11 @@ public: kFull_Hinting = 3, }; - Hinting getHinting() const - { + Hinting getHinting() const { return static_cast<Hinting>(fHinting); } - void setHinting(Hinting hintingLevel) - { + void setHinting(Hinting hintingLevel) { if ((unsigned) hintingLevel != fHinting) { fGenerationID++; fHinting = hintingLevel; @@ -133,34 +130,31 @@ public: /** Helper for getFlags(), returning true if kAntiAlias_Flag bit is set @return true if the antialias bit is set in the paint's flags. */ - bool isAntiAlias() const - { + bool isAntiAlias() const { return SkToBool(this->getFlags() & kAntiAlias_Flag); } - + /** Helper for setFlags(), setting or clearing the kAntiAlias_Flag bit @param aa true to enable antialiasing, false to disable it */ void setAntiAlias(bool aa); - + /** Helper for getFlags(), returning true if kDither_Flag bit is set @return true if the dithering bit is set in the paint's flags. */ - bool isDither() const - { + bool isDither() const { return SkToBool(this->getFlags() & kDither_Flag); } - + /** Helper for setFlags(), setting or clearing the kDither_Flag bit @param dither true to enable dithering, false to disable it */ void setDither(bool dither); - + /** Helper for getFlags(), returning true if kLinearText_Flag bit is set @return true if the lineartext bit is set in the paint's flags */ - bool isLinearText() const - { + bool isLinearText() const { return SkToBool(this->getFlags() & kLinearText_Flag); } @@ -173,19 +167,17 @@ public: /** Helper for getFlags(), returning true if kSubpixelText_Flag bit is set @return true if the lineartext bit is set in the paint's flags */ - bool isSubpixelText() const - { + bool isSubpixelText() const { return SkToBool(this->getFlags() & kSubpixelText_Flag); } - + /** Helper for setFlags(), setting or clearing the kSubpixelText_Flag bit @param subpixelText true to set the subpixelText bit in the paint's flags, false to clear it. */ void setSubpixelText(bool subpixelText); - bool isLCDRenderText() const - { + bool isLCDRenderText() const { return SkToBool(this->getFlags() & kLCDRenderText_Flag); } @@ -195,8 +187,7 @@ public: */ void setLCDRenderText(bool subpixelRender); - bool isEmbeddedBitmapText() const - { + bool isEmbeddedBitmapText() const { return SkToBool(this->getFlags() & kEmbeddedBitmapText_Flag); } @@ -206,8 +197,7 @@ public: */ void setEmbeddedBitmapText(bool useEmbeddedBitmapText); - bool isAutohinted() const - { + bool isAutohinted() const { return SkToBool(this->getFlags() & kAutoHinting_Flag); } @@ -221,8 +211,7 @@ public: /** Helper for getFlags(), returning true if kUnderlineText_Flag bit is set @return true if the underlineText bit is set in the paint's flags. */ - bool isUnderlineText() const - { + bool isUnderlineText() const { return SkToBool(this->getFlags() & kUnderlineText_Flag); } @@ -235,8 +224,7 @@ public: /** Helper for getFlags(), returns true if kStrikeThruText_Flag bit is set @return true if the strikeThruText bit is set in the paint's flags. */ - bool isStrikeThruText() const - { + bool isStrikeThruText() const { return SkToBool(this->getFlags() & kStrikeThruText_Flag); } @@ -249,8 +237,7 @@ public: /** Helper for getFlags(), returns true if kFakeBoldText_Flag bit is set @return true if the kFakeBoldText_Flag bit is set in the paint's flags. */ - bool isFakeBoldText() const - { + bool isFakeBoldText() const { return SkToBool(this->getFlags() & kFakeBoldText_Flag); } @@ -263,8 +250,7 @@ public: /** Helper for getFlags(), returns true if kDevKernText_Flag bit is set @return true if the kernText bit is set in the paint's flags. */ - bool isDevKernText() const - { + bool isDevKernText() const { return SkToBool(this->getFlags() & kDevKernText_Flag); } @@ -274,17 +260,16 @@ public: */ void setDevKernText(bool devKernText); - bool isFilterBitmap() const - { + bool isFilterBitmap() const { return SkToBool(this->getFlags() & kFilterBitmap_Flag); } - + void setFilterBitmap(bool filterBitmap); /** Styles apply to rect, oval, path, and text. Bitmaps are always drawn in "fill", and lines are always drawn in "stroke". - + Note: strokeandfill implicitly draws the result with SkPath::kWinding_FillType, so if the original path is even-odd, the results may not appear the same as if it was drawn twice, filled and @@ -331,7 +316,7 @@ public: @return the alpha component of the paint's color. */ uint8_t getAlpha() const { return SkToU8(SkColorGetA(fColor)); } - + /** Helper to setColor(), that only assigns the color's alpha value, leaving its r,g,b values unchanged. @param a set the alpha component (0..255) of the paint's color. @@ -347,7 +332,7 @@ public: */ void setARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b); - /** Return the width for stroking. + /** Return the width for stroking. <p /> A value of 0 strokes in hairline mode. Hairlines always draw 1-pixel wide, regardless of the matrix. @@ -356,7 +341,7 @@ public: */ SkScalar getStrokeWidth() const { return fWidth; } - /** Set the width for stroking. + /** Set the width for stroking. Pass 0 to stroke in hairline mode. Hairlines always draw 1-pixel wide, regardless of the matrix. @param width set the paint's stroke width, used whenever the paint's @@ -457,12 +442,12 @@ public: effects in the paint (e.g. stroking). If needed, it uses the storage rect parameter. It returns the adjusted bounds that can then be used for quickReject tests. - + The returned rect will either be orig or storage, thus the caller should not rely on storage being set to the result, but should always use the retured value. It is legal for orig and storage to be the same rect. - + e.g. if (paint.canComputeFastBounds()) { SkRect r, storage; @@ -495,7 +480,7 @@ public: @return shader */ SkShader* setShader(SkShader* shader); - + /** Get the paint's colorfilter. If there is a colorfilter, its reference count is not changed. @return the paint's colorfilter (or NULL) @@ -616,8 +601,24 @@ public: */ SkRasterizer* setRasterizer(SkRasterizer* rasterizer); + /** + * Return the paint's SkDrawLooper (if any). Does not affect the looper's + * reference count. + */ SkDrawLooper* getLooper() const { return fLooper; } - SkDrawLooper* setLooper(SkDrawLooper*); + + /** + * Set or clear the looper object. + * <p /> + * Pass NULL to clear any previous looper. + * As a convenience, the parameter passed is also returned. + * If a previous looper exists in the paint, its reference count is + * decremented. If looper is not NULL, its reference count is + * incremented. + * @param looper May be NULL. The new looper to be installed in the paint. + * @return looper + */ + SkDrawLooper* setLooper(SkDrawLooper* looper); enum Align { kLeft_Align, @@ -626,10 +627,12 @@ public: kAlignCount }; + /** Return the paint's Align value for drawing text. @return the paint's Align value for drawing text. */ Align getTextAlign() const { return (Align)fTextAlign; } + /** Set the paint's text alignment. @param align set the paint's Align value for drawing text. */ @@ -679,11 +682,8 @@ public: kUTF16_TextEncoding, //!< the text parameters are UTF16 kGlyphID_TextEncoding //!< the text parameters are glyph indices }; - - TextEncoding getTextEncoding() const - { - return (TextEncoding)fTextEncoding; - } + + TextEncoding getTextEncoding() const { return (TextEncoding)fTextEncoding; } void setTextEncoding(TextEncoding encoding); @@ -698,11 +698,11 @@ public: SkScalar fXMax; //!< The maximum bounding box x value for all glyphs SkScalar fXHeight; //!< the height of an 'x' in px, or 0 if no 'x' in face }; - + /** Return the recommend spacing between lines (which will be fDescent - fAscent + fLeading). If metrics is not null, return in it the font metrics for the - typeface/pointsize/etc. currently set in the paint. + typeface/pointsize/etc. currently set in the paint. @param metrics If not null, returns the font metrics for the current typeface/pointsize/etc setting in this paint. @@ -711,7 +711,7 @@ public: @param return the recommended spacing between lines */ SkScalar getFontMetrics(FontMetrics* metrics, SkScalar scale = 0) const; - + /** Return the recommend line spacing. This will be fDescent - fAscent + fLeading */ @@ -745,8 +745,7 @@ public: want to have the text converted into glyph IDs, call textToGlyphs instead. */ - int countText(const void* text, size_t byteLength) const - { + int countText(const void* text, size_t byteLength) const { return this->textToGlyphs(text, byteLength, NULL); } @@ -759,19 +758,18 @@ public: 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, SkScalar scale = 0) const; /** Return the width of the text. @param text Address of the text @param length Number of bytes of text to measure @return The width of the text */ - SkScalar measureText(const void* text, size_t length) const - { + SkScalar measureText(const void* text, size_t length) const { return this->measureText(text, length, NULL, 0); } - + /** Specify the direction the text buffer should be processed in breakText() */ enum TextBufferDirection { diff --git a/include/core/SkPath.h b/include/core/SkPath.h index eb5ff6d..51afad7 100644 --- a/include/core/SkPath.h +++ b/include/core/SkPath.h @@ -30,7 +30,7 @@ class SkString; The SkPath class encapsulates compound (multiple contour) geometric paths consisting of straight line segments, quadratic curves, and cubic curves. */ -class SkPath { +class SK_API SkPath { public: SkPath(); SkPath(const SkPath&); @@ -514,7 +514,7 @@ public: /** Iterate through all of the segments (lines, quadratics, cubics) of each contours in a path. */ - class Iter { + class SK_API Iter { public: Iter(); Iter(const SkPath&, bool forceClose); diff --git a/include/core/SkPathEffect.h b/include/core/SkPathEffect.h index f97adb7..eb1cc23 100644 --- a/include/core/SkPathEffect.h +++ b/include/core/SkPathEffect.h @@ -29,7 +29,7 @@ class SkPath; Dashing is implemented as a subclass of SkPathEffect. */ -class SkPathEffect : public SkFlattenable { +class SK_API SkPathEffect : public SkFlattenable { public: // This method is not exported to java. SkPathEffect() {} diff --git a/include/core/SkPoint.h b/include/core/SkPoint.h index 79ca58c..c89f080 100644 --- a/include/core/SkPoint.h +++ b/include/core/SkPoint.h @@ -140,7 +140,7 @@ struct SkIPoint { } }; -struct SkPoint { +struct SK_API SkPoint { SkScalar fX, fY; static SkPoint Make(SkScalar x, SkScalar y) { diff --git a/include/core/SkPreConfig.h b/include/core/SkPreConfig.h index f907578..daf2041 100644 --- a/include/core/SkPreConfig.h +++ b/include/core/SkPreConfig.h @@ -96,5 +96,21 @@ #define SK_CPU_HAS_CONDITIONAL_INSTR #endif +////////////////////////////////////////////////////////////////////// + +#if !defined(SKIA_IMPLEMENTATION) + #define SKIA_IMPLEMENTATION 0 +#endif + +#if defined(WIN32) && defined(SKIA_DLL) + #if SKIA_IMPLEMENTATION + #define SK_API __declspec(dllexport) + #else + #define SK_API __declspec(dllimport) + #endif +#else + #define SK_API +#endif + #endif diff --git a/include/core/SkRect.h b/include/core/SkRect.h index 114d1f9..53c61ea 100644 --- a/include/core/SkRect.h +++ b/include/core/SkRect.h @@ -24,7 +24,7 @@ SkIRect holds four 32 bit integer coordinates for a rectangle */ -struct SkIRect { +struct SK_API SkIRect { int32_t fLeft, fTop, fRight, fBottom; static SkIRect MakeEmpty() { @@ -267,7 +267,7 @@ struct SkIRect { /** \struct SkRect */ -struct SkRect { +struct SK_API SkRect { SkScalar fLeft, fTop, fRight, fBottom; static SkRect MakeEmpty() { diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h index b9b2c98..36f4249 100644 --- a/include/core/SkRefCnt.h +++ b/include/core/SkRefCnt.h @@ -29,7 +29,7 @@ explicitly (or via the object going out of scope on the stack or calling delete) if getRefCnt() > 1. */ -class SkRefCnt : SkNoncopyable { +class SK_API SkRefCnt : SkNoncopyable { public: /** Default construct, initializing the reference count to 1. */ diff --git a/include/core/SkRefDict.h b/include/core/SkRefDict.h index 3ee27d9..0c4b025 100644 --- a/include/core/SkRefDict.h +++ b/include/core/SkRefDict.h @@ -23,7 +23,7 @@ * A dictionary of string,refcnt pairs. The dictionary is also an owner of the * refcnt objects while they are contained. */ -class SkRefDict : SkNoncopyable { +class SK_API SkRefDict : SkNoncopyable { public: SkRefDict(); ~SkRefDict(); diff --git a/include/core/SkRegion.h b/include/core/SkRegion.h index 7ddf087..4cda2cd 100644 --- a/include/core/SkRegion.h +++ b/include/core/SkRegion.h @@ -34,7 +34,7 @@ namespace android { The SkRegion class encapsulates the geometric region used to specify clipping areas for drawing. */ -class SkRegion { +class SK_API SkRegion { public: typedef int32_t RunType; enum { @@ -258,7 +258,7 @@ public: /** Returns the sequence of rectangles, sorted in Y and X, that make up this region. */ - class Iterator { + class SK_API Iterator { public: Iterator() : fRgn(NULL), fDone(true) {} Iterator(const SkRegion&); @@ -281,7 +281,7 @@ public: /** Returns the sequence of rectangles, sorted in Y and X, that make up this region intersected with the specified clip rectangle. */ - class Cliperator { + class SK_API Cliperator { public: Cliperator(const SkRegion&, const SkIRect& clip); bool done() { return fDone; } diff --git a/include/core/SkScalerContext.h b/include/core/SkScalerContext.h index 584b86b..55dfcef 100644 --- a/include/core/SkScalerContext.h +++ b/include/core/SkScalerContext.h @@ -222,6 +222,10 @@ public: SkScalerContext(const SkDescriptor* desc); virtual ~SkScalerContext(); + SkMask::Format getMaskFormat() const { + return (SkMask::Format)fRec.fMaskFormat; + } + // remember our glyph offset/base void setBaseGlyphCount(unsigned baseGlyphCount) { fBaseGlyphCount = baseGlyphCount; diff --git a/include/core/SkShader.h b/include/core/SkShader.h index c59cc59..d837284 100644 --- a/include/core/SkShader.h +++ b/include/core/SkShader.h @@ -32,7 +32,7 @@ class SkPath; any object (other than a bitmap) that is drawn with that paint will get its color(s) from the shader. */ -class SkShader : public SkFlattenable { +class SK_API SkShader : public SkFlattenable { public: SkShader(); virtual ~SkShader(); diff --git a/include/core/SkTDArray.h b/include/core/SkTDArray.h index 954bcf8..c64d773 100644 --- a/include/core/SkTDArray.h +++ b/include/core/SkTDArray.h @@ -19,7 +19,7 @@ #include "SkTypes.h" -template <typename T> class SkTDArray { +template <typename T> class SK_API SkTDArray { public: SkTDArray() { fReserve = fCount = 0; diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h index f4b9507..c3b0f50 100644 --- a/include/core/SkTypeface.h +++ b/include/core/SkTypeface.h @@ -32,7 +32,7 @@ class SkWStream; Typeface objects are immutable, and so they can be shared between threads. */ -class SkTypeface : public SkRefCnt { +class SK_API SkTypeface : public SkRefCnt { public: /** Style specifies the intrinsic style attributes of a given typeface */ diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h index 93f054e..1290935 100644 --- a/include/core/SkTypes.h +++ b/include/core/SkTypes.h @@ -59,7 +59,7 @@ enum { return null (if SK_MALLOC_TEMP bit is clear) or call sk_throw() (if SK_MALLOC_TEMP bit is set). To free the memory, call sk_free(). */ -extern void* sk_malloc_flags(size_t size, unsigned flags); +SK_API extern void* sk_malloc_flags(size_t size, unsigned flags); /** Same as sk_malloc(), but hard coded to pass SK_MALLOC_THROW as the flag */ extern void* sk_malloc_throw(size_t size); @@ -69,7 +69,7 @@ extern void* sk_malloc_throw(size_t size); extern void* sk_realloc_throw(void* buffer, size_t size); /** Free memory returned by sk_malloc(). It is safe to pass null. */ -extern void sk_free(void*); +SK_API extern void sk_free(void*); // bzero is safer than memset, but we can't rely on it, so... sk_bzero() static inline void sk_bzero(void* buffer, size_t size) { @@ -152,12 +152,12 @@ typedef int SkBool; typedef uint8_t SkBool8; #ifdef SK_DEBUG - int8_t SkToS8(long); - uint8_t SkToU8(size_t); - int16_t SkToS16(long); - uint16_t SkToU16(size_t); - int32_t SkToS32(long); - uint32_t SkToU32(size_t); + SK_API int8_t SkToS8(long); + SK_API uint8_t SkToU8(size_t); + SK_API int16_t SkToS16(long); + SK_API uint16_t SkToU16(size_t); + SK_API int32_t SkToS32(long); + SK_API uint32_t SkToU32(size_t); #else #define SkToS8(x) ((int8_t)(x)) #define SkToU8(x) ((uint8_t)(x)) @@ -337,7 +337,7 @@ template <typename Dst> Dst SkTCast(const void* ptr) { SkNoncopyable is the base class for objects that may do not want to be copied. It hides its copy-constructor and its assignment-operator. */ -class SkNoncopyable { +class SK_API SkNoncopyable { public: SkNoncopyable() {} diff --git a/include/core/SkUnPreMultiply.h b/include/core/SkUnPreMultiply.h index 4bdb980..44ea50e 100644 --- a/include/core/SkUnPreMultiply.h +++ b/include/core/SkUnPreMultiply.h @@ -22,7 +22,7 @@ #include "SkColor.h" -class SkUnPreMultiply { +class SK_API SkUnPreMultiply { public: typedef uint32_t Scale; diff --git a/include/core/SkXfermode.h b/include/core/SkXfermode.h index 714468c..e954633 100644 --- a/include/core/SkXfermode.h +++ b/include/core/SkXfermode.h @@ -28,7 +28,7 @@ specified in the Modes enum. When an SkXfermode is assigned to an SkPaint, then objects drawn with that paint have the xfermode applied. */ -class SkXfermode : public SkFlattenable { +class SK_API SkXfermode : public SkFlattenable { public: SkXfermode() {} diff --git a/include/effects/SkBlurDrawLooper.h b/include/effects/SkBlurDrawLooper.h index e7af5c2..101d24e 100644 --- a/include/effects/SkBlurDrawLooper.h +++ b/include/effects/SkBlurDrawLooper.h @@ -28,7 +28,7 @@ class SkColorFilter; the original object in its original position. should there be an option to just draw the shadow/blur layer? webkit? */ -class SkBlurDrawLooper : public SkDrawLooper { +class SK_API SkBlurDrawLooper : public SkDrawLooper { public: enum BlurFlags { kNone_BlurFlag = 0x00, diff --git a/include/effects/SkCornerPathEffect.h b/include/effects/SkCornerPathEffect.h index a459478..823de3f 100644 --- a/include/effects/SkCornerPathEffect.h +++ b/include/effects/SkCornerPathEffect.h @@ -24,7 +24,7 @@ SkCornerPathEffect is a subclass of SkPathEffect that can turn sharp corners into various treatments (e.g. rounded corners) */ -class SkCornerPathEffect : public SkPathEffect { +class SK_API SkCornerPathEffect : public SkPathEffect { public: /** radius must be > 0 to have an effect. It specifies the distance from each corner that should be "rounded". diff --git a/include/effects/SkDashPathEffect.h b/include/effects/SkDashPathEffect.h index cc414e3..145f67d 100644 --- a/include/effects/SkDashPathEffect.h +++ b/include/effects/SkDashPathEffect.h @@ -23,7 +23,7 @@ SkDashPathEffect is a subclass of SkPathEffect that implements dashing */ -class SkDashPathEffect : public SkPathEffect { +class SK_API SkDashPathEffect : public SkPathEffect { public: /** The intervals array must contain an even number of entries (>=2), with the even indices specifying the "on" intervals, and the odd indices specifying the "off" diff --git a/include/effects/SkGradientShader.h b/include/effects/SkGradientShader.h index c800c66..5623be4 100644 --- a/include/effects/SkGradientShader.h +++ b/include/effects/SkGradientShader.h @@ -26,7 +26,7 @@ class SkUnitMapper; SkGradientShader hosts factories for creating subclasses of SkShader that render linear and radial gradients. */ -class SkGradientShader { +class SK_API SkGradientShader { public: /** Returns a shader that generates a linear gradient between the two specified points. diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h index 3fed99a..8852803 100644 --- a/include/gpu/SkGpuDevice.h +++ b/include/gpu/SkGpuDevice.h @@ -109,6 +109,7 @@ public: const SkPaint& paint); virtual void drawDevice(const SkDraw&, SkDevice*, int x, int y, const SkPaint&); + virtual bool filterTextFlags(const SkPaint& paint, TextFlags*); virtual void flush() { fContext->flush(false); } diff --git a/include/gpu/SkGr.h b/include/gpu/SkGr.h index 6f5ebfe..7221213 100644 --- a/include/gpu/SkGr.h +++ b/include/gpu/SkGr.h @@ -231,7 +231,7 @@ public: SkGrRegionIterator() {} SkGrRegionIterator(const SkRegion& region) { this->reset(region); } - void reset(const SkRegion& region) { + void reset(const SkRegion& region) { fRegion = ®ion; fIter.reset(region); } @@ -275,6 +275,7 @@ public: // overrides virtual const GrKey* getKey(); + virtual GrMaskFormat getMaskFormat(); virtual bool getPackedGlyphBounds(GrGlyph::PackedID, GrIRect* bounds); virtual bool getPackedGlyphImage(GrGlyph::PackedID, int width, int height, int rowBytes, void* image); diff --git a/include/ports/SkTypeface_win.h b/include/ports/SkTypeface_win.h index 95a7b8c..88678d1 100644 --- a/include/ports/SkTypeface_win.h +++ b/include/ports/SkTypeface_win.h @@ -25,7 +25,7 @@ * corresponding typeface for the specified logfont. The caller is responsible * for calling unref() when it is finished. */ -extern SkTypeface* SkCreateTypefaceFromLOGFONT(const LOGFONT&); +SK_API extern SkTypeface* SkCreateTypefaceFromLOGFONT(const LOGFONT&); #endif |