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

Unified Diff: debugger/QT/SkImageWidget.cpp

Issue 15907023: Make SkDrawCommands lighter weight (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Addressed code review comments Created 7 years, 6 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 | « debugger/QT/SkImageWidget.h ('k') | debugger/SkDebugCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: debugger/QT/SkImageWidget.cpp
===================================================================
--- debugger/QT/SkImageWidget.cpp (revision 9448)
+++ debugger/QT/SkImageWidget.cpp (working copy)
@@ -15,6 +15,14 @@
: QWidget()
, fDebugger(debugger) {
this->setStyleSheet("QWidget {background-color: white; border: 1px solid #cccccc;}");
+
+ SkImage::Info info;
+ info.fWidth = kImageWidgetWidth;
+ info.fHeight = kImageWidgetHeight;
+ info.fColorType = SkImage::kPMColor_ColorType;
+ info.fAlphaType = SkImage::kPremul_AlphaType;
+
+ fSurface = SkSurface::NewRasterDirect(info, fPixels, 4 * kImageWidgetWidth);
}
void SkImageWidget::paintEvent(QPaintEvent* event) {
@@ -32,18 +40,14 @@
if (0 != commands.count()) {
SkDrawCommand* command = commands[fDebugger->index()];
- const SkBitmap* bitmap = command->getBitmap();
-
- if (NULL != bitmap) {
- bitmap->lockPixels();
-
+ if (command->render(fSurface->getCanvas())) {
QPoint origin(0,0);
- QImage image((uchar *)bitmap->getPixels(), bitmap->width(),
- bitmap->height(), QImage::Format_ARGB32_Premultiplied);
+ QImage image((uchar*) fPixels,
+ kImageWidgetWidth,
+ kImageWidgetHeight,
+ QImage::Format_ARGB32_Premultiplied);
painter.drawImage(origin, image);
-
- bitmap->unlockPixels();
} else {
painter.drawRect(0, 0, kImageWidgetWidth, kImageWidgetHeight);
}
« no previous file with comments | « debugger/QT/SkImageWidget.h ('k') | debugger/SkDebugCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698