OLD | NEW |
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 <QtGui> | 9 #include <QtGui> |
10 | 10 |
11 #include "SkDebugger.h" | 11 #include "SkDebugger.h" |
12 #include "SkImageWidget.h" | 12 #include "SkImageWidget.h" |
13 | 13 |
14 SkImageWidget::SkImageWidget(SkDebugger *debugger) | 14 SkImageWidget::SkImageWidget(SkDebugger *debugger) |
15 : QWidget() | 15 : QWidget() |
16 , fDebugger(debugger) { | 16 , fDebugger(debugger) { |
17 this->setStyleSheet("QWidget {background-color: white; border: 1px solid #cc
cccc;}"); | 17 this->setStyleSheet("QWidget {background-color: white; border: 1px solid #cc
cccc;}"); |
18 | 18 |
19 SkImageInfo info; | 19 SkImageInfo info; |
20 info.fWidth = kImageWidgetWidth; | 20 info.fWidth = kImageWidgetWidth; |
21 info.fHeight = kImageWidgetHeight; | 21 info.fHeight = kImageWidgetHeight; |
22 info.fColorType = kPMColor_SkColorType; | 22 info.fColorType = kN32_SkColorType; |
23 info.fAlphaType = kPremul_SkAlphaType; | 23 info.fAlphaType = kPremul_SkAlphaType; |
24 | 24 |
25 fSurface = SkSurface::NewRasterDirect(info, fPixels, 4 * kImageWidgetWidth); | 25 fSurface = SkSurface::NewRasterDirect(info, fPixels, 4 * kImageWidgetWidth); |
26 } | 26 } |
27 | 27 |
28 void SkImageWidget::paintEvent(QPaintEvent* event) { | 28 void SkImageWidget::paintEvent(QPaintEvent* event) { |
29 if (this->isHidden()) { | 29 if (this->isHidden()) { |
30 return; | 30 return; |
31 } | 31 } |
32 | 32 |
(...skipping 16 matching lines...) Expand all Loading... |
49 | 49 |
50 painter.drawImage(origin, image); | 50 painter.drawImage(origin, image); |
51 } else { | 51 } else { |
52 painter.drawRect(0, 0, kImageWidgetWidth, kImageWidgetHeight); | 52 painter.drawRect(0, 0, kImageWidgetWidth, kImageWidgetHeight); |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 painter.end(); | 56 painter.end(); |
57 emit drawComplete(); | 57 emit drawComplete(); |
58 } | 58 } |
OLD | NEW |