gfx/skia/trunk/src/views/ios/SkOSWindow_iOS.mm

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rwxr-xr-x

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial