aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/debugger
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-09-20 08:42:38 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-20 08:42:39 -0700
commit73603f3c52ffd89fe9d035be827b566a0e7d3b79 (patch)
tree873793b81536379196233f313b1a093d02bdac0e /tools/debugger
parentcae1be5acc8148fc5cbadd8730ee7994e50a1a47 (diff)
abstract name of clipping ops, to transtion to a more restricted set
SkRegion::Op --> SkCanvas::ClipOp (alias) --> SkClipOp pre-CL needed in chrome : https://codereview.chromium.org/2355583002/ BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2355483002 Review-Url: https://codereview.chromium.org/2355483002
Diffstat (limited to 'tools/debugger')
-rw-r--r--tools/debugger/SkDebugCanvas.cpp30
-rw-r--r--tools/debugger/SkDebugCanvas.h10
-rw-r--r--tools/debugger/SkDrawCommand.cpp52
-rw-r--r--tools/debugger/SkDrawCommand.h34
-rw-r--r--tools/debugger/SkObjectParser.cpp14
-rw-r--r--tools/debugger/SkObjectParser.h2
6 files changed, 71 insertions, 71 deletions
diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp
index 4c633ab8fc..f15c68c869 100644
--- a/tools/debugger/SkDebugCanvas.cpp
+++ b/tools/debugger/SkDebugCanvas.cpp
@@ -107,7 +107,7 @@ SkDebugCanvas::SkDebugCanvas(int width, int height)
SkASSERT(!large.roundOut().isEmpty());
#endif
// call the base class' version to avoid adding a draw command
- this->INHERITED::onClipRect(large, SkRegion::kReplace_Op, kHard_ClipEdgeStyle);
+ this->INHERITED::onClipRect(large, kReplace_Op, kHard_ClipEdgeStyle);
}
SkDebugCanvas::~SkDebugCanvas() {
@@ -155,21 +155,21 @@ class SkDebugClipVisitor : public SkCanvas::ClipVisitor {
public:
SkDebugClipVisitor(SkCanvas* canvas) : fCanvas(canvas) {}
- void clipRect(const SkRect& r, SkRegion::Op, bool doAA) override {
+ void clipRect(const SkRect& r, SkCanvas::ClipOp, bool doAA) override {
SkPaint p;
p.setColor(SK_ColorRED);
p.setStyle(SkPaint::kStroke_Style);
p.setAntiAlias(doAA);
fCanvas->drawRect(r, p);
}
- void clipRRect(const SkRRect& rr, SkRegion::Op, bool doAA) override {
+ void clipRRect(const SkRRect& rr, SkCanvas::ClipOp, bool doAA) override {
SkPaint p;
p.setColor(SK_ColorGREEN);
p.setStyle(SkPaint::kStroke_Style);
p.setAntiAlias(doAA);
fCanvas->drawRRect(rr, p);
}
- void clipPath(const SkPath& path, SkRegion::Op, bool doAA) override {
+ void clipPath(const SkPath& path, SkCanvas::ClipOp, bool doAA) override {
SkPaint p;
p.setColor(SK_ColorBLUE);
p.setStyle(SkPaint::kStroke_Style);
@@ -222,7 +222,7 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index, int m) {
canvas->clear(SK_ColorWHITE);
canvas->resetMatrix();
if (!windowRect.isEmpty()) {
- canvas->clipRect(windowRect, SkRegion::kReplace_Op);
+ canvas->clipRect(windowRect, SkCanvas::kReplace_Op);
}
this->applyUserTransform(canvas);
@@ -284,7 +284,7 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index, int m) {
canvas->save();
#define LARGE_COORD 1000000000
canvas->clipRect(SkRect::MakeLTRB(-LARGE_COORD, -LARGE_COORD, LARGE_COORD, LARGE_COORD),
- SkRegion::kReverseDifference_Op);
+ SkCanvas::kReverseDifference_Op);
SkPaint clipPaint;
clipPaint.setColor(fClipVizColor);
canvas->drawPaint(clipPaint);
@@ -299,7 +299,7 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index, int m) {
if (!windowRect.isEmpty()) {
SkRect r = windowRect;
r.outset(SK_Scalar1, SK_Scalar1);
- canvas->clipRect(r, SkRegion::kReplace_Op);
+ canvas->clipRect(r, SkCanvas::kReplace_Op);
}
// visualize existing clips
SkDebugClipVisitor visitor(canvas);
@@ -320,9 +320,9 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index, int m) {
if (type != SkClipStack::Element::kEmpty_Type) {
element->asPath(&operand);
}
- SkRegion::Op elementOp = element->getOp();
+ SkCanvas::ClipOp elementOp = element->getOp();
this->addClipStackData(devPath, operand, elementOp);
- if (elementOp == SkRegion::kReplace_Op) {
+ if (elementOp == SkCanvas::kReplace_Op) {
devPath = operand;
} else {
Op(devPath, operand, (SkPathOp) elementOp, &devPath);
@@ -543,19 +543,19 @@ void SkDebugCanvas::overrideTexFiltering(bool overrideTexFiltering, SkFilterQual
this->updatePaintFilterCanvas();
}
-void SkDebugCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkDebugCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeStyle) {
this->addDrawCommand(new SkClipPathCommand(path, op, kSoft_ClipEdgeStyle == edgeStyle));
}
-void SkDebugCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkDebugCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeStyle) {
this->addDrawCommand(new SkClipRectCommand(rect, op, kSoft_ClipEdgeStyle == edgeStyle));
}
-void SkDebugCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+void SkDebugCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edgeStyle) {
this->addDrawCommand(new SkClipRRectCommand(rrect, op, kSoft_ClipEdgeStyle == edgeStyle));
}
-void SkDebugCanvas::onClipRegion(const SkRegion& region, SkRegion::Op op) {
+void SkDebugCanvas::onClipRegion(const SkRegion& region, ClipOp op) {
this->addDrawCommand(new SkClipRegionCommand(region, op));
}
@@ -828,8 +828,8 @@ void SkDebugCanvas::addPathData(const SkPath& path, const char* pathName) {
}
void SkDebugCanvas::addClipStackData(const SkPath& devPath, const SkPath& operand,
- SkRegion::Op elementOp) {
- if (elementOp == SkRegion::kReplace_Op) {
+ SkCanvas::ClipOp elementOp) {
+ if (elementOp == SkCanvas::kReplace_Op) {
if (!lastClipStackData(devPath)) {
fSaveDevPath = operand;
}
diff --git a/tools/debugger/SkDebugCanvas.h b/tools/debugger/SkDebugCanvas.h
index 6a3d92543f..5d00799e2d 100644
--- a/tools/debugger/SkDebugCanvas.h
+++ b/tools/debugger/SkDebugCanvas.h
@@ -248,10 +248,10 @@ protected:
const SkPaint*, SrcRectConstraint) override;
void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
const SkPaint*) override;
- void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override;
- void onClipRegion(const SkRegion& region, SkRegion::Op) override;
+ void onClipRect(const SkRect&, ClipOp, ClipEdgeStyle) override;
+ void onClipRRect(const SkRRect&, ClipOp, ClipEdgeStyle) override;
+ void onClipPath(const SkPath&, ClipOp, ClipEdgeStyle) override;
+ void onClipRegion(const SkRegion& region, ClipOp) override;
void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override;
@@ -310,7 +310,7 @@ private:
void resetClipStackData() { fClipStackData.reset(); fCalledAddStackData = false; }
- void addClipStackData(const SkPath& devPath, const SkPath& operand, SkRegion::Op elementOp);
+ void addClipStackData(const SkPath& devPath, const SkPath& operand, ClipOp elementOp);
void addPathData(const SkPath& path, const char* pathName);
bool lastClipStackData(const SkPath& devPath);
void outputConicPoints(const SkPoint* pts, SkScalar weight);
diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp
index 75978d4b95..35e9201b40 100644
--- a/tools/debugger/SkDrawCommand.cpp
+++ b/tools/debugger/SkDrawCommand.cpp
@@ -573,19 +573,19 @@ Json::Value SkDrawCommand::MakeJsonRegion(const SkRegion& region) {
return Json::Value("<unimplemented>");
}
-static Json::Value make_json_regionop(SkRegion::Op op) {
+static Json::Value make_json_regionop(SkCanvas::ClipOp op) {
switch (op) {
- case SkRegion::kDifference_Op:
+ case SkCanvas::kDifference_Op:
return Json::Value(SKDEBUGCANVAS_REGIONOP_DIFFERENCE);
- case SkRegion::kIntersect_Op:
+ case SkCanvas::kIntersect_Op:
return Json::Value(SKDEBUGCANVAS_REGIONOP_INTERSECT);
- case SkRegion::kUnion_Op:
+ case SkCanvas::kUnion_Op:
return Json::Value(SKDEBUGCANVAS_REGIONOP_UNION);
- case SkRegion::kXOR_Op:
+ case SkCanvas::kXOR_Op:
return Json::Value(SKDEBUGCANVAS_REGIONOP_XOR);
- case SkRegion::kReverseDifference_Op:
+ case SkCanvas::kReverseDifference_Op:
return Json::Value(SKDEBUGCANVAS_REGIONOP_REVERSE_DIFFERENCE);
- case SkRegion::kReplace_Op:
+ case SkCanvas::kReplace_Op:
return Json::Value(SKDEBUGCANVAS_REGIONOP_REPLACE);
default:
SkASSERT(false);
@@ -1605,28 +1605,28 @@ static void extract_json_path(Json::Value& path, SkPath* result) {
}
}
-SkRegion::Op get_json_regionop(Json::Value& jsonOp) {
+SkCanvas::ClipOp get_json_clipop(Json::Value& jsonOp) {
const char* op = jsonOp.asCString();
if (!strcmp(op, SKDEBUGCANVAS_REGIONOP_DIFFERENCE)) {
- return SkRegion::kDifference_Op;
+ return SkCanvas::kDifference_Op;
}
else if (!strcmp(op, SKDEBUGCANVAS_REGIONOP_INTERSECT)) {
- return SkRegion::kIntersect_Op;
+ return SkCanvas::kIntersect_Op;
}
else if (!strcmp(op, SKDEBUGCANVAS_REGIONOP_UNION)) {
- return SkRegion::kUnion_Op;
+ return SkCanvas::kUnion_Op;
}
else if (!strcmp(op, SKDEBUGCANVAS_REGIONOP_XOR)) {
- return SkRegion::kXOR_Op;
+ return SkCanvas::kXOR_Op;
}
else if (!strcmp(op, SKDEBUGCANVAS_REGIONOP_REVERSE_DIFFERENCE)) {
- return SkRegion::kReverseDifference_Op;
+ return SkCanvas::kReverseDifference_Op;
}
else if (!strcmp(op, SKDEBUGCANVAS_REGIONOP_REPLACE)) {
- return SkRegion::kReplace_Op;
+ return SkCanvas::kReplace_Op;
}
SkASSERT(false);
- return SkRegion::kIntersect_Op;
+ return SkCanvas::kIntersect_Op;
}
SkClearCommand::SkClearCommand(SkColor color) : INHERITED(kDrawClear_OpType) {
@@ -1649,14 +1649,14 @@ Json::Value SkClearCommand::toJSON(UrlDataManager& urlDataManager) const {
return new SkClearCommand(get_json_color(color));
}
-SkClipPathCommand::SkClipPathCommand(const SkPath& path, SkRegion::Op op, bool doAA)
+SkClipPathCommand::SkClipPathCommand(const SkPath& path, SkCanvas::ClipOp op, bool doAA)
: INHERITED(kClipPath_OpType) {
fPath = path;
fOp = op;
fDoAA = doAA;
fInfo.push(SkObjectParser::PathToString(path));
- fInfo.push(SkObjectParser::RegionOpToString(op));
+ fInfo.push(SkObjectParser::ClipOpToString(op));
fInfo.push(SkObjectParser::BoolToString(doAA));
}
@@ -1681,17 +1681,17 @@ SkClipPathCommand* SkClipPathCommand::fromJSON(Json::Value& command,
UrlDataManager& urlDataManager) {
SkPath path;
extract_json_path(command[SKDEBUGCANVAS_ATTRIBUTE_PATH], &path);
- return new SkClipPathCommand(path, get_json_regionop(command[SKDEBUGCANVAS_ATTRIBUTE_REGIONOP]),
+ return new SkClipPathCommand(path, get_json_clipop(command[SKDEBUGCANVAS_ATTRIBUTE_REGIONOP]),
command[SKDEBUGCANVAS_ATTRIBUTE_ANTIALIAS].asBool());
}
-SkClipRegionCommand::SkClipRegionCommand(const SkRegion& region, SkRegion::Op op)
+SkClipRegionCommand::SkClipRegionCommand(const SkRegion& region, SkCanvas::ClipOp op)
: INHERITED(kClipRegion_OpType) {
fRegion = region;
fOp = op;
fInfo.push(SkObjectParser::RegionToString(region));
- fInfo.push(SkObjectParser::RegionOpToString(op));
+ fInfo.push(SkObjectParser::ClipOpToString(op));
}
void SkClipRegionCommand::execute(SkCanvas* canvas) const {
@@ -1711,14 +1711,14 @@ SkClipRegionCommand* SkClipRegionCommand::fromJSON(Json::Value& command,
return nullptr;
}
-SkClipRectCommand::SkClipRectCommand(const SkRect& rect, SkRegion::Op op, bool doAA)
+SkClipRectCommand::SkClipRectCommand(const SkRect& rect, SkCanvas::ClipOp op, bool doAA)
: INHERITED(kClipRect_OpType) {
fRect = rect;
fOp = op;
fDoAA = doAA;
fInfo.push(SkObjectParser::RectToString(rect));
- fInfo.push(SkObjectParser::RegionOpToString(op));
+ fInfo.push(SkObjectParser::ClipOpToString(op));
fInfo.push(SkObjectParser::BoolToString(doAA));
}
@@ -1742,18 +1742,18 @@ SkClipRectCommand* SkClipRectCommand::fromJSON(Json::Value& command,
UrlDataManager& urlDataManager) {
SkRect rect;
extract_json_rect(command[SKDEBUGCANVAS_ATTRIBUTE_COORDS], &rect);
- return new SkClipRectCommand(rect, get_json_regionop(command[SKDEBUGCANVAS_ATTRIBUTE_REGIONOP]),
+ return new SkClipRectCommand(rect, get_json_clipop(command[SKDEBUGCANVAS_ATTRIBUTE_REGIONOP]),
command[SKDEBUGCANVAS_ATTRIBUTE_ANTIALIAS].asBool());
}
-SkClipRRectCommand::SkClipRRectCommand(const SkRRect& rrect, SkRegion::Op op, bool doAA)
+SkClipRRectCommand::SkClipRRectCommand(const SkRRect& rrect, SkCanvas::ClipOp op, bool doAA)
: INHERITED(kClipRRect_OpType) {
fRRect = rrect;
fOp = op;
fDoAA = doAA;
fInfo.push(SkObjectParser::RRectToString(rrect));
- fInfo.push(SkObjectParser::RegionOpToString(op));
+ fInfo.push(SkObjectParser::ClipOpToString(op));
fInfo.push(SkObjectParser::BoolToString(doAA));
}
@@ -1779,7 +1779,7 @@ SkClipRRectCommand* SkClipRRectCommand::fromJSON(Json::Value& command,
SkRRect rrect;
extract_json_rrect(command[SKDEBUGCANVAS_ATTRIBUTE_COORDS], &rrect);
return new SkClipRRectCommand(rrect,
- get_json_regionop(command[SKDEBUGCANVAS_ATTRIBUTE_REGIONOP]),
+ get_json_clipop(command[SKDEBUGCANVAS_ATTRIBUTE_REGIONOP]),
command[SKDEBUGCANVAS_ATTRIBUTE_ANTIALIAS].asBool());
}
diff --git a/tools/debugger/SkDrawCommand.h b/tools/debugger/SkDrawCommand.h
index 07dd477f6a..27b56e277a 100644
--- a/tools/debugger/SkDrawCommand.h
+++ b/tools/debugger/SkDrawCommand.h
@@ -174,69 +174,69 @@ private:
class SkClipPathCommand : public SkDrawCommand {
public:
- SkClipPathCommand(const SkPath& path, SkRegion::Op op, bool doAA);
+ SkClipPathCommand(const SkPath& path, SkCanvas::ClipOp op, bool doAA);
void execute(SkCanvas* canvas) const override;
bool render(SkCanvas* canvas) const override;
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
static SkClipPathCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
private:
- SkPath fPath;
- SkRegion::Op fOp;
- bool fDoAA;
+ SkPath fPath;
+ SkCanvas::ClipOp fOp;
+ bool fDoAA;
typedef SkDrawCommand INHERITED;
};
class SkClipRegionCommand : public SkDrawCommand {
public:
- SkClipRegionCommand(const SkRegion& region, SkRegion::Op op);
+ SkClipRegionCommand(const SkRegion& region, SkCanvas::ClipOp op);
void execute(SkCanvas* canvas) const override;
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
static SkClipRegionCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
private:
- SkRegion fRegion;
- SkRegion::Op fOp;
+ SkRegion fRegion;
+ SkCanvas::ClipOp fOp;
typedef SkDrawCommand INHERITED;
};
class SkClipRectCommand : public SkDrawCommand {
public:
- SkClipRectCommand(const SkRect& rect, SkRegion::Op op, bool doAA);
+ SkClipRectCommand(const SkRect& rect, SkCanvas::ClipOp op, bool doAA);
void execute(SkCanvas* canvas) const override;
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
static SkClipRectCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
const SkRect& rect() const { return fRect; }
- SkRegion::Op op() const { return fOp; }
+ SkCanvas::ClipOp op() const { return fOp; }
bool doAA() const { return fDoAA; }
private:
- SkRect fRect;
- SkRegion::Op fOp;
- bool fDoAA;
+ SkRect fRect;
+ SkCanvas::ClipOp fOp;
+ bool fDoAA;
typedef SkDrawCommand INHERITED;
};
class SkClipRRectCommand : public SkDrawCommand {
public:
- SkClipRRectCommand(const SkRRect& rrect, SkRegion::Op op, bool doAA);
+ SkClipRRectCommand(const SkRRect& rrect, SkCanvas::ClipOp op, bool doAA);
void execute(SkCanvas* canvas) const override;
bool render(SkCanvas* canvas) const override;
Json::Value toJSON(UrlDataManager& urlDataManager) const override;
static SkClipRRectCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
const SkRRect& rrect() const { return fRRect; }
- SkRegion::Op op() const { return fOp; }
+ SkCanvas::ClipOp op() const { return fOp; }
bool doAA() const { return fDoAA; }
private:
- SkRRect fRRect;
- SkRegion::Op fOp;
- bool fDoAA;
+ SkRRect fRRect;
+ SkCanvas::ClipOp fOp;
+ bool fDoAA;
typedef SkDrawCommand INHERITED;
};
diff --git a/tools/debugger/SkObjectParser.cpp b/tools/debugger/SkObjectParser.cpp
index 36427831c8..5f0e5f8aa9 100644
--- a/tools/debugger/SkObjectParser.cpp
+++ b/tools/debugger/SkObjectParser.cpp
@@ -313,19 +313,19 @@ SkString* SkObjectParser::RRectToString(const SkRRect& rrect, const char* title)
return mRRect;
}
-SkString* SkObjectParser::RegionOpToString(SkRegion::Op op) {
+SkString* SkObjectParser::ClipOpToString(SkCanvas::ClipOp op) {
SkString* mOp = new SkString("SkRegion::Op: ");
- if (op == SkRegion::kDifference_Op) {
+ if (op == SkCanvas::kDifference_Op) {
mOp->append("kDifference_Op");
- } else if (op == SkRegion::kIntersect_Op) {
+ } else if (op == SkCanvas::kIntersect_Op) {
mOp->append("kIntersect_Op");
- } else if (op == SkRegion::kUnion_Op) {
+ } else if (op == SkCanvas::kUnion_Op) {
mOp->append("kUnion_Op");
- } else if (op == SkRegion::kXOR_Op) {
+ } else if (op == SkCanvas::kXOR_Op) {
mOp->append("kXOR_Op");
- } else if (op == SkRegion::kReverseDifference_Op) {
+ } else if (op == SkCanvas::kReverseDifference_Op) {
mOp->append("kReverseDifference_Op");
- } else if (op == SkRegion::kReplace_Op) {
+ } else if (op == SkCanvas::kReplace_Op) {
mOp->append("kReplace_Op");
} else {
mOp->append("Unknown Type");
diff --git a/tools/debugger/SkObjectParser.h b/tools/debugger/SkObjectParser.h
index 9bdfad5e79..11baf12ec0 100644
--- a/tools/debugger/SkObjectParser.h
+++ b/tools/debugger/SkObjectParser.h
@@ -101,7 +101,7 @@ public:
Returns a string representation of the SkRegion enum.
@param op SkRegion::op enum
*/
- static SkString* RegionOpToString(SkRegion::Op op);
+ static SkString* ClipOpToString(SkCanvas::ClipOp op);
/**
Returns a string representation of the SkRegion.