#include "SkPaint.h"
class SkBitmap;
-class SkBounder;
class SkClipStack;
class SkBaseDevice;
+class SkBlitter;
class SkMatrix;
class SkPath;
class SkRegion;
class SkRasterClip;
struct SkDrawProcs;
struct SkRect;
+class SkRRect;
class SkDraw {
public:
void drawPoints(SkCanvas::PointMode, size_t count, const SkPoint[],
const SkPaint&, bool forceUseDevice = false) const;
void drawRect(const SkRect&, const SkPaint&) const;
+ void drawRRect(const SkRRect&, const SkPaint&) const;
/**
* To save on mallocs, we allow a flag that tells us that srcPath is
* mutable, so that we don't have to make copies of it as we transform it.
* affect the geometry/rasterization, then the pre matrix can just be
* pre-concated with the current matrix.
*/
- void drawPath(const SkPath& srcPath, const SkPaint&,
- const SkMatrix* prePathMatrix, bool pathIsMutable) const;
+ void drawPath(const SkPath& path, const SkPaint& paint,
+ const SkMatrix* prePathMatrix, bool pathIsMutable) const {
+ this->drawPath(path, paint, prePathMatrix, pathIsMutable, false);
+ }
+
+ void drawPath(const SkPath& path, const SkPaint& paint,
+ SkBlitter* customBlitter = NULL) const {
+ this->drawPath(path, paint, NULL, false, false, customBlitter);
+ }
+
void drawBitmap(const SkBitmap&, const SkMatrix&, const SkPaint&) const;
void drawSprite(const SkBitmap&, int x, int y, const SkPaint&) const;
void drawText(const char text[], size_t byteLength, SkScalar x,
SkScalar y, const SkPaint& paint) const;
void drawPosText(const char text[], size_t byteLength,
- const SkScalar pos[], SkScalar constY,
- int scalarsPerPosition, const SkPaint& paint) const;
+ const SkScalar pos[], int scalarsPerPosition,
+ const SkPoint& offset, const SkPaint& paint) const;
void drawTextOnPath(const char text[], size_t byteLength,
const SkPath&, const SkMatrix*, const SkPaint&) const;
-#ifdef SK_BUILD_FOR_ANDROID
- void drawPosTextOnPath(const char text[], size_t byteLength,
- const SkPoint pos[], const SkPaint& paint,
- const SkPath& path, const SkMatrix* matrix) const;
-#endif
void drawVertices(SkCanvas::VertexMode mode, int count,
const SkPoint vertices[], const SkPoint textures[],
const SkColor colors[], SkXfermode* xmode,
const uint16_t indices[], int ptCount,
const SkPaint& paint) const;
- void drawPath(const SkPath& src, const SkPaint& paint) const {
- this->drawPath(src, paint, NULL, false);
+ /**
+ * Overwrite the target with the path's coverage (i.e. its mask).
+ * Will overwrite the entire device, so it need not be zero'd first.
+ *
+ * Only device A8 is supported right now.
+ */
+ void drawPathCoverage(const SkPath& src, const SkPaint& paint,
+ SkBlitter* customBlitter = NULL) const {
+ this->drawPath(src, paint, NULL, false, true, customBlitter);
}
/** Helper function that creates a mask from a path and an optional maskfilter.
static RectType ComputeRectType(const SkPaint&, const SkMatrix&,
SkPoint* strokeSize);
- void drawText_asPaths(const char text[], size_t byteLength,
- SkScalar x, SkScalar y, const SkPaint&) const;
- void drawPosText_asPaths(const char text[], size_t byteLength,
- const SkScalar pos[], SkScalar constY,
- int scalarsPerPosition, const SkPaint&) const;
+ static bool ShouldDrawTextAsPaths(const SkPaint&, const SkMatrix&);
+ void drawText_asPaths(const char text[], size_t byteLength,
+ SkScalar x, SkScalar y, const SkPaint&) const;
+ void drawPosText_asPaths(const char text[], size_t byteLength,
+ const SkScalar pos[], int scalarsPerPosition,
+ const SkPoint& offset, const SkPaint&) const;
private:
void drawDevMask(const SkMask& mask, const SkPaint&) const;
void drawBitmapAsMask(const SkBitmap&, const SkPaint&) const;
+ void drawPath(const SkPath&, const SkPaint&, const SkMatrix* preMatrix,
+ bool pathIsMutable, bool drawCoverage,
+ SkBlitter* customBlitter = NULL) const;
+
/**
* Return the current clip bounds, in local coordinates, with slop to account
* for antialiasing or hairlines (i.e. device-bounds outset by 1, and then
bool SK_WARN_UNUSED_RESULT
computeConservativeLocalClipBounds(SkRect* bounds) const;
- static bool ShouldDrawTextAsPaths(const SkPaint&, const SkMatrix&);
-
public:
const SkBitmap* fBitmap; // required
const SkMatrix* fMatrix; // required
const SkClipStack* fClipStack; // optional
SkBaseDevice* fDevice; // optional
- SkBounder* fBounder; // optional
SkDrawProcs* fProcs; // optional
#ifdef SK_DEBUG