diff options
author | yangsu@google.com <yangsu@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-07-07 19:26:42 +0000 |
---|---|---|
committer | yangsu@google.com <yangsu@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-07-07 19:26:42 +0000 |
commit | 2e20c248f33e1ee129280dd71492785533908b63 (patch) | |
tree | dc50daca901daf1054e919dec65d62e747e8464a /src/utils | |
parent | e6ea606fb92cd611b965806cb005f87495b261f2 (diff) |
Updated iOSSampleApp and related files.
Removed include guard in SkTime_Unix.cpp, which the iOSSampleApp now uses.
git-svn-id: http://skia.googlecode.com/svn/trunk@1820 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/utils')
-rwxr-xr-x | src/utils/ios/SkOSFile_iOS.mm | 6 | ||||
-rwxr-xr-x | src/utils/ios/SkOSWindow_iOS.mm | 62 |
2 files changed, 35 insertions, 33 deletions
diff --git a/src/utils/ios/SkOSFile_iOS.mm b/src/utils/ios/SkOSFile_iOS.mm index 33c572ac3a..b74ea14cb4 100755 --- a/src/utils/ios/SkOSFile_iOS.mm +++ b/src/utils/ios/SkOSFile_iOS.mm @@ -1,7 +1,7 @@ /* Copyright 2010, Tetrark Inc. */ - +#include <Foundation/Foundation.h> #include "SkOSFile.h" #include "SkString.h" @@ -17,7 +17,7 @@ SkFILE* sk_fopen(const char cpath[], SkFILE_Flags flags) { } SkString cname, csuffix; - + const char* start = strrchr(cpath, '/'); if (NULL == start) { start = cpath; @@ -33,7 +33,7 @@ SkFILE* sk_fopen(const char cpath[], SkFILE_Flags flags) { cname.set(start, stop - start - 1); csuffix.set(stop); - + NSBundle* bundle = [NSBundle mainBundle]; NSString* name = [NSString stringWithUTF8String:cname.c_str()]; NSString* suffix = [NSString stringWithUTF8String:csuffix.c_str()]; diff --git a/src/utils/ios/SkOSWindow_iOS.mm b/src/utils/ios/SkOSWindow_iOS.mm index 3611ba6377..629cb3d289 100755 --- a/src/utils/ios/SkOSWindow_iOS.mm +++ b/src/utils/ios/SkOSWindow_iOS.mm @@ -1,16 +1,16 @@ #import <UIKit/UIKit.h> #import <OpenGLES/EAGL.h> #import <OpenGLES/ES1/gl.h> -#include "SkTypes.h" -#include "SkWindow.h" #include "SkCanvas.h" +#include "SkGraphics.h" +#import "SkIOSNotifier.h" #include "SkOSMenu.h" #include "SkTime.h" -#include "SkGraphics.h" +#include "SkTypes.h" +#import "SkUIView_shell.h" +#include "SkWindow.h" #define kINVAL_UIVIEW_EventType "inval-uiview" -#include "SkIOSNotifier.h" -#import "SkUIView_shell.h" SkOSWindow::SkOSWindow(void* hWnd) : fHWND(hWnd) { fInvalEventIsPending = false; @@ -37,16 +37,19 @@ bool SkOSWindow::onEvent(const SkEvent& evt) { if ([(SkUIView_shell*)fHWND onHandleEvent:evt]) { return true; } - return INHERITED::onEvent(evt); + 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_shell*)fHWND setSkTitle:title]; } -void SkOSWindow::onAddMenu(const SkOSMenu* sk_menu) -{ - +void SkOSWindow::onAddMenu(const SkOSMenu* sk_menu) { + } /////////////////////////////////////////////////////////////////////////////////////// @@ -54,16 +57,16 @@ void SkOSWindow::onAddMenu(const SkOSMenu* sk_menu) #if 1 static void NonEmptyCallback(CFRunLoopTimerRef timer, void*) { // printf("------- event queue depth = %d\n", SkEvent::CountEventsOnQueue()); - + if (!SkEvent::ProcessEvent()) { CFRunLoopTimerInvalidate(timer); } } - + void SkEvent::SignalNonEmptyQueue() { double tinyDelay = 1.0 / 60; CFRunLoopTimerRef timer; - + timer = CFRunLoopTimerCreate(NULL, CACurrentMediaTime() + tinyDelay, tinyDelay, @@ -85,7 +88,7 @@ void SkOSWindow::onAddMenu(const SkOSMenu* sk_menu) static CFRunLoopSourceRef gNonEmptySource; static CFRunLoopRef gNoneEmptyRunLoop; static bool gAlreadySignaled; - + static void signal_nonempty() { if (!gAlreadySignaled) { NONE_EMPTY_CODE(printf("--- before resignal\n");) @@ -95,7 +98,7 @@ void SkOSWindow::onAddMenu(const SkOSMenu* sk_menu) NONE_EMPTY_CODE(printf("--- after resignal\n");) } } - + static void NonEmptySourceCallback(void*) { gAlreadySignaled = false; NONE_EMPTY_CODE(printf("---- service NonEmptySourceCallback %d\n", SkEvent::CountEventsOnQueue());) @@ -104,11 +107,11 @@ void SkOSWindow::onAddMenu(const SkOSMenu* sk_menu) } NONE_EMPTY_CODE(printf("----- after service\n");) } - + void SkEvent::SignalNonEmptyQueue() { if (NULL == gNonEmptySource) { gNoneEmptyRunLoop = CFRunLoopGetMain(); - + CFIndex order = 0; // should this be lower, to not start UIEvents? CFRunLoopSourceContext context; sk_bzero(&context, sizeof(context)); @@ -117,7 +120,7 @@ void SkOSWindow::onAddMenu(const SkOSMenu* sk_menu) // our perform callback context.perform = NonEmptySourceCallback; gNonEmptySource = CFRunLoopSourceCreate(NULL, order, &context); - + CFRunLoopAddSource(gNoneEmptyRunLoop, gNonEmptySource, kCFRunLoopCommonModes); @@ -128,20 +131,20 @@ void SkOSWindow::onAddMenu(const SkOSMenu* sk_menu) @interface NonEmptyHandler : NSObject {} - (void)signalNonEmptyQ; @end - + @implementation NonEmptyHandler - + - (void)callProccessEvent { // printf("----- callProcessEvent\n"); if (SkEvent::ProcessEvent()) { [self signalNonEmptyQ]; } } - + - (void)signalNonEmptyQ { [self performSelectorOnMainThread:@selector(callProccessEvent) withObject:nil waitUntilDone:NO]; } - + void SkEvent::SignalNonEmptyQueue() { static id gNonEmptyQueueObject; if (nil == gNonEmptyQueueObject) { @@ -149,32 +152,32 @@ void SkOSWindow::onAddMenu(const SkOSMenu* sk_menu) } [gNonEmptyQueueObject signalNonEmptyQ]; } - + @end - + #endif - + /////////////////////////////////////////////////////////////////////////////// - + static CFRunLoopTimerRef gTimer; - + static void TimerCallback(CFRunLoopTimerRef timer, void* info) { gTimer = NULL; SkEvent::ServiceQueueTimer(); } - + void SkEvent::SignalQueueTimer(SkMSec delay) { //We always release the timer right after we've added it to our RunLoop, //thus we don't worry about freeing it later: if it fires our callback, //it gets automatically freed, as it does if we call invalidate() - + if (gTimer) { // our callback wasn't called, so invalidate it CFRunLoopTimerInvalidate(gTimer); gTimer = NULL; } - + if (delay) { gTimer = CFRunLoopTimerCreate(NULL, CACurrentMediaTime() + delay/1000.0, @@ -205,4 +208,3 @@ void SkOSWindow::detachGL() { void SkOSWindow::presentGL() { glFlush(); } - |