зеркало из https://github.com/mozilla/moz-skia.git
Bug Fix: Current command mask now dynamically changes based on bounds of window.
Review URL: https://codereview.appspot.com/6384044 git-svn-id: http://skia.googlecode.com/svn/trunk@4504 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
b4ed0178d0
Коммит
b9ddd4e9f1
|
@ -55,7 +55,12 @@ void SkCanvasWidget::resizeEvent(QResizeEvent* event) {
|
|||
|
||||
fDevice = new SkDevice(fBitmap);
|
||||
fCanvas = new SkCanvas(fDevice);
|
||||
<<<<<<< HEAD
|
||||
fDebugCanvas->setBounds(event->size().width(), event->size().height());
|
||||
fDebugCanvas->drawTo(fCanvas, fIndex);
|
||||
=======
|
||||
drawTo(fIndex);
|
||||
>>>>>>> refs/remotes/git-svn
|
||||
this->update();
|
||||
}
|
||||
|
||||
|
@ -82,6 +87,7 @@ void SkCanvasWidget::loadPicture(QString filename) {
|
|||
|
||||
delete fDebugCanvas;
|
||||
fDebugCanvas = new SkDebugCanvas();
|
||||
fDebugCanvas->setBounds(this->width(), this->height());
|
||||
|
||||
picture->draw(fDebugCanvas);
|
||||
fDebugCanvas->draw(fCanvas);
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
|
||||
SkDebugCanvas::SkDebugCanvas() {
|
||||
// TODO(chudy): Free up memory from all draw commands in destructor.
|
||||
int width = 100;
|
||||
int height = 100;
|
||||
fBm.setConfig(SkBitmap::kNo_Config, width, height);
|
||||
fWidth = 100;
|
||||
fHeight = 100;
|
||||
fBm.setConfig(SkBitmap::kNo_Config, fWidth, fHeight);
|
||||
this->setBitmapDevice(fBm);
|
||||
fFilter = false;
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ void SkDebugCanvas::draw(SkCanvas* canvas) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) {
|
||||
int counter = 0;
|
||||
if(!commandVector.empty()) {
|
||||
|
@ -50,9 +51,9 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) {
|
|||
canvas->resetMatrix();
|
||||
SkRect dump;
|
||||
// TODO(chudy): Replace with a call to QtWidget to get dimensions.
|
||||
dump.set(SkIntToScalar(0), SkIntToScalar(0), SkIntToScalar(800), SkIntToScalar(800));
|
||||
dump.set(SkIntToScalar(0), SkIntToScalar(0), SkIntToScalar(fWidth), SkIntToScalar(fHeight));
|
||||
canvas->clipRect(dump, SkRegion::kReplace_Op, false );
|
||||
canvas->drawRectCoords(SkIntToScalar(0),SkIntToScalar(0),SkIntToScalar(800),SkIntToScalar(800), *p);
|
||||
canvas->drawRectCoords(SkIntToScalar(0),SkIntToScalar(0),SkIntToScalar(fWidth),SkIntToScalar(fHeight), *p);
|
||||
canvas->restore();
|
||||
}
|
||||
|
||||
|
|
|
@ -87,6 +87,11 @@ public:
|
|||
*/
|
||||
void toggleCommand(int index, bool toggle);
|
||||
|
||||
void setBounds(int width, int height) {
|
||||
fWidth = width;
|
||||
fHeight = height;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Inherited from SkCanvas
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -168,7 +173,8 @@ private:
|
|||
typedef SkCanvas INHERITED;
|
||||
std::vector<SkDrawCommand*> commandVector;
|
||||
std::vector<SkDrawCommand*>::const_iterator it;
|
||||
|
||||
int fHeight;
|
||||
int fWidth;
|
||||
SkBitmap fBm;
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче