Keep clone stamp preview through host save and use the action clock

这个提交包含在:
mac 于 2026-11-05 23:51:06 +08:00 提交
1 父节点 df9b3c0253
当前提交 5032ce70ab
6 个文件已更改
+98 -40

没有与搜索条件相匹配的文件

@@ -90,7 +90,7 @@
{
DYDiagnosticManager *base=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(base,&error);
DYWorkspaceDiagnosticHost *base=[[[DYWorkspaceDiagnosticHost alloc]init]autorelease];DYCreateParameters(base,&error);
DYToolCanvasProbe *host=[[[DYToolCanvasProbe alloc]init]autorelease];host->_base=base;host->_time=kCMTimeZero;
id<DYToolCanvasHostProbe> plugin=(id)[[NSClassFromString(@"DYPlugIn")alloc]initWithAPIManager:host];
[plugin scheduleToolCanvasRegistration];NSData *state=nil;[plugin pluginState:&state atTime:kCMTimeZero quality:(FxQuality)0 error:&error];
@@ -112,10 +112,22 @@
click(180,291.25); // normalized source (0.25, 0.25)
NSInteger part=down(348,244);
[osc mouseDraggedAtPositionX:460 positionY:181 activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];
up(460,181,part);drain();
CMTime actionTime=CMTimeMake(39,25);
[osc drawOSCWithWidth:640 height:400 activePart:part destinationImage:overlay atTime:actionTime];
host->_time=actionTime;
up(460,181,part);
[osc drawOSCWithWidth:640 height:400 activePart:part destinationImage:overlay atTime:actionTime];
run.record(@"native-osc-stamp-preview-survives-async-save-and-different-render-time",
[[(id)osc valueForKey:@"stampSaving"]boolValue]&&[[viewer valueForKey:@"stampArmed"]boolValue]&&
[[(id)osc valueForKey:@"stampHasSource"]boolValue]&&!DYSharedMasks(DYReadTools(base,kCMTimeZero).document).count);
drain();
NSDictionary *stamp=[DYSharedMasks(DYReadTools(host,kCMTimeZero).document) firstObject];NSArray *source=stamp[@"stampSource"];
DYMaskParameters target=DYMaskAtTime(stamp,kCMTimeZero);
run.record(@"native-osc-creates-one-stamp-and-one-undo-from-source-click-and-drag",source.count==4&&fabs([source[0]doubleValue]-.25)<1e-6&&fabs([source[1]doubleValue]-.25)<1e-6&&fabs(target.centerX-.65)<1e-6&&fabs(target.centerY-.5)<1e-6&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
run.record(@"native-osc-stamp-selects-saved-overlay-when-action-time-differs",
stamp&&[[plugin toolCanvasMaskAtTime:actionTime][@"id"]isEqual:stamp[@"id"]]&&
![[viewer valueForKey:@"stampArmed"]boolValue]&&![[(id)osc valueForKey:@"stampSaving"]boolValue]);
host->_time=kCMTimeZero;
[osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero];
NSString *stampID=[[stamp[@"id"]copy]autorelease];
NSMutableDictionary *tracked=DYMutablePlist(DYReadTools(host,kCMTimeZero).document);
@@ -151,5 +163,21 @@
run.record(@"native-osc-stamp-resizes-coverage-without-rotation-handle-or-track-changes",!rotationHandle&&part==2&&enlarged.width>target.width&&enlarged.height>target.height&&enlarged.centerX==target.centerX&&enlarged.centerY==target.centerY&&[resized[@"keys"]isEqual:keys]);
click(251,104);drain(); // top-down viewport y=30...345, forward button is x=212...290.
run.record(@"native-osc-stamp-forward-action-starts-the-existing-host-tracker",host->_forwardStarts==1&&host->_backwardStarts==0);
[plugin cleanupAnalysis:nil];drain();[(id)osc release];[(id)plugin release];
[plugin cleanupAnalysis:nil];drain();
NSDictionary *beforeRejected=DYReadTools(base,kCMTimeZero).document;
base->_rejectToolsWrites=YES;
click(NSMidX(button),400-NSMidY(button));
click(180,291.25);
part=down(348,244);up(460,181,part);drain();
run.record(@"native-osc-stamp-rejected-write-keeps-the-draft-and-existing-document",
[beforeRejected isEqual:DYReadTools(base,kCMTimeZero).document]&&
[[viewer valueForKey:@"stampArmed"]boolValue]&&[[(id)osc valueForKey:@"stampHasSource"]boolValue]&&
[(id)osc valueForKey:@"stampFailure"]!=nil);
base->_rejectToolsWrites=NO;
part=down(348,244);up(460,181,part);drain();
NSArray *afterRetry=DYSharedMasks(DYReadTools(base,kCMTimeZero).document);
run.record(@"native-osc-stamp-retries-with-the-same-source-and-saves-once",
afterRetry.count==DYSharedMasks(beforeRejected).count+1&&
[afterRetry.lastObject[@"stampSource"]isEqual:source]&&![[viewer valueForKey:@"stampArmed"]boolValue]);
[(id)osc release];[(id)plugin release];
}