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

Side by Side Diff: debugger/QT/SkRasterWidget.cpp

Issue 1828273002: Fix debugger w.r.t. sk_sp changes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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/SkRasterWidget.h ('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"
11 #include <QtGui> 11 #include <QtGui>
12 12
13 SkRasterWidget::SkRasterWidget(SkDebugger *debugger) 13 SkRasterWidget::SkRasterWidget(SkDebugger *debugger)
14 : QWidget() 14 : QWidget()
15 , fDebugger(debugger) 15 , fDebugger(debugger)
16 , fNeedImageUpdate(false) { 16 , fNeedImageUpdate(false) {
17 this->setStyleSheet("QWidget {background-color: black; border: 1px solid #cc cccc;}"); 17 this->setStyleSheet("QWidget {background-color: black; border: 1px solid #cc cccc;}");
18 } 18 }
19 19
20 void SkRasterWidget::resizeEvent(QResizeEvent* event) { 20 void SkRasterWidget::resizeEvent(QResizeEvent* event) {
21 this->QWidget::resizeEvent(event); 21 this->QWidget::resizeEvent(event);
22 22
23 QRect r = this->contentsRect(); 23 QRect r = this->contentsRect();
24 if (r.width() == 0 || r.height() == 0) { 24 if (r.width() == 0 || r.height() == 0) {
25 fSurface.reset(nullptr); 25 fSurface = nullptr;
26 } else { 26 } else {
27 SkImageInfo info = SkImageInfo::MakeN32Premul(r.width(), r.height()); 27 SkImageInfo info = SkImageInfo::MakeN32Premul(r.width(), r.height());
28 fSurface.reset(SkSurface::NewRaster(info)); 28 fSurface = SkSurface::MakeRaster(info);
29 } 29 }
30 this->updateImage(); 30 this->updateImage();
31 } 31 }
32 32
33 void SkRasterWidget::paintEvent(QPaintEvent* event) { 33 void SkRasterWidget::paintEvent(QPaintEvent* event) {
34 QPainter painter(this); 34 QPainter painter(this);
35 painter.setRenderHint(QPainter::Antialiasing); 35 painter.setRenderHint(QPainter::Antialiasing);
36 QStyleOption opt; 36 QStyleOption opt;
37 opt.init(this); 37 opt.init(this);
38 style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this); 38 style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
(...skipping 25 matching lines...) Expand all
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/SkRasterWidget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698