blob: 6fac765dc8d8726e97295d14fb7627074539b281 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#import <UIKit/UIKit.h>
#include "SkCanvas.h"
#include "SkGraphics.h"
#import "SkEventNotifier.h"
#include "SkOSMenu.h"
#include "SkTime.h"
#include "SkTypes.h"
#import "SkUIView.h"
#include "SkWindow.h"
#define kINVAL_UIVIEW_EventType "inval-uiview"
SkOSWindow::SkOSWindow(void* hWnd) : fHWND(hWnd) {
fInvalEventIsPending = false;
fNotifier = [[SkEventNotifier alloc] init];
}
SkOSWindow::~SkOSWindow() {
[(SkEventNotifier*)fNotifier release];
}
void SkOSWindow::onHandleInval(const SkIRect& r) {
if (!fInvalEventIsPending) {
fInvalEventIsPending = true;
(new SkEvent(kINVAL_UIVIEW_EventType, this->getSinkID()))->post();
}
}
bool SkOSWindow::onEvent(const SkEvent& evt) {
if (evt.isType(kINVAL_UIVIEW_EventType)) {
fInvalEventIsPending = false;
const SkIRect& r = this->getDirtyBounds();
[(SkUIView*)fHWND postInvalWithRect:&r];
return true;
}
if ([(SkUIView*)fHWND onHandleEvent:evt]) {
return true;
}
return this->INHERITED::onEvent(evt);
}
bool SkOSWindow::onDispatchClick(int x, int y, Click::State state, void* owner) {
return this->INHERITED::onDispatchClick(x, y, state, owner);
}
void SkOSWindow::onSetTitle(const char title[]) {
[(SkUIView*)fHWND setSkTitle:title];
}
void SkOSWindow::onAddMenu(const SkOSMenu* menu) {
[(SkUIView*)fHWND onAddMenu:menu];
}
void SkOSWindow::onUpdateMenu(SkOSMenu* menu) {
[(SkUIView*)fHWND onUpdateMenu:menu];
}
bool SkOSWindow::attach(SkBackEndTypes /* attachType */,
int /* msaaSampleCount */) {
bool success = true;
return success;
}
void SkOSWindow::detach() {}
void SkOSWindow::present() {
}
|