OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #ifndef SKIMAGEWIDGET_H_ | 9 #ifndef SKIMAGEWIDGET_H_ |
10 #define SKIMAGEWIDGET_H_ | 10 #define SKIMAGEWIDGET_H_ |
11 | 11 |
12 #include <QWidget> | 12 #include <QWidget> |
13 | 13 |
| 14 #include "SkSurface.h" |
14 class SkDebugger; | 15 class SkDebugger; |
15 | 16 |
16 class SkImageWidget : public QWidget { | 17 class SkImageWidget : public QWidget { |
17 Q_OBJECT | 18 Q_OBJECT |
18 | 19 |
19 public: | 20 public: |
20 SkImageWidget(SkDebugger* debugger); | 21 SkImageWidget(SkDebugger* debugger); |
| 22 |
| 23 virtual ~SkImageWidget() { |
| 24 fSurface->unref(); |
| 25 delete [] fPixels; |
| 26 } |
21 | 27 |
22 void draw() { | 28 void draw() { |
23 this->update(); | 29 this->update(); |
24 } | 30 } |
25 | 31 |
26 static const int kImageWidgetWidth = 256; | 32 static const int kImageWidgetWidth = 256; |
27 static const int kImageWidgetHeight = 256; | 33 static const int kImageWidgetHeight = 256; |
28 | 34 |
29 signals: | 35 signals: |
30 void drawComplete(); | 36 void drawComplete(); |
31 | 37 |
32 protected: | 38 protected: |
33 void paintEvent(QPaintEvent* event); | 39 void paintEvent(QPaintEvent* event); |
34 | 40 |
35 private: | 41 private: |
36 SkDebugger *fDebugger; | 42 SkDebugger* fDebugger; |
| 43 char* fPixels; |
| 44 SkSurface* fSurface; |
37 }; | 45 }; |
38 | 46 |
39 #endif /* SKIMAGEWIDGET_H_ */ | 47 #endif /* SKIMAGEWIDGET_H_ */ |
OLD | NEW |