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