| 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 } |
| 21 | 26 |
| 22 void draw() { | 27 void draw() { |
| 23 this->update(); | 28 this->update(); |
| 24 } | 29 } |
| 25 | 30 |
| 26 static const int kImageWidgetWidth = 256; | 31 static const int kImageWidgetWidth = 256; |
| 27 static const int kImageWidgetHeight = 256; | 32 static const int kImageWidgetHeight = 256; |
| 28 | 33 |
| 29 signals: | 34 signals: |
| 30 void drawComplete(); | 35 void drawComplete(); |
| 31 | 36 |
| 32 protected: | 37 protected: |
| 33 void paintEvent(QPaintEvent* event); | 38 void paintEvent(QPaintEvent* event); |
| 34 | 39 |
| 35 private: | 40 private: |
| 36 SkDebugger *fDebugger; | 41 SkDebugger* fDebugger; |
| 42 char fPixels[kImageWidgetHeight * 4 * kImageWidgetWidth]; |
| 43 SkSurface* fSurface; |
| 37 }; | 44 }; |
| 38 | 45 |
| 39 #endif /* SKIMAGEWIDGET_H_ */ | 46 #endif /* SKIMAGEWIDGET_H_ */ |
| OLD | NEW |