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_
|
|
|
|
|
2016-03-21 17:19:39 +00:00
|
|
|
#include "png.h"
|
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
#include "SkCanvas.h"
|
2015-08-05 20:57:49 +00:00
|
|
|
#include "SkTLazy.h"
|
|
|
|
#include "SkPath.h"
|
|
|
|
#include "SkRRect.h"
|
2013-05-29 13:24:23 +00:00
|
|
|
#include "SkString.h"
|
2015-08-05 20:57:49 +00:00
|
|
|
#include "SkTDArray.h"
|
2016-02-10 13:40:46 +00:00
|
|
|
#include "SkJSONCPP.h"
|
2016-02-11 18:35:21 +00:00
|
|
|
#include "UrlDataManager.h"
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2013-06-13 20:59:14 +00:00
|
|
|
class SK_API SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2015-02-13 19:13:00 +00:00
|
|
|
enum OpType {
|
2015-04-02 03:58:37 +00:00
|
|
|
kBeginDrawPicture_OpType,
|
2015-02-13 19:13:00 +00:00
|
|
|
kClipPath_OpType,
|
|
|
|
kClipRegion_OpType,
|
|
|
|
kClipRect_OpType,
|
|
|
|
kClipRRect_OpType,
|
|
|
|
kConcat_OpType,
|
|
|
|
kDrawBitmap_OpType,
|
|
|
|
kDrawBitmapNine_OpType,
|
|
|
|
kDrawBitmapRect_OpType,
|
|
|
|
kDrawClear_OpType,
|
|
|
|
kDrawDRRect_OpType,
|
2015-07-22 17:23:01 +00:00
|
|
|
kDrawImage_OpType,
|
|
|
|
kDrawImageRect_OpType,
|
2015-02-13 19:13:00 +00:00
|
|
|
kDrawOval_OpType,
|
|
|
|
kDrawPaint_OpType,
|
|
|
|
kDrawPatch_OpType,
|
|
|
|
kDrawPath_OpType,
|
|
|
|
kDrawPoints_OpType,
|
|
|
|
kDrawPosText_OpType,
|
|
|
|
kDrawPosTextH_OpType,
|
|
|
|
kDrawRect_OpType,
|
|
|
|
kDrawRRect_OpType,
|
|
|
|
kDrawText_OpType,
|
|
|
|
kDrawTextBlob_OpType,
|
|
|
|
kDrawTextOnPath_OpType,
|
|
|
|
kDrawVertices_OpType,
|
2015-04-02 03:58:37 +00:00
|
|
|
kEndDrawPicture_OpType,
|
2015-02-13 19:13:00 +00:00
|
|
|
kRestore_OpType,
|
|
|
|
kSave_OpType,
|
|
|
|
kSaveLayer_OpType,
|
|
|
|
kSetMatrix_OpType,
|
|
|
|
|
|
|
|
kLast_OpType = kSetMatrix_OpType
|
|
|
|
};
|
|
|
|
|
|
|
|
static const int kOpTypeCount = kLast_OpType + 1;
|
2015-02-12 14:37:12 +00:00
|
|
|
|
2016-03-29 16:03:52 +00:00
|
|
|
static void WritePNG(const png_bytep rgba, png_uint_32 width, png_uint_32 height,
|
2016-03-21 17:19:39 +00:00
|
|
|
SkWStream& out);
|
|
|
|
|
2015-02-13 19:13:00 +00:00
|
|
|
SkDrawCommand(OpType opType);
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
virtual ~SkDrawCommand();
|
|
|
|
|
2014-11-09 00:18:56 +00:00
|
|
|
virtual SkString toString() const;
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2014-11-09 00:18:56 +00:00
|
|
|
virtual const char* toCString() const {
|
2015-02-13 19:13:00 +00:00
|
|
|
return GetCommandString(fOpType);
|
2012-06-29 14:21:22 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2014-11-09 00:18:56 +00:00
|
|
|
const SkTDArray<SkString*>* Info() const { return &fInfo; }
|
|
|
|
virtual void execute(SkCanvas*) const = 0;
|
|
|
|
virtual void vizExecute(SkCanvas*) const {}
|
2014-10-16 21:28:28 +00:00
|
|
|
|
2014-11-09 00:18:56 +00:00
|
|
|
virtual void setUserMatrix(const SkMatrix&) {}
|
2014-10-16 21:28:28 +00:00
|
|
|
|
2014-12-12 16:46:25 +00:00
|
|
|
// The next "active" system is only used by save, saveLayer, and restore.
|
|
|
|
// It is used to determine which saveLayers are currently active (at a
|
2014-03-03 16:32:17 +00:00
|
|
|
// given point in the rendering).
|
2014-03-25 23:31:33 +00:00
|
|
|
// saves just return a kPushLayer action but don't track active state
|
|
|
|
// restores just return a kPopLayer action
|
2014-03-03 23:25:41 +00:00
|
|
|
// saveLayers return kPushLayer but also track the active state
|
2014-03-03 16:32:17 +00:00
|
|
|
enum Action {
|
|
|
|
kNone_Action,
|
2014-03-03 23:25:41 +00:00
|
|
|
kPopLayer_Action,
|
|
|
|
kPushLayer_Action,
|
2014-03-03 16:32:17 +00:00
|
|
|
};
|
|
|
|
virtual Action action() const { return kNone_Action; }
|
|
|
|
virtual void setActive(bool active) {}
|
|
|
|
virtual bool active() const { return false; }
|
|
|
|
|
2015-02-13 19:13:00 +00:00
|
|
|
OpType getType() const { return fOpType; }
|
2012-06-29 14:21:22 +00:00
|
|
|
|
2013-06-06 23:59:28 +00:00
|
|
|
virtual bool render(SkCanvas* canvas) const { return false; }
|
2012-11-21 17:11:02 +00:00
|
|
|
|
2016-02-11 18:35:21 +00:00
|
|
|
virtual Json::Value toJSON(UrlDataManager& urlDataManager) const;
|
2016-02-10 13:40:46 +00:00
|
|
|
|
|
|
|
/* Converts a JSON representation of a command into a newly-allocated SkDrawCommand object. It
|
|
|
|
* is the caller's responsibility to delete this object. This method may return null if an error
|
|
|
|
* occurs.
|
|
|
|
*/
|
2016-02-11 18:35:21 +00:00
|
|
|
static SkDrawCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +00:00
|
|
|
|
2015-02-13 19:13:00 +00:00
|
|
|
static const char* GetCommandString(OpType type);
|
2012-11-19 20:44:29 +00:00
|
|
|
|
2016-03-03 19:39:38 +00:00
|
|
|
// Helper methods for converting things to JSON
|
2016-05-04 18:06:28 +00:00
|
|
|
static Json::Value MakeJsonColor(const SkColor color);
|
|
|
|
static Json::Value MakeJsonPoint(const SkPoint& point);
|
|
|
|
static Json::Value MakeJsonPoint(SkScalar x, SkScalar y);
|
|
|
|
static Json::Value MakeJsonRect(const SkRect& rect);
|
2016-03-03 19:39:38 +00:00
|
|
|
static Json::Value MakeJsonIRect(const SkIRect&);
|
|
|
|
static Json::Value MakeJsonMatrix(const SkMatrix&);
|
2016-05-04 18:06:28 +00:00
|
|
|
static Json::Value MakeJsonPath(const SkPath& path);
|
|
|
|
static Json::Value MakeJsonRegion(const SkRegion& region);
|
|
|
|
static Json::Value MakeJsonPaint(const SkPaint& paint, UrlDataManager& urlDataManager);
|
|
|
|
|
|
|
|
static void flatten(const SkFlattenable* flattenable, Json::Value* target,
|
|
|
|
UrlDataManager& urlDataManager);
|
|
|
|
static bool flatten(const SkImage& image, Json::Value* target,
|
|
|
|
UrlDataManager& urlDataManager);
|
|
|
|
static bool flatten(const SkBitmap& bitmap, Json::Value* target,
|
|
|
|
UrlDataManager& urlDataManager);
|
2016-03-03 19:39:38 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
protected:
|
2012-08-07 20:41:37 +00:00
|
|
|
SkTDArray<SkString*> fInfo;
|
2012-06-29 14:21:22 +00:00
|
|
|
|
|
|
|
private:
|
2015-02-13 19:13:00 +00:00
|
|
|
OpType fOpType;
|
2014-03-25 23:31:33 +00:00
|
|
|
bool fVisible;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkRestoreCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkRestoreCommand();
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
|
|
|
Action action() const override { return kPopLayer_Action; }
|
2016-02-11 18:35:21 +00:00
|
|
|
static SkRestoreCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2013-03-22 16:33:31 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkClearCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkClearCommand(SkColor color);
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkClearCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
|
|
|
SkColor fColor;
|
2013-03-22 16:33:31 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkClipPathCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkClipPathCommand(const SkPath& path, SkRegion::Op op, bool doAA);
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
|
|
|
bool render(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkClipPathCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +00:00
|
|
|
|
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;
|
2013-03-17 18:33:46 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkClipRegionCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkClipRegionCommand(const SkRegion& region, SkRegion::Op op);
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkClipRegionCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkClipRectCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkClipRectCommand(const SkRect& rect, SkRegion::Op op, bool doAA);
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkClipRectCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
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-06-18 20:20:55 +00:00
|
|
|
class SkClipRRectCommand : public SkDrawCommand {
|
2013-01-02 20:20:31 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkClipRRectCommand(const SkRRect& rrect, SkRegion::Op op, bool doAA);
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
|
|
|
bool render(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkClipRRectCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
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
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkConcatCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkConcatCommand(const SkMatrix& matrix);
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkConcatCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
2013-03-22 16:33:31 +00:00
|
|
|
SkMatrix fMatrix;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkDrawBitmapCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkDrawBitmapCommand(const SkBitmap& bitmap, SkScalar left, SkScalar top,
|
2014-03-25 23:31:33 +00:00
|
|
|
const SkPaint* paint);
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
|
|
|
bool render(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkDrawBitmapCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +00:00
|
|
|
|
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;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkDrawBitmapNineCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkDrawBitmapNineCommand(const SkBitmap& bitmap, const SkIRect& center,
|
2014-03-25 23:31:33 +00:00
|
|
|
const SkRect& dst, const SkPaint* paint);
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
|
|
|
bool render(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkDrawBitmapNineCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +00:00
|
|
|
|
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;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkDrawBitmapRectCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkDrawBitmapRectCommand(const SkBitmap& bitmap, const SkRect* src,
|
2013-08-16 10:24:37 +00:00
|
|
|
const SkRect& dst, const SkPaint* paint,
|
2015-07-14 17:54:12 +00:00
|
|
|
SkCanvas::SrcRectConstraint);
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
|
|
|
bool render(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkDrawBitmapRectCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
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; }
|
|
|
|
|
2015-08-27 14:41:13 +00:00
|
|
|
const SkRect* srcRect() const { return fSrc.isEmpty() ? nullptr : &fSrc; }
|
2013-03-28 12:25:25 +00:00
|
|
|
void setSrcRect(const SkRect& src) { fSrc = src; }
|
2013-08-16 10:24:37 +00:00
|
|
|
|
|
|
|
const SkRect& dstRect() const { return fDst; }
|
2013-03-28 12:25:25 +00:00
|
|
|
void setDstRect(const SkRect& dst) { fDst = dst; }
|
|
|
|
|
2015-07-14 17:54:12 +00:00
|
|
|
SkCanvas::SrcRectConstraint constraint() const { return fConstraint; }
|
|
|
|
void setConstraint(SkCanvas::SrcRectConstraint constraint) { fConstraint = constraint; }
|
2013-08-16 10:24:37 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
2013-08-16 10:24:37 +00:00
|
|
|
SkBitmap fBitmap;
|
|
|
|
SkRect fSrc;
|
|
|
|
SkRect fDst;
|
|
|
|
SkPaint fPaint;
|
|
|
|
SkPaint* fPaintPtr;
|
2015-07-14 17:54:12 +00:00
|
|
|
SkCanvas::SrcRectConstraint fConstraint;
|
2013-03-17 18:33:46 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
2015-07-22 17:23:01 +00:00
|
|
|
class SkDrawImageCommand : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
SkDrawImageCommand(const SkImage* image, SkScalar left, SkScalar top, const SkPaint* paint);
|
|
|
|
void execute(SkCanvas* canvas) const override;
|
|
|
|
bool render(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkDrawImageCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +00:00
|
|
|
|
2015-07-22 17:23:01 +00:00
|
|
|
private:
|
|
|
|
SkAutoTUnref<const SkImage> fImage;
|
|
|
|
SkScalar fLeft;
|
|
|
|
SkScalar fTop;
|
|
|
|
SkTLazy<SkPaint> fPaint;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SkDrawImageRectCommand : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
SkDrawImageRectCommand(const SkImage* image, const SkRect* src, const SkRect& dst,
|
|
|
|
const SkPaint* paint, SkCanvas::SrcRectConstraint constraint);
|
|
|
|
void execute(SkCanvas* canvas) const override;
|
|
|
|
bool render(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkDrawImageRectCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +00:00
|
|
|
|
2015-07-22 17:23:01 +00:00
|
|
|
private:
|
|
|
|
SkAutoTUnref<const SkImage> fImage;
|
|
|
|
SkTLazy<SkRect> fSrc;
|
|
|
|
SkRect fDst;
|
|
|
|
SkTLazy<SkPaint> fPaint;
|
|
|
|
SkCanvas::SrcRectConstraint fConstraint;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkDrawOvalCommand : public SkDrawCommand {
|
2013-01-02 20:20:31 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint);
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
|
|
|
bool render(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkDrawOvalCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +00:00
|
|
|
|
2013-01-02 20:20:31 +00:00
|
|
|
private:
|
2013-03-22 12:25:30 +00:00
|
|
|
SkRect fOval;
|
|
|
|
SkPaint fPaint;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2013-01-02 20:20:31 +00:00
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkDrawPaintCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkDrawPaintCommand(const SkPaint& paint);
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
|
|
|
bool render(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkDrawPaintCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
2013-03-22 12:25:30 +00:00
|
|
|
SkPaint fPaint;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkDrawPathCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkDrawPathCommand(const SkPath& path, const SkPaint& paint);
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
|
|
|
bool render(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkDrawPathCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
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;
|
2013-03-17 18:33:46 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
2015-04-02 03:58:37 +00:00
|
|
|
class SkBeginDrawPictureCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2015-04-02 03:58:37 +00:00
|
|
|
SkBeginDrawPictureCommand(const SkPicture* picture,
|
|
|
|
const SkMatrix* matrix,
|
|
|
|
const SkPaint* paint);
|
|
|
|
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
|
|
|
bool render(SkCanvas* canvas) const override;
|
2013-11-21 17:08:12 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
2014-06-04 12:40:44 +00:00
|
|
|
SkAutoTUnref<const SkPicture> fPicture;
|
2015-04-02 03:58:37 +00:00
|
|
|
SkTLazy<SkMatrix> fMatrix;
|
|
|
|
SkTLazy<SkPaint> fPaint;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SkEndDrawPictureCommand : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
SkEndDrawPictureCommand(bool restore);
|
|
|
|
|
|
|
|
void execute(SkCanvas* canvas) const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool fRestore;
|
2013-03-25 11:50:42 +00:00
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkDrawPointsCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, const SkPoint pts[],
|
2014-03-25 23:31:33 +00:00
|
|
|
const SkPaint& paint);
|
2013-06-18 20:20:55 +00:00
|
|
|
virtual ~SkDrawPointsCommand() { delete [] fPts; }
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
|
|
|
bool render(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkDrawPointsCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +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
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkDrawTextCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkDrawTextCommand(const void* text, size_t byteLength, SkScalar x, SkScalar y,
|
2014-03-25 23:31:33 +00:00
|
|
|
const SkPaint& paint);
|
2013-06-18 20:20:55 +00:00
|
|
|
virtual ~SkDrawTextCommand() { delete [] fText; }
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkDrawTextCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkDrawPosTextCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkDrawPosTextCommand(const void* text, size_t byteLength, const SkPoint pos[],
|
|
|
|
const SkPaint& paint);
|
|
|
|
virtual ~SkDrawPosTextCommand() { delete [] fPos; delete [] fText; }
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkDrawPosTextCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkDrawTextOnPathCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkDrawTextOnPathCommand(const void* text, size_t byteLength, const SkPath& path,
|
|
|
|
const SkMatrix* matrix, const SkPaint& paint);
|
|
|
|
virtual ~SkDrawTextOnPathCommand() { delete [] fText; }
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkDrawTextOnPathCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkDrawPosTextHCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkDrawPosTextHCommand(const void* text, size_t byteLength, const SkScalar xpos[],
|
|
|
|
SkScalar constY, const SkPaint& paint);
|
|
|
|
virtual ~SkDrawPosTextHCommand() { delete [] fXpos; delete [] fText; }
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
2016-03-09 15:42:54 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkDrawPosTextHCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2014-08-26 14:56:44 +00:00
|
|
|
class SkDrawTextBlobCommand : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
SkDrawTextBlobCommand(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint);
|
|
|
|
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
|
|
|
bool render(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkDrawTextBlobCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2014-08-26 14:56:44 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
SkAutoTUnref<const SkTextBlob> fBlob;
|
|
|
|
SkScalar fXPos;
|
|
|
|
SkScalar fYPos;
|
|
|
|
SkPaint fPaint;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
|
|
|
};
|
|
|
|
|
2015-02-13 19:13:00 +00:00
|
|
|
class SkDrawPatchCommand : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
SkDrawPatchCommand(const SkPoint cubics[12], const SkColor colors[4],
|
|
|
|
const SkPoint texCoords[4], SkXfermode* xmode,
|
|
|
|
const SkPaint& paint);
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkDrawPatchCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2015-02-13 19:13:00 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
SkPoint fCubics[12];
|
2016-02-10 22:05:02 +00:00
|
|
|
SkColor* fColorsPtr;
|
|
|
|
SkColor fColors[4];
|
|
|
|
SkPoint* fTexCoordsPtr;
|
|
|
|
SkPoint fTexCoords[4];
|
2015-02-13 19:13:00 +00:00
|
|
|
SkAutoTUnref<SkXfermode> fXfermode;
|
|
|
|
SkPaint fPaint;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkDrawRectCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkDrawRectCommand(const SkRect& rect, const SkPaint& paint);
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkDrawRectCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
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-06-18 20:20:55 +00:00
|
|
|
class SkDrawRRectCommand : public SkDrawCommand {
|
2013-01-02 20:20:31 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkDrawRRectCommand(const SkRRect& rrect, const SkPaint& paint);
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
|
|
|
bool render(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkDrawRRectCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +00:00
|
|
|
|
2013-01-02 20:20:31 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2014-02-24 17:28:55 +00:00
|
|
|
class SkDrawDRRectCommand : public SkDrawCommand {
|
|
|
|
public:
|
|
|
|
SkDrawDRRectCommand(const SkRRect& outer, const SkRRect& inner,
|
|
|
|
const SkPaint& paint);
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
|
|
|
bool render(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkDrawDRRectCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +00:00
|
|
|
|
2014-02-24 17:28:55 +00:00
|
|
|
private:
|
|
|
|
SkRRect fOuter;
|
|
|
|
SkRRect fInner;
|
|
|
|
SkPaint fPaint;
|
|
|
|
|
|
|
|
typedef SkDrawCommand INHERITED;
|
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkDrawVerticesCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkDrawVerticesCommand(SkCanvas::VertexMode vmode, int vertexCount,
|
|
|
|
const SkPoint vertices[], const SkPoint texs[],
|
|
|
|
const SkColor colors[], SkXfermode* xfermode,
|
|
|
|
const uint16_t indices[], int indexCount,
|
|
|
|
const SkPaint& paint);
|
|
|
|
virtual ~SkDrawVerticesCommand();
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
2016-02-10 13:40:46 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkSaveCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2014-06-30 14:13:28 +00:00
|
|
|
SkSaveCommand();
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
|
|
|
Action action() const override { return kPushLayer_Action; }
|
2016-02-11 18:35:21 +00:00
|
|
|
static SkSaveCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
2013-03-22 16:33:31 +00:00
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkSaveLayerCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2015-12-18 15:09:18 +00:00
|
|
|
SkSaveLayerCommand(const SkCanvas::SaveLayerRec&);
|
2016-02-10 13:40:46 +00:00
|
|
|
virtual ~SkSaveLayerCommand();
|
2015-03-26 01:17:31 +00:00
|
|
|
void execute(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkSaveLayerCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2015-03-26 01:17:31 +00:00
|
|
|
void vizExecute(SkCanvas* canvas) const override;
|
|
|
|
Action action() const override{ return kPushLayer_Action; }
|
|
|
|
void setActive(bool active) override { fActive = active; }
|
|
|
|
bool active() const override { return fActive; }
|
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:
|
2016-02-10 13:40:46 +00:00
|
|
|
SkRect fBounds;
|
|
|
|
SkPaint fPaint;
|
|
|
|
SkPaint* fPaintPtr;
|
|
|
|
const SkImageFilter* fBackdrop;
|
|
|
|
uint32_t fSaveLayerFlags;
|
2013-03-22 16:33:31 +00:00
|
|
|
|
2015-12-18 15:09:18 +00:00
|
|
|
bool fActive;
|
2014-03-03 16:32:17 +00:00
|
|
|
|
2013-03-22 16:33:31 +00:00
|
|
|
typedef SkDrawCommand INHERITED;
|
2012-06-29 14:21:22 +00:00
|
|
|
};
|
|
|
|
|
2013-06-18 20:20:55 +00:00
|
|
|
class SkSetMatrixCommand : public SkDrawCommand {
|
2012-06-29 14:21:22 +00:00
|
|
|
public:
|
2013-06-18 20:20:55 +00:00
|
|
|
SkSetMatrixCommand(const SkMatrix& matrix);
|
2015-03-26 01:17:31 +00:00
|
|
|
void setUserMatrix(const SkMatrix&) override;
|
|
|
|
void execute(SkCanvas* canvas) const override;
|
2016-02-11 18:35:21 +00:00
|
|
|
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
|
|
|
|
static SkSetMatrixCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
|
2016-02-10 13:40:46 +00:00
|
|
|
|
2012-06-29 14:21:22 +00:00
|
|
|
private:
|
2014-10-16 21:28:28 +00:00
|
|
|
SkMatrix fUserMatrix;
|
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
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|