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
diff --git a/debugger/SkDebugger.cpp b/debugger/SkDebugger.cpp
index af6900c..fda8f9a 100644
--- a/debugger/SkDebugger.cpp
+++ b/debugger/SkDebugger.cpp
@@ -13,10 +13,8 @@
SkDebugger::SkDebugger() {
// Create this some other dynamic way?
- fDebugCanvas = new SkDebugCanvas(100, 100);
+ fDebugCanvas = new SkDebugCanvas(0, 0);
fPicture = NULL;
- fPictureWidth = 0;
- fPictureHeight = 0;
fIndex = 0;
}
@@ -27,23 +25,23 @@
}
void SkDebugger::loadPicture(SkPicture* picture) {
- fPictureWidth = picture->width();
- fPictureHeight = picture->height();
+ SkRefCnt_SafeAssign(fPicture, picture);
+
delete fDebugCanvas;
- fDebugCanvas = new SkDebugCanvas(fPictureWidth, fPictureHeight);
- fDebugCanvas->setBounds(fPictureWidth, fPictureHeight);
+ fDebugCanvas = new SkDebugCanvas(SkScalarCeilToInt(this->pictureCull().width()),
+ SkScalarCeilToInt(this->pictureCull().height()));
fDebugCanvas->setPicture(picture);
picture->draw(fDebugCanvas);
fDebugCanvas->setPicture(NULL);
fIndex = fDebugCanvas->getSize() - 1;
- SkRefCnt_SafeAssign(fPicture, picture);
}
SkPicture* SkDebugger::copyPicture() {
// We can't just call clone here since we want to removed the "deleted"
// commands. Playing back will strip those out.
SkPictureRecorder recorder;
- SkCanvas* canvas = recorder.beginRecording(fPictureWidth, fPictureHeight, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(this->pictureCull().width(),
+ this->pictureCull().height());
bool vizMode = fDebugCanvas->getMegaVizMode();
fDebugCanvas->setMegaVizMode(false);
@@ -143,13 +141,15 @@
totalStr.append("<br/>");
overview->insert(0, totalStr);
+ overview->append("<br/>SkPicture L: ");
+ overview->appendScalar(this->pictureCull().fLeft);
+ overview->append(" T: ");
+ overview->appendScalar(this->pictureCull().fTop);
+ overview->append(" R: ");
+ overview->appendScalar(this->pictureCull().fRight);
+ overview->append(" B: ");
+ overview->appendScalar(this->pictureCull().fBottom);
overview->append("<br/>");
- overview->append("SkPicture Width: ");
- overview->appendS32(pictureWidth());
- overview->append("px<br/>");
- overview->append("SkPicture Height: ");
- overview->appendS32(pictureHeight());
- overview->append("px");
}
void SkDebugger::getClipStackText(SkString* clipStack) {