mirror of
https://github.com/ksherlock/TwoTerm.git
synced 2025-01-03 07:29:28 +00:00
new method for processing data in large chunks.
git-svn-id: svn://qnap.local/TwoTerm/trunk@3116 5590a31f-7b70-45f8-8c82-aa3a8e5f4507
This commit is contained in:
parent
31b0aea4c0
commit
cb7ceeb697
@ -39,7 +39,12 @@ extern "C" unsigned EventCharacters(NSEvent *event, std::u32string &rv);
|
||||
|
||||
@protocol Emulator
|
||||
|
||||
@optional
|
||||
-(void)processCharacter: (uint8_t)c screen: (Screen *)screen output: (OutputChannel *)output;
|
||||
-(void)processData: (const uint8_t *)data length: (size_t)length screen: (Screen *)screen output: (OutputChannel *)output;
|
||||
|
||||
@required
|
||||
|
||||
-(void)keyDown: (NSEvent *)event screen: (Screen *)screen output: (OutputChannel *)output;
|
||||
|
||||
-(void)reset;
|
||||
|
@ -538,13 +538,9 @@
|
||||
|
||||
typedef void (*ProcessCharFX)(id, SEL, uint8_t, Screen *, OutputChannel *);
|
||||
|
||||
ProcessCharFX fx;
|
||||
SEL cmd;
|
||||
OutputChannel channel(_fd);
|
||||
iRect updateRect;
|
||||
|
||||
cmd = @selector(processCharacter: screen: output:);
|
||||
fx = (ProcessCharFX)[_emulator methodForSelector: cmd];
|
||||
|
||||
#if 0
|
||||
FILE *debug = fopen("/tmp/debug.txt", "a");
|
||||
@ -553,25 +549,48 @@
|
||||
fclose(debug);
|
||||
#endif
|
||||
|
||||
NSAutoreleasePool *pool;
|
||||
pool = [NSAutoreleasePool new];
|
||||
_screen.beginUpdate();
|
||||
|
||||
|
||||
for (unsigned i = 0; i < size; ++i)
|
||||
{
|
||||
fx(_emulator,cmd, buffer[i], &_screen, &channel);
|
||||
if ([_emulator respondsToSelector: @selector(processData:length:screen:output:)]) {
|
||||
|
||||
@autoreleasepool {
|
||||
|
||||
_screen.beginUpdate();
|
||||
[_emulator processData: buffer length: size screen: &_screen output: &channel];
|
||||
updateRect = _screen.endUpdate();
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^(){
|
||||
|
||||
[self invalidateIRect: updateRect];
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
updateRect = _screen.endUpdate();
|
||||
@autoreleasepool {
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^(){
|
||||
SEL cmd = @selector(processCharacter: screen: output:);
|
||||
ProcessCharFX fx = (ProcessCharFX)[_emulator methodForSelector: cmd];
|
||||
|
||||
[self invalidateIRect: updateRect];
|
||||
_screen.beginUpdate();
|
||||
|
||||
});
|
||||
|
||||
[pool release];
|
||||
for (unsigned i = 0; i < size; ++i)
|
||||
{
|
||||
fx(_emulator, cmd, buffer[i], &_screen, &channel);
|
||||
}
|
||||
|
||||
updateRect = _screen.endUpdate();
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^(){
|
||||
|
||||
[self invalidateIRect: updateRect];
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user