2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2012 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SKDRAWCOMMAND_H_
|
|
|
|
#define SKDRAWCOMMAND_H_
|
|
|
|
|
|
|
|
#include "SkPictureFlat.h"
|
|
|
|
#include "SkCanvas.h"
|
|
|
|
|
|
|
|
class SkDrawCommand {
|
|
|
|
public:
|
|
|
|
/* TODO(chudy): Remove subclasses. */
|
|
|
|
SkDrawCommand();
|
|
|
|
|
|
|
|
virtual ~SkDrawCommand();
|
|
|
|
|
2012-08-07 20:41:37 +00:00
|
|
|
virtual SkString toString();
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
virtual const char* toCString() {
|
|
|
|
return GetCommandString(fDrawType);
|
|
|
|
}
|
|
|
|
|
2012-07-31 19:55:32 +00:00
|
|
|
bool isVisible() const {
|
|
|
|
return fVisible;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setVisible(bool toggle) {
|
|
|
|
fVisible = toggle;
|
|
|
|
}
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2012-08-07 20:41:37 +00:00
|
|
|
SkTDArray<SkString*>* Info() {return &fInfo; };
|
2012-06-29 14:21:22 +00:00
|
|
|
virtual void execute(SkCanvas* canvas)=0;
|
2012-11-27 16:09:42 +00:00
|
|
|
/** Does nothing by default, but used by save() and restore()-type
|
|
|
|
subclassse to track unresolved save() calls. */
|
|
|
|
virtual void trackSaveState(int* state) { };
|
2012-06-29 14:21:22 +00:00
|
|
|
DrawType getType() { return fDrawType; };
|
|
|
|
|
2012-11-21 17:11:02 +00:00
|
|
|
virtual const SkBitmap* getBitmap() const { return NULL; }
|
|
|
|
|
2012-11-19 20:44:29 +00:00
|
|
|
static const char* GetCommandString(DrawType type);
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
protected:
|
|
|
|
DrawType fDrawType;
|
2012-08-07 20:41:37 +00:00
|
|
|
SkTDArray<SkString*> fInfo;
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool fVisible;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Restore : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
Restore();
|
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
2012-11-27 16:09:42 +00:00
|
|
|
virtual void trackSaveState(int* state) SK_OVERRIDE;
|
2013-03-22 16:33:31 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Clear : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
Clear(SkColor color);
|
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
|
|
|
private:
|
|
|
|
SkColor fColor;
|
2013-03-22 16:33:31 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ClipPath : public SkDrawCommand {
|
|
|
|
public:
|
2012-11-21 17:11:02 +00:00
|
|
|
ClipPath(const SkPath& path, SkRegion::Op op, bool doAA, SkBitmap& bitmap);
|
2012-06-29 14:21:22 +00:00
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
2012-11-21 17:11:02 +00:00
|
|
|
virtual const SkBitmap* getBitmap() const SK_OVERRIDE;
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
2013-03-22 16:33:31 +00:00
|
|
|
SkPath fPath;
|
2012-06-29 14:21:22 +00:00
|
|
|
SkRegion::Op fOp;
|
2013-03-22 16:33:31 +00:00
|
|
|
bool fDoAA;
|
|
|
|
SkBitmap fBitmap;
|
2013-03-17 18:33:46 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ClipRegion : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
ClipRegion(const SkRegion& region, SkRegion::Op op);
|
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
|
|
|
private:
|
2013-03-22 16:33:31 +00:00
|
|
|
SkRegion fRegion;
|
2012-06-29 14:21:22 +00:00
|
|
|
SkRegion::Op fOp;
|
2013-03-22 16:33:31 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ClipRect : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
ClipRect(const SkRect& rect, SkRegion::Op op, bool doAA);
|
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
2013-03-11 22:53:11 +00:00
|
|
|
|
2013-03-22 12:25:30 +00:00
|
|
|
const SkRect& rect() const { return fRect; }
|
2013-03-11 22:53:11 +00:00
|
|
|
SkRegion::Op op() const { return fOp; }
|
|
|
|
bool doAA() const { return fDoAA; }
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
2013-03-22 12:25:30 +00:00
|
|
|
SkRect fRect;
|
2012-06-29 14:21:22 +00:00
|
|
|
SkRegion::Op fOp;
|
2013-03-22 12:25:30 +00:00
|
|
|
bool fDoAA;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
2013-01-02 20:20:31 +00:00
|
|
|
class ClipRRect : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
ClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA);
|
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
2013-03-11 22:53:11 +00:00
|
|
|
|
|
|
|
const SkRRect& rrect() const { return fRRect; }
|
|
|
|
SkRegion::Op op() const { return fOp; }
|
|
|
|
bool doAA() const { return fDoAA; }
|
|
|
|
|
2013-01-02 20:20:31 +00:00
|
|
|
private:
|
2013-03-22 12:25:30 +00:00
|
|
|
SkRRect fRRect;
|
2013-01-02 20:20:31 +00:00
|
|
|
SkRegion::Op fOp;
|
2013-03-22 12:25:30 +00:00
|
|
|
bool fDoAA;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2013-01-02 20:20:31 +00:00
|
|
|
};
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
class Concat : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
Concat(const SkMatrix& matrix);
|
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
|
|
|
private:
|
2013-03-22 16:33:31 +00:00
|
|
|
SkMatrix fMatrix;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DrawBitmap : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
DrawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
|
2013-03-22 16:33:31 +00:00
|
|
|
const SkPaint* paint, SkBitmap& resizedBitmap);
|
2012-06-29 14:21:22 +00:00
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
2012-11-26 13:09:17 +00:00
|
|
|
virtual const SkBitmap* getBitmap() const SK_OVERRIDE;
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
2013-03-22 16:33:31 +00:00
|
|
|
SkBitmap fBitmap;
|
2012-06-29 14:21:22 +00:00
|
|
|
SkScalar fLeft;
|
|
|
|
SkScalar fTop;
|
2013-03-22 16:33:31 +00:00
|
|
|
SkPaint fPaint;
|
|
|
|
SkPaint* fPaintPtr;
|
2012-11-26 13:09:17 +00:00
|
|
|
SkBitmap fResizedBitmap;
|
2013-03-22 16:33:31 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DrawBitmapMatrix : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
DrawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& matrix,
|
2013-03-22 16:33:31 +00:00
|
|
|
const SkPaint* paint, SkBitmap& resizedBitmap);
|
2012-06-29 14:21:22 +00:00
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
2012-11-26 13:09:17 +00:00
|
|
|
virtual const SkBitmap* getBitmap() const SK_OVERRIDE;
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
2013-03-22 16:33:31 +00:00
|
|
|
SkBitmap fBitmap;
|
|
|
|
SkMatrix fMatrix;
|
|
|
|
SkPaint fPaint;
|
|
|
|
SkPaint* fPaintPtr;
|
2012-11-26 13:09:17 +00:00
|
|
|
SkBitmap fResizedBitmap;
|
2013-03-22 16:33:31 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DrawBitmapNine : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
DrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
|
2013-03-23 07:01:28 +00:00
|
|
|
const SkRect& dst, const SkPaint* paint,
|
2013-03-22 16:33:31 +00:00
|
|
|
SkBitmap& resizedBitmap);
|
2012-06-29 14:21:22 +00:00
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
2012-11-26 13:09:17 +00:00
|
|
|
virtual const SkBitmap* getBitmap() const SK_OVERRIDE;
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
2013-03-22 16:33:31 +00:00
|
|
|
SkBitmap fBitmap;
|
|
|
|
SkIRect fCenter;
|
|
|
|
SkRect fDst;
|
|
|
|
SkPaint fPaint;
|
|
|
|
SkPaint* fPaintPtr;
|
2012-11-26 13:09:17 +00:00
|
|
|
SkBitmap fResizedBitmap;
|
2013-03-22 16:33:31 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DrawBitmapRect : public SkDrawCommand {
|
|
|
|
public:
|
2012-09-18 15:14:33 +00:00
|
|
|
DrawBitmapRect(const SkBitmap& bitmap, const SkRect* src,
|
2013-03-18 07:01:03 +00:00
|
|
|
const SkRect& dst, const SkPaint* paint,
|
2013-03-17 18:33:46 +00:00
|
|
|
SkBitmap& resizedBitmap);
|
2012-06-29 14:21:22 +00:00
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
2012-11-26 13:09:17 +00:00
|
|
|
virtual const SkBitmap* getBitmap() const SK_OVERRIDE;
|
2013-01-31 15:56:22 +00:00
|
|
|
|
2013-03-28 12:25:25 +00:00
|
|
|
const SkBitmap& bitmap() const { return fBitmap; }
|
|
|
|
|
2013-01-31 15:56:22 +00:00
|
|
|
// The non-const 'paint' method allows modification of this object's
|
|
|
|
// SkPaint. For this reason the ctor and setPaint method make a local copy.
|
|
|
|
// The 'fPaintPtr' member acts a signal that the local SkPaint is valid
|
|
|
|
// (since only an SkPaint* is passed into the ctor).
|
|
|
|
const SkPaint* paint() const { return fPaintPtr; }
|
|
|
|
SkPaint* paint() { return fPaintPtr; }
|
|
|
|
|
|
|
|
void setPaint(const SkPaint& paint) { fPaint = paint; fPaintPtr = &fPaint; }
|
|
|
|
|
2013-03-17 18:33:46 +00:00
|
|
|
const SkRect* srcRect() const { return fSrc.isEmpty() ? NULL : &fSrc; }
|
|
|
|
const SkRect& dstRect() const { return fDst; }
|
2013-03-11 22:53:11 +00:00
|
|
|
|
2013-03-28 12:25:25 +00:00
|
|
|
void setSrcRect(const SkRect& src) { fSrc = src; }
|
|
|
|
void setDstRect(const SkRect& dst) { fDst = dst; }
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
2013-03-17 18:33:46 +00:00
|
|
|
SkBitmap fBitmap;
|
2013-03-22 16:33:31 +00:00
|
|
|
SkRect fSrc;
|
|
|
|
SkRect fDst;
|
|
|
|
SkPaint fPaint;
|
|
|
|
SkPaint* fPaintPtr;
|
2012-11-26 13:09:17 +00:00
|
|
|
SkBitmap fResizedBitmap;
|
2013-03-17 18:33:46 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DrawData : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
DrawData(const void* data, size_t length);
|
2013-03-25 11:50:42 +00:00
|
|
|
virtual ~DrawData() { delete [] fData; }
|
2012-06-29 14:21:22 +00:00
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
|
|
|
private:
|
2013-03-25 12:01:45 +00:00
|
|
|
char* fData;
|
2012-06-29 14:21:22 +00:00
|
|
|
size_t fLength;
|
2013-03-25 11:50:42 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
2013-01-02 20:20:31 +00:00
|
|
|
class DrawOval : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
DrawOval(const SkRect& oval, const SkPaint& paint);
|
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
|
|
|
private:
|
2013-03-22 12:25:30 +00:00
|
|
|
SkRect fOval;
|
|
|
|
SkPaint fPaint;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2013-01-02 20:20:31 +00:00
|
|
|
};
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
class DrawPaint : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
DrawPaint(const SkPaint& paint);
|
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
|
|
|
private:
|
2013-03-22 12:25:30 +00:00
|
|
|
SkPaint fPaint;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DrawPath : public SkDrawCommand {
|
|
|
|
public:
|
2012-11-21 17:11:02 +00:00
|
|
|
DrawPath(const SkPath& path, const SkPaint& paint, SkBitmap& bitmap);
|
2012-06-29 14:21:22 +00:00
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
2012-11-21 18:37:58 +00:00
|
|
|
virtual const SkBitmap* getBitmap() const SK_OVERRIDE;
|
2012-11-21 17:11:02 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
2013-03-25 11:50:42 +00:00
|
|
|
SkPath fPath;
|
|
|
|
SkPaint fPaint;
|
2012-11-21 17:11:02 +00:00
|
|
|
SkBitmap fBitmap;
|
2013-03-17 18:33:46 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DrawPicture : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
DrawPicture(SkPicture& picture);
|
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
|
|
|
private:
|
2013-03-25 11:50:42 +00:00
|
|
|
SkPicture fPicture;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DrawPoints : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
DrawPoints(SkCanvas::PointMode mode, size_t count, const SkPoint pts[],
|
2013-03-22 12:25:30 +00:00
|
|
|
const SkPaint& paint);
|
|
|
|
virtual ~DrawPoints() { delete [] fPts; }
|
2012-06-29 14:21:22 +00:00
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
2013-03-22 12:25:30 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
|
|
|
SkCanvas::PointMode fMode;
|
2013-03-22 12:25:30 +00:00
|
|
|
size_t fCount;
|
|
|
|
SkPoint* fPts;
|
|
|
|
SkPaint fPaint;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* TODO(chudy): DrawText is a predefined macro and was breaking something
|
|
|
|
* in the windows build of the debugger.
|
|
|
|
*/
|
|
|
|
class DrawTextC : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
DrawTextC(const void* text, size_t byteLength, SkScalar x, SkScalar y,
|
2013-03-25 11:50:42 +00:00
|
|
|
const SkPaint& paint);
|
|
|
|
virtual ~DrawTextC() { delete [] fText; }
|
2012-06-29 14:21:22 +00:00
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
|
|
|
private:
|
2013-03-25 12:01:45 +00:00
|
|
|
char* fText;
|
2013-03-25 11:50:42 +00:00
|
|
|
size_t fByteLength;
|
2012-06-29 14:21:22 +00:00
|
|
|
SkScalar fX;
|
|
|
|
SkScalar fY;
|
2013-03-25 11:50:42 +00:00
|
|
|
SkPaint fPaint;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DrawPosText : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
DrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
|
2013-03-22 12:25:30 +00:00
|
|
|
const SkPaint& paint);
|
|
|
|
virtual ~DrawPosText() { delete [] fPos; delete [] fText; }
|
2012-06-29 14:21:22 +00:00
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
|
|
|
private:
|
2013-03-25 11:50:42 +00:00
|
|
|
char* fText;
|
|
|
|
size_t fByteLength;
|
2013-03-22 12:25:30 +00:00
|
|
|
SkPoint* fPos;
|
2013-03-25 11:50:42 +00:00
|
|
|
SkPaint fPaint;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DrawTextOnPath : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
DrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
|
2013-03-22 12:25:30 +00:00
|
|
|
const SkMatrix* matrix, const SkPaint& paint);
|
2013-03-25 11:50:42 +00:00
|
|
|
virtual ~DrawTextOnPath() { delete [] fText; }
|
2012-06-29 14:21:22 +00:00
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
|
|
|
private:
|
2013-03-25 12:01:45 +00:00
|
|
|
char* fText;
|
2013-03-25 11:50:42 +00:00
|
|
|
size_t fByteLength;
|
|
|
|
SkPath fPath;
|
|
|
|
SkMatrix fMatrix;
|
|
|
|
SkPaint fPaint;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DrawPosTextH : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
DrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
|
2013-03-17 18:33:46 +00:00
|
|
|
SkScalar constY, const SkPaint& paint);
|
2013-03-22 12:25:30 +00:00
|
|
|
virtual ~DrawPosTextH() { delete [] fXpos; delete [] fText; }
|
2012-06-29 14:21:22 +00:00
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
|
|
|
private:
|
2013-03-22 12:25:30 +00:00
|
|
|
SkScalar* fXpos;
|
2013-03-25 11:50:42 +00:00
|
|
|
char* fText;
|
|
|
|
size_t fByteLength;
|
|
|
|
SkScalar fConstY;
|
|
|
|
SkPaint fPaint;
|
2013-03-17 18:33:46 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DrawRectC : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
DrawRectC(const SkRect& rect, const SkPaint& paint);
|
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
2013-03-11 22:53:11 +00:00
|
|
|
|
2013-03-17 18:33:46 +00:00
|
|
|
const SkRect& rect() const { return fRect; }
|
|
|
|
const SkPaint& paint() const { return fPaint; }
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
2013-03-17 18:33:46 +00:00
|
|
|
SkRect fRect;
|
|
|
|
SkPaint fPaint;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
2013-01-02 20:20:31 +00:00
|
|
|
class DrawRRect : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
DrawRRect(const SkRRect& rrect, const SkPaint& paint);
|
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
|
|
|
private:
|
|
|
|
SkRRect fRRect;
|
2013-03-11 22:53:11 +00:00
|
|
|
SkPaint fPaint;
|
2013-03-25 11:50:42 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2013-01-02 20:20:31 +00:00
|
|
|
};
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
class DrawSprite : public SkDrawCommand {
|
|
|
|
public:
|
2012-11-26 13:09:17 +00:00
|
|
|
DrawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint,
|
|
|
|
SkBitmap& resizedBitmap);
|
2012-06-29 14:21:22 +00:00
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
2012-11-26 13:09:17 +00:00
|
|
|
virtual const SkBitmap* getBitmap() const SK_OVERRIDE;
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
2013-03-25 11:50:42 +00:00
|
|
|
SkBitmap fBitmap;
|
|
|
|
int fLeft;
|
|
|
|
int fTop;
|
|
|
|
SkPaint fPaint;
|
|
|
|
SkPaint* fPaintPtr;
|
2012-11-26 13:09:17 +00:00
|
|
|
SkBitmap fResizedBitmap;
|
2013-03-25 11:50:42 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DrawVertices : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
DrawVertices(SkCanvas::VertexMode vmode, int vertexCount,
|
2013-03-26 07:01:04 +00:00
|
|
|
const SkPoint vertices[], const SkPoint texs[],
|
|
|
|
const SkColor colors[], SkXfermode* xfermode,
|
2013-03-25 11:50:42 +00:00
|
|
|
const uint16_t indices[], int indexCount,
|
|
|
|
const SkPaint& paint);
|
|
|
|
virtual ~DrawVertices();
|
2012-06-29 14:21:22 +00:00
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
|
|
|
private:
|
|
|
|
SkCanvas::VertexMode fVmode;
|
2013-03-25 11:50:42 +00:00
|
|
|
int fVertexCount;
|
|
|
|
SkPoint* fVertices;
|
|
|
|
SkPoint* fTexs;
|
|
|
|
SkColor* fColors;
|
2012-06-29 14:21:22 +00:00
|
|
|
SkXfermode* fXfermode;
|
2013-03-25 11:50:42 +00:00
|
|
|
uint16_t* fIndices;
|
|
|
|
int fIndexCount;
|
|
|
|
SkPaint fPaint;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Rotate : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
Rotate(SkScalar degrees);
|
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
|
|
|
private:
|
|
|
|
SkScalar fDegrees;
|
2013-03-25 11:50:42 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Save : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
Save(SkCanvas::SaveFlags flags);
|
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
2012-11-27 16:09:42 +00:00
|
|
|
virtual void trackSaveState(int* state) SK_OVERRIDE;
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
|
|
|
SkCanvas::SaveFlags fFlags;
|
2013-03-22 16:33:31 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SaveLayer : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
SaveLayer(const SkRect* bounds, const SkPaint* paint,
|
2013-03-22 16:33:31 +00:00
|
|
|
SkCanvas::SaveFlags flags);
|
2012-06-29 14:21:22 +00:00
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
2012-11-27 16:09:42 +00:00
|
|
|
virtual void trackSaveState(int* state) SK_OVERRIDE;
|
2013-01-31 15:56:22 +00:00
|
|
|
|
2013-03-22 16:33:31 +00:00
|
|
|
const SkPaint* paint() const { return fPaintPtr; }
|
2013-01-31 15:56:22 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
2013-03-22 16:33:31 +00:00
|
|
|
SkRect fBounds;
|
|
|
|
SkPaint fPaint;
|
|
|
|
SkPaint* fPaintPtr;
|
2012-06-29 14:21:22 +00:00
|
|
|
SkCanvas::SaveFlags fFlags;
|
2013-03-22 16:33:31 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Scale : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
Scale(SkScalar sx, SkScalar sy);
|
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
2013-03-17 18:46:16 +00:00
|
|
|
|
|
|
|
SkScalar x() const { return fSx; }
|
|
|
|
SkScalar y() const { return fSy; }
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
|
|
|
SkScalar fSx;
|
|
|
|
SkScalar fSy;
|
2013-03-25 11:50:42 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SetMatrix : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
SetMatrix(const SkMatrix& matrix);
|
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
|
|
|
private:
|
2013-02-19 21:00:26 +00:00
|
|
|
SkMatrix fMatrix;
|
2013-03-25 11:50:42 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Skew : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
Skew(SkScalar sx, SkScalar sy);
|
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
|
|
|
private:
|
|
|
|
SkScalar fSx;
|
|
|
|
SkScalar fSy;
|
2013-03-25 11:50:42 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Translate : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
Translate(SkScalar dx, SkScalar dy);
|
|
|
|
virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
|
2013-03-17 18:46:16 +00:00
|
|
|
|
|
|
|
SkScalar x() const { return fDx; }
|
|
|
|
SkScalar y() const { return fDy; }
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
|
|
|
SkScalar fDx;
|
|
|
|
SkScalar fDy;
|
2013-03-25 11:50:42 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|