Add code needed to build skia as a windows dll within the chromium project.

- Export/import skia APIs if SKIA_DLL is defined.
- This change has no effect on skia.

Review URL: http://codereview.appspot.com/4282042

git-svn-id: http://skia.googlecode.com/svn/trunk@944 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
ctguil@chromium.org 2011-03-15 21:27:08 +00:00
parent f67e4cf4c1
commit 7ffb1b21ab
33 changed files with 66 additions and 50 deletions

View File

@ -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;

View File

@ -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);

View File

@ -7,7 +7,7 @@
struct SkRect;
class SkPath;
class SkClipStack {
class SK_API SkClipStack {
public:
SkClipStack();
~SkClipStack() {}

View File

@ -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
*/

View File

@ -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;

View File

@ -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.

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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&);

View File

@ -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

View File

@ -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]);
////////////////////////////////////////////////////////////////////////////////////////

View File

@ -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.

View File

@ -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,7 +56,7 @@ public:
SkPaint& operator=(const SkPaint&);
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);

View File

@ -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);

View File

@ -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() {}

View File

@ -140,7 +140,7 @@ struct SkIPoint {
}
};
struct SkPoint {
struct SK_API SkPoint {
SkScalar fX, fY;
static SkPoint Make(SkScalar x, SkScalar y) {

View File

@ -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

View File

@ -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() {

View File

@ -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.
*/

View File

@ -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();

View File

@ -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; }

View File

@ -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();

View File

@ -19,7 +19,7 @@
#include "SkTypes.h"
template <typename T> class SkTDArray {
template <typename T> class SK_API SkTDArray {
public:
SkTDArray() {
fReserve = fCount = 0;

View File

@ -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
*/

View File

@ -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() {}

View File

@ -22,7 +22,7 @@
#include "SkColor.h"
class SkUnPreMultiply {
class SK_API SkUnPreMultiply {
public:
typedef uint32_t Scale;

View File

@ -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() {}

View File

@ -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,

View File

@ -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".

View File

@ -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"

View File

@ -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.

View File

@ -111,7 +111,7 @@ static inline void Filter_32_opaque_portable(unsigned x, unsigned y,
SkASSERT((unsigned)y <= 0xF);
int xy = x * y;
uint32_t mask = gMask_00FF00FF; //0xFF00FF;
static const uint32_t mask = gMask_00FF00FF; //0xFF00FF;
int scale = 256 - 16*y - 16*x + xy;
uint32_t lo = (a00 & mask) * scale;
@ -141,7 +141,7 @@ static inline void Filter_32_alpha_portable(unsigned x, unsigned y,
SkASSERT(alphaScale <= 256);
int xy = x * y;
uint32_t mask = gMask_00FF00FF; //0xFF00FF;
static const uint32_t mask = gMask_00FF00FF; //0xFF00FF;
int scale = 256 - 16*y - 16*x + xy;
uint32_t lo = (a00 & mask) * scale;