Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Unified Diff: tools/debugger/SkDebugCanvas.cpp

Issue 1690023004: added clip visualization to skiaserve (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fixed copy-paste error Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/debugger/SkDebugCanvas.h ('k') | tools/skiaserve/skiaserve.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/debugger/SkDebugCanvas.cpp
diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp
index 11b10c04eed58fd4c4895af8a4aa386cc756d090..89e53e1e7cbb8a91f9867bdaa30f9a9242b12a2d 100644
--- a/tools/debugger/SkDebugCanvas.cpp
+++ b/tools/debugger/SkDebugCanvas.cpp
@@ -67,7 +67,8 @@ SkDebugCanvas::SkDebugCanvas(int width, int height)
, fMegaVizMode(false)
, fOverdrawViz(false)
, fOverrideFilterQuality(false)
- , fFilterQuality(kNone_SkFilterQuality) {
+ , fFilterQuality(kNone_SkFilterQuality)
+ , fClipVizColor(SK_ColorTRANSPARENT) {
fUserMatrix.reset();
// SkPicturePlayback uses the base-class' quickReject calls to cull clipped
@@ -233,6 +234,17 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) {
}
}
+ if (SkColorGetA(fClipVizColor) != 0) {
+ canvas->save();
+ #define LARGE_COORD 1000000000
+ canvas->clipRect(SkRect::MakeLTRB(-LARGE_COORD, -LARGE_COORD, LARGE_COORD, LARGE_COORD),
+ SkRegion::kReverseDifference_Op);
+ SkPaint clipPaint;
+ clipPaint.setColor(fClipVizColor);
+ canvas->drawPaint(clipPaint);
+ canvas->restore();
+ }
+
if (fMegaVizMode) {
canvas->save();
// nuke the CTM
@@ -323,7 +335,7 @@ Json::Value SkDebugCanvas::toJSON(UrlDataManager& urlDataManager, int n) {
Json::Value result = Json::Value(Json::objectValue);
result[SKDEBUGCANVAS_ATTRIBUTE_VERSION] = Json::Value(SKDEBUGCANVAS_VERSION);
Json::Value commands = Json::Value(Json::arrayValue);
- for (int i = 0; i < this->getSize() && i < n; i++) {
+ for (int i = 0; i < this->getSize() && i <= n; i++) {
commands[i] = this->getDrawCommandAt(i)->toJSON(urlDataManager);
}
result[SKDEBUGCANVAS_ATTRIBUTE_COMMANDS] = commands;
« no previous file with comments | « tools/debugger/SkDebugCanvas.h ('k') | tools/skiaserve/skiaserve.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698