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 | |
10 #include "SkRasterWidget.h" | 9 #include "SkRasterWidget.h" |
11 | 10 |
12 SkRasterWidget::SkRasterWidget(SkDebugger *debugger) : QWidget() { | 11 SkRasterWidget::SkRasterWidget(SkDebugger *debugger) : QWidget() { |
13 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 800, 800); | 12 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 800, 800); |
14 fBitmap.allocPixels(); | 13 fBitmap.allocPixels(); |
15 fBitmap.eraseColor(SK_ColorTRANSPARENT); | 14 fBitmap.eraseColor(SK_ColorTRANSPARENT); |
16 fDevice = new SkDevice(fBitmap); | 15 fDevice = new SkDevice(fBitmap); |
17 fDebugger = debugger; | 16 fDebugger = debugger; |
18 fCanvas = new SkCanvas(fDevice); | 17 fCanvas = new SkCanvas(fDevice); |
19 this->setStyleSheet("QWidget {background-color: white; border: 1px solid #cc
cccc;}"); | 18 this->setStyleSheet("QWidget {background-color: white; border: 1px solid #cc
cccc;}"); |
(...skipping 22 matching lines...) Expand all Loading... |
42 QPainter painter(this); | 41 QPainter painter(this); |
43 QStyleOption opt; | 42 QStyleOption opt; |
44 opt.init(this); | 43 opt.init(this); |
45 | 44 |
46 style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this); | 45 style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this); |
47 | 46 |
48 QPoint origin(0,0); | 47 QPoint origin(0,0); |
49 QImage image((uchar *)fBitmap.getPixels(), fBitmap.width(), | 48 QImage image((uchar *)fBitmap.getPixels(), fBitmap.width(), |
50 fBitmap.height(), QImage::Format_ARGB32_Premultiplied); | 49 fBitmap.height(), QImage::Format_ARGB32_Premultiplied); |
51 | 50 |
| 51 #if SK_R32_SHIFT == 0 |
| 52 painter.drawImage(origin, image.rgbSwapped()); |
| 53 #else |
52 painter.drawImage(origin, image); | 54 painter.drawImage(origin, image); |
| 55 #endif |
53 painter.end(); | 56 painter.end(); |
54 emit drawComplete(); | 57 emit drawComplete(); |
55 } | 58 } |
56 } | 59 } |
OLD | NEW |