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

Unified Diff: debugger/QT/SkDrawCommandGeometryWidget.cpp

Issue 1782673003: Update debugger to use SkPixmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | debugger/QT/SkRasterWidget.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: debugger/QT/SkDrawCommandGeometryWidget.cpp
diff --git a/debugger/QT/SkDrawCommandGeometryWidget.cpp b/debugger/QT/SkDrawCommandGeometryWidget.cpp
index 08192acf9a3695b2a3c109fb80f31c5a071a5465..5144f5fdab350cb5e9f633da928edcac7ab1dc77 100644
--- a/debugger/QT/SkDrawCommandGeometryWidget.cpp
+++ b/debugger/QT/SkDrawCommandGeometryWidget.cpp
@@ -41,27 +41,27 @@ void SkDrawCommandGeometryWidget::paintEvent(QPaintEvent* event) {
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
- SkImageInfo info;
- size_t rowBytes;
- if (const void* pixels = fSurface->peekPixels(&info, &rowBytes)) {
- SkASSERT(info.width() > 0);
- SkASSERT(info.height() > 0);
+ SkPixmap pixmap;
+
+ if (fSurface->peekPixels(&pixmap)) {
+ SkASSERT(pixmap.width() > 0);
+ SkASSERT(pixmap.height() > 0);
QRectF resultRect;
if (this->width() < this->height()) {
- float ratio = this->width() / info.width();
- resultRect = QRectF(0, 0, this->width(), ratio * info.height());
+ float ratio = this->width() / pixmap.width();
+ resultRect = QRectF(0, 0, this->width(), ratio * pixmap.height());
} else {
- float ratio = this->height() / info.height();
- resultRect = QRectF(0, 0, ratio * info.width(), this->height());
+ float ratio = this->height() / pixmap.height();
+ resultRect = QRectF(0, 0, ratio * pixmap.width(), this->height());
}
resultRect.moveCenter(this->contentsRect().center());
- QImage image(reinterpret_cast<const uchar*>(pixels),
- info.width(),
- info.height(),
- rowBytes,
+ QImage image(reinterpret_cast<const uchar*>(pixmap.addr()),
+ pixmap.width(),
+ pixmap.height(),
+ pixmap.rowBytes(),
QImage::Format_ARGB32_Premultiplied);
painter.drawImage(resultRect, image);
}
« no previous file with comments | « no previous file | debugger/QT/SkRasterWidget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698