aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/debugger
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2014-08-29 08:03:56 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-08-29 08:03:56 -0700
commita8d7f0b13cd4c6d773fcf055fe17db75d260fa05 (patch)
tree37e85b212ccd5761b9a736282e75ebf838840798 /src/utils/debugger
parent77d724c07878b21602e96e095f6a446c429a079a (diff)
Try out scalar picture sizes
This paves the way for removing the 'fTile' parameter from SkPictureShader (although that should be a different CL). If we like this we could also move to providing an entire cull SkRect. R=reed@google.com, mtklein@google.com, fmalita@google.com, fmalita@chromium.org Author: robertphillips@google.com Review URL: https://codereview.chromium.org/513983002
Diffstat (limited to 'src/utils/debugger')
-rw-r--r--src/utils/debugger/SkDebugCanvas.cpp34
-rw-r--r--src/utils/debugger/SkDebugCanvas.h8
-rw-r--r--src/utils/debugger/SkDrawCommand.cpp8
3 files changed, 18 insertions, 32 deletions
diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp
index 2b0eab7f32..85fb7a4ee0 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -14,11 +14,10 @@
#include "SkDevice.h"
#include "SkXfermode.h"
-SkDebugCanvas::SkDebugCanvas(int width, int height)
- : INHERITED(width, height)
+SkDebugCanvas::SkDebugCanvas(int windowWidth, int windowHeight)
+ : INHERITED(windowWidth, windowHeight)
, fPicture(NULL)
- , fWidth(width)
- , fHeight(height)
+ , fWindowSize(SkISize::Make(windowWidth, windowHeight))
, fFilter(false)
, fMegaVizMode(false)
, fIndex(0)
@@ -76,7 +75,7 @@ int SkDebugCanvas::getCommandAtPoint(int x, int y, int index) {
SkCanvas canvas(bitmap);
canvas.translate(SkIntToScalar(-x), SkIntToScalar(-y));
- applyUserTransform(&canvas);
+ this->applyUserTransform(&canvas);
int layer = 0;
SkColor prev = bitmap.getColor(0,0);
@@ -255,10 +254,10 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) {
}
canvas->clear(SK_ColorTRANSPARENT);
canvas->resetMatrix();
- SkRect rect = SkRect::MakeWH(SkIntToScalar(fWidth),
- SkIntToScalar(fHeight));
- canvas->clipRect(rect, SkRegion::kReplace_Op );
- applyUserTransform(canvas);
+ SkRect rect = SkRect::MakeWH(SkIntToScalar(fWindowSize.fWidth),
+ SkIntToScalar(fWindowSize.fHeight));
+ canvas->clipRect(rect, SkRegion::kReplace_Op);
+ this->applyUserTransform(canvas);
fOutstandingSaveCount = 0;
}
@@ -292,17 +291,7 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) {
for (; i <= index; i++) {
if (i == index && fFilter) {
- SkPaint p;
- p.setColor(0xAAFFFFFF);
- canvas->save();
- canvas->resetMatrix();
- SkRect mask;
- mask.set(SkIntToScalar(0), SkIntToScalar(0),
- SkIntToScalar(fWidth), SkIntToScalar(fHeight));
- canvas->clipRect(mask, SkRegion::kReplace_Op, false);
- canvas->drawRectCoords(SkIntToScalar(0), SkIntToScalar(0),
- SkIntToScalar(fWidth), SkIntToScalar(fHeight), p);
- canvas->restore();
+ canvas->clear(0xAAFFFFFF);
}
if (fCommandVector[i]->isVisible()) {
@@ -321,12 +310,13 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) {
}
if (fMegaVizMode) {
- SkRect r = SkRect::MakeWH(SkIntToScalar(fWidth), SkIntToScalar(fHeight));
+ SkRect r = SkRect::MakeWH(SkIntToScalar(fWindowSize.fWidth),
+ SkIntToScalar(fWindowSize.fHeight));
r.outset(SK_Scalar1, SK_Scalar1);
canvas->save();
// nuke the CTM
- canvas->setMatrix(SkMatrix::I());
+ canvas->resetMatrix();
// turn off clipping
canvas->clipRect(r, SkRegion::kReplace_Op);
diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h
index 94ad4263e5..2e9a032e4e 100644
--- a/src/utils/debugger/SkDebugCanvas.h
+++ b/src/utils/debugger/SkDebugCanvas.h
@@ -145,10 +145,7 @@ public:
*/
void toggleCommand(int index, bool toggle);
- void setBounds(int width, int height) {
- fWidth = width;
- fHeight = height;
- }
+ void setWindowSize(int width, int height) { fWindowSize.set(width, height); }
void setUserMatrix(SkMatrix matrix) {
fUserMatrix = matrix;
@@ -259,8 +256,7 @@ protected:
private:
SkTDArray<SkDrawCommand*> fCommandVector;
SkPicture* fPicture;
- int fWidth;
- int fHeight;
+ SkISize fWindowSize;
bool fFilter;
bool fMegaVizMode;
int fIndex;
diff --git a/src/utils/debugger/SkDrawCommand.cpp b/src/utils/debugger/SkDrawCommand.cpp
index 3b1a028d80..3a073962cc 100644
--- a/src/utils/debugger/SkDrawCommand.cpp
+++ b/src/utils/debugger/SkDrawCommand.cpp
@@ -523,7 +523,9 @@ SkDrawPictureCommand::SkDrawPictureCommand(const SkPicture* picture,
}
SkString* temp = new SkString;
- temp->appendf("SkPicture: W: %d H: %d", picture->width(), picture->height());
+ temp->appendf("SkPicture: L: %f T: %f R: %f B: %f",
+ picture->cullRect().fLeft, picture->cullRect().fTop,
+ picture->cullRect().fRight, picture->cullRect().fBottom);
fInfo.push(temp);
if (NULL != matrix) {
fInfo.push(SkObjectParser::MatrixToString(*matrix));
@@ -541,9 +543,7 @@ bool SkDrawPictureCommand::render(SkCanvas* canvas) const {
canvas->clear(0xFFFFFFFF);
canvas->save();
- SkRect bounds = SkRect::MakeWH(SkIntToScalar(fPicture->width()),
- SkIntToScalar(fPicture->height()));
- xlate_and_scale_to_bounds(canvas, bounds);
+ xlate_and_scale_to_bounds(canvas, fPicture->cullRect());
canvas->drawPicture(fPicture.get());