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

Unified Diff: src/utils/debugger/SkDebugCanvas.cpp

Issue 835113002: Remove draw window size state from SkDebugCanvas (Closed) Base URL: https://skia.googlesource.com/skia.git@debugger-small-things-04-index-zero-draw
Patch Set: rebase Created 5 years, 11 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 | « src/utils/debugger/SkDebugCanvas.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/debugger/SkDebugCanvas.cpp
diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp
index 77cf8a027b555addc497c3489b0627a014c5e3b9..d7704071d7ed272924a5b42b33d5e65a04c1b326 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -14,10 +14,9 @@
#include "SkDevice.h"
#include "SkXfermode.h"
-SkDebugCanvas::SkDebugCanvas(int windowWidth, int windowHeight)
- : INHERITED(windowWidth, windowHeight)
+SkDebugCanvas::SkDebugCanvas(int width, int height)
+ : INHERITED(width, height)
, fPicture(NULL)
- , fWindowSize(SkISize::Make(windowWidth, windowHeight))
, fFilter(false)
, fMegaVizMode(false)
, fIndex(0)
@@ -233,6 +232,8 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) {
SkASSERT(!fCommandVector.isEmpty());
SkASSERT(index < fCommandVector.count());
int i = 0;
+ SkRect windowRect = SkRect::MakeWH(SkIntToScalar(canvas->getBaseLayerSize().width()),
+ SkIntToScalar(canvas->getBaseLayerSize().height()));
bool pathOpsMode = getAllowSimplifyClip();
canvas->setAllowSimplifyClip(pathOpsMode);
@@ -249,9 +250,9 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) {
}
canvas->clear(SK_ColorTRANSPARENT);
canvas->resetMatrix();
- SkRect rect = SkRect::MakeWH(SkIntToScalar(fWindowSize.fWidth),
- SkIntToScalar(fWindowSize.fHeight));
- canvas->clipRect(rect, SkRegion::kReplace_Op);
+ if (!windowRect.isEmpty()) {
+ canvas->clipRect(windowRect, SkRegion::kReplace_Op);
+ }
this->applyUserTransform(canvas);
fDrawNeedsReset = false;
fOutstandingSaveCount = 0;
@@ -307,16 +308,15 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) {
}
if (fMegaVizMode) {
- SkRect r = SkRect::MakeWH(SkIntToScalar(fWindowSize.fWidth),
- SkIntToScalar(fWindowSize.fHeight));
- r.outset(SK_Scalar1, SK_Scalar1);
-
canvas->save();
// nuke the CTM
canvas->resetMatrix();
// turn off clipping
- canvas->clipRect(r, SkRegion::kReplace_Op);
-
+ if (!windowRect.isEmpty()) {
+ SkRect r = windowRect;
+ r.outset(SK_Scalar1, SK_Scalar1);
+ canvas->clipRect(r, SkRegion::kReplace_Op);
+ }
// visualize existing clips
SkDebugClipVisitor visitor(canvas);
« no previous file with comments | « src/utils/debugger/SkDebugCanvas.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698