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

Side by Side Diff: debugger/QT/SkRasterWidget.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 unified diff | Download patch
« no previous file with comments | « debugger/QT/SkDrawCommandGeometryWidget.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkRasterWidget.h" 9 #include "SkRasterWidget.h"
10 #include "SkDebugger.h" 10 #include "SkDebugger.h"
(...skipping 30 matching lines...) Expand all
41 return; 41 return;
42 } 42 }
43 43
44 if (fNeedImageUpdate) { 44 if (fNeedImageUpdate) {
45 fDebugger->draw(fSurface->getCanvas()); 45 fDebugger->draw(fSurface->getCanvas());
46 fSurface->getCanvas()->flush(); 46 fSurface->getCanvas()->flush();
47 fNeedImageUpdate = false; 47 fNeedImageUpdate = false;
48 Q_EMIT drawComplete(); 48 Q_EMIT drawComplete();
49 } 49 }
50 50
51 SkImageInfo info; 51 SkPixmap pixmap;
52 size_t rowBytes; 52
53 if (const void* pixels = fSurface->peekPixels(&info, &rowBytes)) { 53 if (fSurface->peekPixels(&pixmap)) {
54 QImage image(reinterpret_cast<const uchar*>(pixels), 54 QImage image(reinterpret_cast<const uchar*>(pixmap.addr()),
55 info.width(), 55 pixmap.width(),
56 info.height(), 56 pixmap.height(),
57 rowBytes, 57 pixmap.rowBytes(),
58 QImage::Format_ARGB32_Premultiplied); 58 QImage::Format_ARGB32_Premultiplied);
59 #if SK_R32_SHIFT == 0 59 #if SK_R32_SHIFT == 0
60 painter.drawImage(this->contentsRect(), image.rgbSwapped()); 60 painter.drawImage(this->contentsRect(), image.rgbSwapped());
61 #else 61 #else
62 painter.drawImage(this->contentsRect(), image); 62 painter.drawImage(this->contentsRect(), image);
63 #endif 63 #endif
64 } 64 }
65 } 65 }
66 66
67 void SkRasterWidget::updateImage() { 67 void SkRasterWidget::updateImage() {
68 if (!fSurface) { 68 if (!fSurface) {
69 return; 69 return;
70 } 70 }
71 fNeedImageUpdate = true; 71 fNeedImageUpdate = true;
72 this->update(); 72 this->update();
73 } 73 }
OLDNEW
« no previous file with comments | « debugger/QT/SkDrawCommandGeometryWidget.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698