diff options
author | robertphillips <robertphillips@google.com> | 2016-03-10 06:56:21 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-10 06:56:21 -0800 |
commit | f1d746c188ede847968efafde89c8a5501d45c7d (patch) | |
tree | 473890b122e6b786906edb0edfd9ea3e5f074be3 /debugger | |
parent | 150835e779ceb24e2b540f58958cbff2a0ab9942 (diff) |
Update debugger to use SkPixmap
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1782673003
Review URL: https://codereview.chromium.org/1782673003
Diffstat (limited to 'debugger')
-rw-r--r-- | debugger/QT/SkDrawCommandGeometryWidget.cpp | 26 | ||||
-rw-r--r-- | debugger/QT/SkRasterWidget.cpp | 14 |
2 files changed, 20 insertions, 20 deletions
diff --git a/debugger/QT/SkDrawCommandGeometryWidget.cpp b/debugger/QT/SkDrawCommandGeometryWidget.cpp index 08192acf9a..5144f5fdab 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); } diff --git a/debugger/QT/SkRasterWidget.cpp b/debugger/QT/SkRasterWidget.cpp index b5ef492ca7..b969d50e3c 100644 --- a/debugger/QT/SkRasterWidget.cpp +++ b/debugger/QT/SkRasterWidget.cpp @@ -48,13 +48,13 @@ void SkRasterWidget::paintEvent(QPaintEvent* event) { Q_EMIT drawComplete(); } - SkImageInfo info; - size_t rowBytes; - if (const void* pixels = fSurface->peekPixels(&info, &rowBytes)) { - QImage image(reinterpret_cast<const uchar*>(pixels), - info.width(), - info.height(), - rowBytes, + SkPixmap pixmap; + + if (fSurface->peekPixels(&pixmap)) { + QImage image(reinterpret_cast<const uchar*>(pixmap.addr()), + pixmap.width(), + pixmap.height(), + pixmap.rowBytes(), QImage::Format_ARGB32_Premultiplied); #if SK_R32_SHIFT == 0 painter.drawImage(this->contentsRect(), image.rgbSwapped()); |