333 行
37 KiB
C++
333 行
37 KiB
C++
// Exercise actual OSC hit geometry, host writes and production Metal output.
|
|
{
|
|
DYDiagnosticManager *base=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(base,nil);
|
|
DYToolCanvasProbe *host=[[[DYToolCanvasProbe alloc]init]autorelease];host->_base=base;host->_time=kCMTimeZero;
|
|
id<DYViewerParameterProbe>bridge=(id)[[NSClassFromString(@"DYViewerParameterBridge")alloc]initWithAPIManager:host];
|
|
id<DYViewerControlsProbe>panel=(id)[NSClassFromString(@"DYViewerParameterPanel")new];panel.bridge=bridge;
|
|
auto drain=[](){double until=NSProcessInfo.processInfo.systemUptime+.06;while(NSProcessInfo.processInfo.systemUptime<until)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.002]];};
|
|
auto publish=[&](){DYUniforms u;DYReadUniforms(host,host->_time,&u);[bridge publishUniforms:&u document:DYReadTools(host,host->_time).document atTime:host->_time];[bridge publishAssets:DYReadAssets(host,host->_time)atTime:host->_time];[panel prepareWithSize:NSMakeSize(1280,720)scale:1 atTime:host->_time];};
|
|
auto area=[&](NSString *kind)->NSDictionary*{for(NSDictionary*a in [(id)panel valueForKey:@"areas"])if([a[@"kind"]isEqual:kind])return [[a copy]autorelease];return nil;};
|
|
auto drag=[&](NSPoint a,NSPoint b){[panel event:NSEventTypeLeftMouseDown point:a atTime:host->_time];[panel event:NSEventTypeLeftMouseDragged point:b atTime:host->_time];drain();[panel event:NSEventTypeLeftMouseUp point:b atTime:host->_time];drain();publish();};
|
|
[(id)panel setValue:@"hsl" forKey:@"toolType"];publish();NSRect plot=[area(@"hslPlot")[@"rect"]rectValue];int undo=base->_undoStarts;
|
|
NSPoint a=NSMakePoint(NSMinX(plot)+plot.size.width*2.5/8,NSMidY(plot)),b=NSMakePoint(a.x,NSMinY(plot)-40);drag(a,b);
|
|
DYUniforms edited;DYReadUniforms(host,kCMTimeZero,&edited);run.record(@"canvas-hsl-plot-captures-outside-and-commits-one-undo",edited.hslHueA[2]==100&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
|
|
NSMutableDictionary *doc=DYMutablePlist(DYReadTools(host,kCMTimeZero).document);NSString *layerID=DYInsertTool(doc,@"hsl",@"base:hsl")[@"id"];DYWriteTools(host,doc,kCMTimeZero);publish();[(id)panel setValue:layerID forKey:@"nodeID"];publish();plot=[area(@"hslPlot")[@"rect"]rectValue];a=NSMakePoint(NSMinX(plot)+plot.size.width*2.5/8,NSMidY(plot));b=NSMakePoint(a.x,NSMidY(plot)-plot.size.height*.25);drag(a,b);DYReadUniforms(host,kCMTimeZero,&edited);
|
|
run.record(@"canvas-hsl-independent-uuid-does-not-edit-base",edited.hslHueA[2]==100&&fabs([DYToolWithID(DYReadTools(host,kCMTimeZero).document,layerID)[@"values"][@"hsl0_2"]doubleValue]-50)<1e-5);
|
|
[(id)panel setValue:@"spider" forKey:@"toolType"];publish();plot=[area(@"spiderPlot")[@"rect"]rectValue];auto mesh=dy::neutralMesh();int selected=dy::meshIndex(mesh,0,2);a=NSMakePoint(plot.origin.x+mesh.x[selected]*plot.size.width,plot.origin.y+mesh.y[selected]*plot.size.height);b=NSMakePoint(a.x+9,a.y-6);undo=base->_undoStarts;drag(a,b);
|
|
NSData *saved=DYReadAssets(host,kCMTimeZero).spiderMesh;auto changed=DYSpiderMesh(saved);run.record(@"canvas-spider-drags-real-mesh-and-closes-one-undo",saved.length&&fabs(changed.x[selected]-mesh.x[selected])>.001&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
|
|
doc=DYMutablePlist(DYReadTools(host,kCMTimeZero).document);NSString *spiderID=DYInsertTool(doc,@"spider",@"base:spider")[@"id"];DYWriteTools(host,doc,kCMTimeZero);publish();[(id)panel setValue:spiderID forKey:@"nodeID"];publish();plot=[area(@"spiderPlot")[@"rect"]rectValue];a=NSMakePoint(plot.origin.x+mesh.x[selected]*plot.size.width,plot.origin.y+mesh.y[selected]*plot.size.height);b=NSMakePoint(a.x-8,a.y+5);drag(a,b);
|
|
run.record(@"canvas-spider-uuid-persists-mesh-without-touching-base",[saved isEqual:DYReadAssets(host,kCMTimeZero).spiderMesh]&&[DYToolWithID(DYReadTools(host,kCMTimeZero).document,spiderID)[@"spider"]length]>0);
|
|
NSData *current=DYToolWithID(DYReadTools(host,kCMTimeZero).document,spiderID)[@"spider"];[bridge beginSpider:current node:spiderID enabled:1 atTime:kCMTimeZero];drain();doc=DYMutablePlist(DYReadTools(host,kCMTimeZero).document);auto external=dy::neutralMesh(12,12);NSData *externalData=[NSData dataWithBytes:&external length:sizeof(external)];((NSMutableDictionary*)DYToolWithID(doc,spiderID))[@"spider"]=externalData;DYWriteTools(host,doc,kCMTimeZero);[bridge changeSpider:current];[bridge endGesture];drain();
|
|
run.record(@"canvas-spider-external-topology-change-wins",[DYToolWithID(DYReadTools(host,kCMTimeZero).document,spiderID)[@"spider"]isEqual:externalData]);
|
|
[panel finishCapture];panel.bridge=nil;[bridge invalidate];drain();[(id)panel release];[(id)bridge release];
|
|
}
|
|
{
|
|
const NSUInteger w=64,h=48;DYDiagnosticTile *src=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:w height:h]autorelease],*dst=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:w height:h]autorelease];Pixels grid(w*h*4);
|
|
for(NSUInteger y=0;y<h;y++)for(NSUInteger x=0;x<w;x++){NSUInteger i=(y*w+x)*4;grid[i]=x/double(w-1)*.5;grid[i+1]=y/double(h-1)*.5;grid[i+2]=.1;grid[i+3]=1;}
|
|
[[src metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,w,h)mipmapLevel:0 withBytes:grid.data()bytesPerRow:w*8];DYRenderer *lens=[[[DYRenderer alloc]init]autorelease];DYUniforms u=DYToolUniforms(@{@"type":@"lens"});
|
|
Pixels identity=render(run,lens,src,dst,gpu,u,@{},@"lens-neutral-production-render");run.record(@"lens-neutral-is-identity-with-existing-prefix",difference(identity,grid).maximum<.002&&offsetof(DYUniforms,lensSectionEnabled)==1312);
|
|
u.lensStrength=80;Pixels positive=render(run,lens,src,dst,gpu,u,@{},@"lens-positive-production-render");u.lensStrength=-80;Pixels negative=render(run,lens,src,dst,gpu,u,@{},@"lens-negative-production-render");NSUInteger sample=(h/2*w+w*3/4)*4;
|
|
run.record(@"lens-directions-move-source-in-opposite-directions",positive[sample]>identity[sample]&&negative[sample]<identity[sample]&&difference(positive,negative).maximum>.01);
|
|
BOOL finite=YES,alpha=YES;for(NSUInteger i=0;i<w*h;i++){for(int c=0;c<4;c++)finite&=std::isfinite((float)positive[i*4+c])&&std::isfinite((float)negative[i*4+c]);alpha&=positive[i*4+3]>=0&&positive[i*4+3]<=1;}
|
|
run.record(@"lens-keeps-finite-premultiplied-border-alpha",finite&&alpha&&positive[3]<1);
|
|
double worst=0;for(NSUInteger y=4;y<h-4;y+=5)for(NSUInteger x=4;x<w-4;x+=7){double aspect=w/double(h),qx=(x+.5)/w-.5,qy=(y+.5)/h-.5,r2=(qx*qx*aspect*aspect+qy*qy)/(.25*(aspect*aspect+1)),sx=.5+qx*(1-.2*r2),sy=.5+qy*(1-.2*r2);double expectedX=(sx*w-.5)/(w-1)*.5,expectedY=(sy*h-.5)/(h-1)*.5;worst=MAX(worst,fabs((float)negative[(y*w+x)*4]-expectedX));worst=MAX(worst,fabs((float)negative[(y*w+x)*4+1]-expectedY));}
|
|
run.record(@"lens-gpu-matches-independent-inverse-radial-oracle",worst<.003,@{@"maximumError":@(worst)});
|
|
NSURL *cube=[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"unsupported-lens.cube"]];NSError *failure=nil;run.record(@"lens-spatial-correction-is-refused-by-cube-export",![lens exportLUT:cube uniforms:u paths:@{}spider:nil tools:[[[DYToolDocument alloc]init]autorelease].document error:&failure]&&failure);
|
|
}
|
|
NSString *faceFixture=NSProcessInfo.processInfo.environment[@"DY_DIAGNOSTIC_FACE_FIXTURE"];
|
|
if(faceFixture.length){
|
|
NSBitmapImageRep *bitmap=[NSBitmapImageRep imageRepWithContentsOfFile:faceFixture];run.need(@"face-real-portrait-fixture-loaded",bitmap.pixelsWide==512&&bitmap.pixelsHigh==512);
|
|
const NSUInteger w=512,h=512;DYDiagnosticTile *src=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:w height:h]autorelease],*dst=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:w height:h]autorelease];Pixels portrait(w*h*4);
|
|
auto linear=[](double c){return c<=.04045?c/12.92:pow((c+.055)/1.055,2.4);};
|
|
for(NSUInteger y=0;y<h;y++)for(NSUInteger x=0;x<w;x++){NSColor *c=[[bitmap colorAtX:x y:y]colorUsingColorSpace:NSColorSpace.sRGBColorSpace];NSUInteger i=(y*w+x)*4;portrait[i]=linear(c.redComponent);portrait[i+1]=linear(c.greenComponent);portrait[i+2]=linear(c.blueComponent);portrait[i+3]=1;}
|
|
// Same hue as a cheek, deliberately outside the face, must remain unprotected.
|
|
for(NSUInteger y=400;y<480;y++)for(NSUInteger x=400;x<480;x++)for(int c=0;c<3;c++)portrait[(y*w+x)*4+c]=portrait[(115*w+220)*4+c];
|
|
auto upload=[&](const Pixels& pixels){[[src metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,w,h)mipmapLevel:0 withBytes:pixels.data()bytesPerRow:w*8];};upload(portrait);
|
|
DYRenderer *face=[[[DYRenderer alloc]init]autorelease];DYUniforms u=DYToolUniforms(@{@"type":@"hsl"});u.hslHueA=(DYFloat4){40,40,40,40};u.hslHueB=(DYFloat4){40,40,40,40};u.skinProtection=(DYFloat3){1,100,28};u.skinFaceOnly=1;
|
|
Pixels protectedFrame=render(run,face,src,dst,gpu,u,@{},@"face-protected-production-render");NSData *entries=[face valueForKey:@"faceEntries"];NSInteger faces=0;const DYToolMaskEntry *values=(const DYToolMaskEntry*)entries.bytes;for(NSUInteger i=0;i<entries.length/sizeof(*values);i++)faces+=values[i].section==-100;
|
|
double faceX=0,faceY=0;for(NSUInteger i=0;i<entries.length/sizeof(*values);i++)if(values[i].section==-100){faceX=values[i].mask.parameters.centerX;faceY=values[i].mask.parameters.centerY;break;}run.record(@"face-vision-finds-real-portrait-and-builds-support",faces>=1,@{@"faces":@(faces),@"centerX":@(faceX),@"centerY":@(faceY)});u.skinProtection.x=0;Pixels unprotected=render(run,face,src,dst,gpu,u,@{},@"face-unprotected-reference-render");double inside=0,outside=0;
|
|
for(NSUInteger y=65;y<185;y++)for(NSUInteger x=175;x<275;x++)for(int c=0;c<3;c++)inside=MAX(inside,fabs((float)protectedFrame[(y*w+x)*4+c]-(float)unprotected[(y*w+x)*4+c]));for(NSUInteger y=410;y<470;y++)for(NSUInteger x=410;x<470;x++)for(int c=0;c<3;c++)outside=MAX(outside,fabs((float)protectedFrame[(y*w+x)*4+c]-(float)unprotected[(y*w+x)*4+c]));
|
|
run.record(@"face-protects-face-color-without-same-hue-background",inside>.005&&outside<.002,@{@"faceDifference":@(inside),@"backgroundDifference":@(outside)});
|
|
u.skinProtection.x=1;u.skinVisualize=1;Pixels selection=render(run,face,src,dst,gpu,u,@{},@"face-actual-selection-preview-render");double white=0,black=0;for(NSUInteger y=65;y<185;y++)for(NSUInteger x=175;x<275;x++)white=MAX(white,(float)selection[(y*w+x)*4]);for(NSUInteger y=410;y<470;y++)for(NSUInteger x=410;x<470;x++)black=MAX(black,(float)selection[(y*w+x)*4]);
|
|
double maximum=0;NSUInteger maxX=0,maxY=0;for(NSUInteger y=0;y<h;y++)for(NSUInteger x=0;x<w;x++)if(selection[(y*w+x)*4]>maximum){maximum=selection[(y*w+x)*4];maxX=x;maxY=y;}
|
|
run.record(@"face-preview-shows-actual-weight-and-excludes-background",white>.01&&black<.001,@{@"faceWeight":@(white),@"backgroundWeight":@(black),@"maximum":@(maximum),@"maxX":@(maxX),@"maxY":@(maxY)});
|
|
// Both FxPlug row conventions must resolve the same visual face.
|
|
Pixels flipped(portrait.size());for(NSUInteger y=0;y<h;y++)memcpy(flipped.data()+y*w*4,portrait.data()+(h-1-y)*w*4,w*8);upload(flipped);[src setDiagnosticImageOrigin:kFxImageOrigin_BOTTOM_LEFT];[dst setDiagnosticImageOrigin:kFxImageOrigin_BOTTOM_LEFT];u.skinVisualize=0;Pixels bottom=render(run,face,src,dst,gpu,u,@{},@"face-bottom-origin-production-render");double flipError=0;for(NSUInteger y=0;y<h;y++)for(NSUInteger x=0;x<w*4;x++)flipError=MAX(flipError,fabs((float)bottom[(h-1-y)*w*4+x]-(float)protectedFrame[y*w*4+x]));run.record(@"face-top-and-bottom-origins-protect-identical-visual-region",flipError<.003,@{@"maximumError":@(flipError)});[src setDiagnosticImageOrigin:kFxImageOrigin_TOP_LEFT];[dst setDiagnosticImageOrigin:kFxImageOrigin_TOP_LEFT];upload(portrait);
|
|
NSMutableDictionary *masked=DYMutablePlist([[[DYToolDocument alloc]init]autorelease].document);NSMutableDictionary *zero=DYMutablePlist(DYNewMask(DYMaskRectangle));DYMaskParameters zeroP=DYMaskAtTime(zero,kCMTimeZero);zeroP.strength=0;zero[@"parameters"]=[NSData dataWithBytes:&zeroP length:sizeof(zeroP)];masked[@"baseMasks"][@"skin"]=[NSMutableArray arrayWithObject:zero];u.skinVisualize=1;NSError *maskError=nil;BOOL maskOK=[face renderSource:src destination:dst uniforms:u paths:@{}spider:nil tools:masked error:&maskError];Pixels empty=read(dst,gpu);double emptyMax=0;for(NSUInteger i=0;i<w*h;i++)emptyMax=MAX(emptyMax,(float)empty[i*4]);run.record(@"face-preview-respects-authored-zero-strength-mask",maskOK&&emptyMax<.001);
|
|
u.skinVisualize=0;u.skinProtection.x=0;NSMutableDictionary *layers=DYMutablePlist([[[DYToolDocument alloc]init]autorelease].document);NSMutableDictionary *skin=(id)DYInsertTool(layers,@"skin",@"base:skin");skin[@"values"][@"skinEnabled"]=@1;skin[@"values"][@"skinStrength"]=@100;skin[@"values"][@"skinVisualize"]=@1;BOOL layerOK=[face renderSource:src destination:dst uniforms:u paths:@{}spider:nil tools:layers error:&maskError];Pixels layerMask=read(dst,gpu);double layerFace=0,layerBackground=0;for(NSUInteger y=65;y<185;y++)for(NSUInteger x=175;x<275;x++)layerFace=MAX(layerFace,(float)layerMask[(y*w+x)*4]);for(NSUInteger y=410;y<470;y++)for(NSUInteger x=410;x<470;x++)layerBackground=MAX(layerBackground,(float)layerMask[(y*w+x)*4]);run.record(@"face-independent-layer-uses-own-preview-and-face-mask",layerOK&&layerFace>.01&&layerBackground<.001);
|
|
DYDiagnosticTile *twoSource=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:1024 height:512]autorelease],*twoDest=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:1024 height:512]autorelease];Pixels two(1024*512*4);for(NSUInteger y=0;y<512;y++)for(NSUInteger x=0;x<1024;x++)memcpy(two.data()+(y*1024+x)*4,portrait.data()+(y*512+x%512)*4,8);[[twoSource metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,1024,512)mipmapLevel:0 withBytes:two.data()bytesPerRow:1024*8];u.skinProtection.x=1;BOOL twoOK=[face renderSource:twoSource destination:twoDest uniforms:u paths:@{}error:&maskError];NSData *twoEntries=[face valueForKey:@"faceEntries"];const DYToolMaskEntry *twoMasks=(const DYToolMaskEntry*)twoEntries.bytes;NSInteger faceCount=0;for(NSUInteger i=0;i<twoEntries.length/sizeof(*twoMasks);i++)faceCount+=twoMasks[i].section==-100;run.record(@"face-multiple-people-build-independent-support-regions",twoOK&&faceCount==2,@{@"faces":@(faceCount)});
|
|
NSMutableDictionary *privacy=DYMutablePlist(DYInitialToolDocument(nil));privacy[@"mosaic"]=@{@"enabled":@YES,@"source":@"face",@"size":@64};DYUniforms privacyU=defaults;privacyU.primarySectionEnabled=0;privacyU.skinProtection.x=0;
|
|
BOOL privacyOK=[face renderSource:src destination:dst uniforms:privacyU paths:@{} spider:nil tools:privacy colorManagement:nil hostPrimaries:kFxColorPrimaries_Rec709 error:&maskError];Pixels privateFrame=read(dst,gpu);
|
|
privacy[@"mosaic"] = @{@"enabled":@NO,@"source":@"face",@"size":@64};BOOL privacyOff=[face renderSource:src destination:dst uniforms:privacyU paths:@{} spider:nil tools:privacy colorManagement:nil hostPrimaries:kFxColorPrimaries_Rec709 error:&maskError];Pixels privateReference=read(dst,gpu);
|
|
double privateInside=0,privateOutside=0;for(NSUInteger y=85;y<145;y++)for(NSUInteger x=200;x<260;x++)for(int c=0;c<3;c++)privateInside=MAX(privateInside,fabs((float)privateFrame[(y*w+x)*4+c]-(float)privateReference[(y*w+x)*4+c]));for(NSUInteger y=410;y<470;y++)for(NSUInteger x=410;x<470;x++)for(int c=0;c<3;c++)privateOutside=MAX(privateOutside,fabs((float)privateFrame[(y*w+x)*4+c]-(float)privateReference[(y*w+x)*4+c]));
|
|
run.record(@"mosaic-real-face-includes-feature-region-and-excludes-background",privacyOK&&privacyOff&&privateInside>.05&&privateOutside==0,@{@"faceChange":@(privateInside),@"backgroundChange":@(privateOutside)});
|
|
// The same production menu writer turns two detected faces into independent,
|
|
// serializable masks, then toggles only one while preserving the other pixels.
|
|
privacy[@"mosaic"]=@{@"enabled":@YES,@"source":@"face",@"size":@64};
|
|
BOOL fastOK=[face renderSource:twoSource destination:twoDest uniforms:privacyU paths:@{} spider:nil tools:DYToolRenderSnapshot(privacy,kCMTimeZero) colorManagement:nil hostPrimaries:kFxColorPrimaries_Rec709 error:&maskError];
|
|
NSDictionary *detected=[face mosaicFaceSnapshot];Pixels bothFaces=read(twoDest,gpu);
|
|
run.record(@"mosaic-fast-rectangles-detect-two-faces-without-landmarks",fastOK&&[detected[@"boxes"]count]==2,@{@"faces":@([detected[@"boxes"]count])});
|
|
if([detected[@"boxes"]count]==2){
|
|
DYDiagnosticManager *base=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(base,nil);DYWriteTools(base,privacy,kCMTimeZero);
|
|
DYToolCanvasProbe *host=[[[DYToolCanvasProbe alloc]init]autorelease];host->_base=base;host->_time=kCMTimeZero;
|
|
id bridge=[[NSClassFromString(@"DYViewerParameterBridge")alloc]initWithAPIManager:host];[bridge setValue:face forKey:@"renderer"];
|
|
NSMenuItem *item=[[[NSMenuItem alloc]init]autorelease];item.representedObject=@{@"importFaces":detected,@"actionTime":detected[@"time"]};
|
|
int undo=base->_undoStarts;[bridge performSelector:@selector(applyMosaicMenu:) withObject:item];
|
|
NSDictionary *saved=DYReadTools(host,kCMTimeZero).document;NSArray *IDs=saved[@"mosaic"][@"maskIDs"];
|
|
run.record(@"mosaic-import-faces-creates-two-stable-masks-in-one-undo",IDs.count==2&&DYSharedMasks(saved).count==2&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
|
|
BOOL savedOK=[face renderSource:twoSource destination:twoDest uniforms:privacyU paths:@{} spider:nil tools:DYToolRenderSnapshot(saved,kCMTimeZero) colorManagement:nil hostPrimaries:kFxColorPrimaries_Rec709 error:&maskError];
|
|
run.record(@"mosaic-imported-selection-matches-live-two-face-render",savedOK&&difference(bothFaces,read(twoDest,gpu)).maximum<.002);
|
|
if(IDs.count==2){
|
|
item.representedObject=@{@"toggleMask":IDs[1]};[bridge performSelector:@selector(applyMosaicMenu:) withObject:item];saved=DYReadTools(host,kCMTimeZero).document;
|
|
[face renderSource:twoSource destination:twoDest uniforms:privacyU paths:@{} spider:nil tools:DYToolRenderSnapshot(saved,kCMTimeZero) colorManagement:nil hostPrimaries:kFxColorPrimaries_Rec709 error:&maskError];Pixels single=read(twoDest,gpu);
|
|
privacy[@"mosaic"]=@{@"enabled":@NO,@"source":@"face",@"size":@64};[face renderSource:twoSource destination:twoDest uniforms:privacyU paths:@{} spider:nil tools:privacy colorManagement:nil hostPrimaries:kFxColorPrimaries_Rec709 error:&maskError];Pixels reference=read(twoDest,gpu);
|
|
double left=0,right=0;for(NSUInteger y=0;y<512;y++)for(NSUInteger x=0;x<1024;x++)for(int c=0;c<3;c++){double delta=fabs((float)single[(y*1024+x)*4+c]-(float)reference[(y*1024+x)*4+c]);if(x<512)left=MAX(left,delta);else right=MAX(right,delta);}
|
|
run.record(@"mosaic-selects-one-person-with-other-person-pixel-identical",left>.05&&right==0&&[saved[@"mosaic"][@"maskIDs"]count]==1,@{@"selectedChange":@(left),@"unselectedChange":@(right)});
|
|
NSData *archive=[NSKeyedArchiver archivedDataWithRootObject:DYReadTools(host,kCMTimeZero) requiringSecureCoding:YES error:nil];DYToolDocument *restored=[NSKeyedUnarchiver unarchivedObjectOfClass:DYToolDocument.class fromData:archive error:nil];run.record(@"mosaic-person-selection-survives-secure-save-and-reopen",[restored.document isEqual:saved]);
|
|
NSMutableDictionary *malformed=DYMutablePlist(saved);malformed[@"mosaic"][@"maskIDs"]=@[IDs[0],IDs[0]];run.record(@"mosaic-duplicate-mask-identities-rejected",!DYValidToolDocument(malformed));
|
|
}
|
|
[bridge invalidate];[bridge release];
|
|
}
|
|
Pixels noFace(w*h*4);for(NSUInteger i=0;i<w*h;i++){noFace[i*4]=.35;noFace[i*4+1]=.18;noFace[i*4+2]=.1;noFace[i*4+3]=1;}upload(noFace);u.skinVisualize=0;Pixels noFaceProtected=render(run,face,src,dst,gpu,u,@{},@"face-none-protected-render");u.skinProtection.x=0;Pixels noFacePlain=render(run,face,src,dst,gpu,u,@{},@"face-none-unprotected-reference");run.record(@"face-no-detection-clears-prior-frame-and-fails-closed",difference(noFaceProtected,noFacePlain).maximum<.002);
|
|
}
|
|
|
|
|
|
// Verify the real Metal input stage with a moving target and a fixed source.
|
|
{
|
|
const NSUInteger w=64,h=48;
|
|
DYDiagnosticTile *src=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:w height:h]autorelease];
|
|
DYDiagnosticTile *dst=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:w height:h]autorelease];
|
|
Pixels input(w*h*4);
|
|
for(NSUInteger y=0;y<h;y++)for(NSUInteger x=0;x<w;x++){
|
|
NSUInteger i=(y*w+x)*4;
|
|
input[i]=x/128.f;input[i+1]=y/96.f;input[i+2]=.15f;input[i+3]=1;
|
|
}
|
|
[[src metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,w,h) mipmapLevel:0 withBytes:input.data() bytesPerRow:w*8];
|
|
DYRenderer *renderer=[[[DYRenderer alloc]init]autorelease];
|
|
DYUniforms u=DYToolUniforms(@{@"type":@"lens"});
|
|
Pixels baseline=render(run,renderer,src,dst,gpu,u,@{},@"clone-stamp-reference-render");
|
|
NSMutableDictionary *doc=DYMutablePlist([[[DYToolDocument alloc]init]autorelease].document);
|
|
NSMutableDictionary *stamp=(id)DYAddSharedMask(doc,DYMaskEllipse);
|
|
DYMaskParameters p=DYMaskAtTime(stamp,kCMTimeZero);
|
|
p.centerX=48.5f/w;p.centerY=24.5f/h;p.width=.25f;p.height=.25f;
|
|
stamp[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];
|
|
stamp[@"stampSource"]=@[@(16.5f/w),@(12.5f/h),@.25,@.25];
|
|
CMTime next=CMTimeMake(1,25);DYMaskParameters moved=p;moved.centerY=34.5f/h;moved.width=.5f;moved.height=.12f;moved.angle=.65f;
|
|
run.record(@"clone-stamp-preserves-source-through-tracking-merge",DYMergeTracking(stamp,@[DYMaskKey(kCMTimeZero,p,NO,1),DYMaskKey(next,moved,NO,1)])&&[stamp[@"stampSource"] count]==4);
|
|
auto frame=[&](CMTime t,NSString *label){
|
|
NSError *failure=nil;
|
|
BOOL ok=[renderer renderSource:src destination:dst uniforms:u paths:@{} spider:nil tools:DYToolRenderSnapshot(doc,t) colorManagement:nil hostPrimaries:kFxColorPrimaries_Rec709 error:&failure];
|
|
run.need(label,ok,@{@"error":reason(failure)});return read(dst,gpu);
|
|
};
|
|
auto pixel=[&](const Pixels &a,NSUInteger x,NSUInteger y,const Pixels &b,NSUInteger u,NSUInteger v){
|
|
double delta=0;for(int c=0;c<4;c++)delta=MAX(delta,fabs((float)a[(y*w+x)*4+c]-(float)b[(v*w+u)*4+c]));return delta;
|
|
};
|
|
Pixels first=frame(kCMTimeZero,@"clone-stamp-production-render");
|
|
run.record(@"clone-stamp-copies-pixels-and-leaves-exterior-intact",pixel(first,48,24,baseline,16,12)<.002&&pixel(first,0,0,baseline,0,0)==0&&pixel(first,16,12,baseline,16,12)==0);
|
|
Pixels second=frame(next,@"clone-stamp-tracked-production-render");
|
|
run.record(@"clone-stamp-tracked-target-moves-while-sampling-the-same-source",pixel(second,48,34,baseline,16,12)<.002&&pixel(second,48,24,baseline,48,24)==0);
|
|
DYMaskParameters translated=DYMaskAtTime(stamp,next);
|
|
run.record(@"clone-stamp-ignores-legacy-tracking-scale-and-rotation",translated.angle==0&&translated.width==p.width&&translated.height==p.height&&translated.centerY==moved.centerY&&pixel(second,51,35,baseline,19,13)==0);
|
|
p.width=.5f;p.height=.35f;p.angle=.55f; // A legacy authored rotation must not rotate copied pixels.
|
|
stamp[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];
|
|
Pixels expanded=frame(kCMTimeZero,@"clone-stamp-resized-production-render");
|
|
run.record(@"clone-stamp-resize-extends-coverage-with-pixel-exact-translation",pixel(expanded,51,25,baseline,19,13)==0&&pixel(expanded,58,24,baseline,26,12)==0&&pixel(first,58,24,baseline,58,24)==0);
|
|
p.width=.25f;p.height=.25f;
|
|
stamp[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];
|
|
DYStampMotion startMotion;startMotion.active=true;
|
|
DYStampMotion endMotion=startMotion;
|
|
endMotion.sourceOffsetX=4.f/w;endMotion.sourceOffsetY=2.f/h;
|
|
endMotion.targetScaleX=2.f;endMotion.targetScaleY=2.f;
|
|
stamp[@"keys"]=@[DYStampKey(kCMTimeZero,p,NO,1,startMotion),DYStampKey(next,moved,NO,1,endMotion)];
|
|
CMTime half=CMTimeMake(1,50);
|
|
DYMaskParameters halfway=DYMaskAtTime(stamp,half);
|
|
NSArray *halfSource=DYStampSourceAtTime(stamp,half);
|
|
run.record(@"clone-stamp-interpolates-both-centers-and-coverage-scale",
|
|
fabs(halfway.centerY-29.5f/h)<1e-6&&fabs(halfway.width-.375)<1e-6&&
|
|
fabs([halfSource[0] doubleValue]-18.5f/w)<1e-6&&fabs([halfSource[1] doubleValue]-13.5f/h)<1e-6);
|
|
Pixels zoomed=frame(next,@"clone-stamp-paired-scale-production-render");
|
|
run.record(@"clone-stamp-relative-scale-remaps-source-and-expands-target-coverage",
|
|
pixel(zoomed,48,34,baseline,20,14)<.001&&pixel(zoomed,52,38,baseline,22,16)<.001&&
|
|
pixel(zoomed,60,34,baseline,26,14)<.001&&pixel(zoomed,0,0,baseline,0,0)==0);
|
|
float halfPixel=(baseline[(14*w+22)*4]+baseline[(14*w+23)*4])*.5f;
|
|
run.record(@"clone-stamp-fractional-zoom-interpolates-adjacent-source-pixels",
|
|
fabs(zoomed[(34*w+53)*4]-halfPixel)<.001);
|
|
endMotion.sourceScaleX=2.f;endMotion.sourceScaleY=2.f;
|
|
stamp[@"keys"]=@[DYStampKey(next,moved,YES,1,endMotion)];
|
|
Pixels equalZoom=frame(next,@"clone-stamp-equal-scale-production-render");
|
|
run.record(@"clone-stamp-equal-zoom-preserves-pixel-exact-copy",pixel(equalZoom,52,38,baseline,24,18)==0);
|
|
DYStampMotion subpixel=startMotion;
|
|
subpixel.sourceOffsetX=.5f/w;
|
|
stamp[@"keys"]=@[DYStampKey(next,p,NO,1,subpixel)];
|
|
Pixels atUnit=frame(next,@"clone-stamp-fractional-translation-at-unit-zoom");
|
|
subpixel.sourceScaleX=1.0002f;
|
|
stamp[@"keys"]=@[DYStampKey(next,p,NO,1,subpixel)];
|
|
Pixels nearUnit=frame(next,@"clone-stamp-fractional-translation-near-unit-zoom");
|
|
float unitPixel=(baseline[(12*w+16)*4]+baseline[(12*w+17)*4])*.5f;
|
|
run.record(@"clone-stamp-fractional-translation-is-continuous-through-unit-zoom",
|
|
fabs(atUnit[(24*w+48)*4]-unitPixel)<.0004f&&pixel(atUnit,48,24,nearUnit,48,24)<.0004f);
|
|
subpixel.sourceOffsetX=-16.5f/w;
|
|
subpixel.sourceScaleX=1;
|
|
stamp[@"keys"]=@[DYStampKey(next,p,NO,1,subpixel)];
|
|
Pixels atEdge=frame(next,@"clone-stamp-fractional-source-crossing-image-edge");
|
|
float edgePixel=(baseline[(12*w)*4]+baseline[(24*w+48)*4])*.5f;
|
|
run.record(@"clone-stamp-source-fades-continuously-at-image-edge",
|
|
fabs(atEdge[(24*w+48)*4]-edgePixel)<.0005f);
|
|
stamp[@"keys"]=@[DYStampKey(next,moved,YES,1,endMotion)];
|
|
DYMaskParameters differentTarget=moved;differentTarget.centerY=.45f;
|
|
endMotion.sourceScaleX=1.25f;
|
|
run.record(@"clone-stamp-retracking-updates-paired-data-without-overwriting-manual-target",
|
|
DYMergeTracking(stamp,@[DYStampKey(CMTimeMake(2,50),differentTarget,NO,.9,endMotion)])&&
|
|
[stamp[@"keys"] count]==1&&DYMaskAtTime(stamp,next).centerY==moved.centerY&&
|
|
DYStampMotionAtTime(stamp,next).sourceScaleX==1.25f);
|
|
CMTime frameDuration=CMTimeMake(1,25),nearStart=CMTimeMake(-1,150),nearEnd=CMTimeMake(7,150);
|
|
CMTime previous=CMTimeMake(-1,25),following=CMTimeMake(2,25),authored=CMTimeMake(1,150);
|
|
stamp[@"keys"]=@[DYMaskKey(previous,p,NO,1),DYMaskKey(nearStart,p,NO,1),
|
|
DYMaskKey(authored,p,YES,1),DYMaskKey(nearEnd,p,NO,1),DYMaskKey(following,p,NO,1)];
|
|
NSArray *pairKeys=@[DYStampKey(kCMTimeZero,p,NO,1,startMotion),DYStampKey(next,moved,NO,1,endMotion)];
|
|
BOOL merged=DYMergeTracking(stamp,pairKeys,frameDuration);
|
|
NSArray *mergedKeys=stamp[@"keys"];
|
|
run.record(@"clone-stamp-replaces-same-frame-automatic-keys-from-offset-host-clock",
|
|
merged&&mergedKeys.count==5&&[mergedKeys[0] isEqual:DYMaskKey(previous,p,NO,1)]&&
|
|
[mergedKeys[1] isEqual:pairKeys[0]]&&[mergedKeys[2] isEqual:DYMaskKey(authored,p,YES,1)]&&
|
|
[mergedKeys[3] isEqual:pairKeys[1]]&&[mergedKeys[4] isEqual:DYMaskKey(following,p,NO,1)]);
|
|
NSMutableArray *jitter=[NSMutableArray array];
|
|
for(int i=0;i<7;i++){
|
|
DYMaskParameters shape=p;
|
|
shape.centerX+=i*.01f+(i==3?.04f:0);
|
|
DYStampMotion motion=startMotion;
|
|
motion.sourceOffsetY=i*.01f+(i==3?.04f:0);
|
|
motion.sourceScaleX=expf(i*.02f+(i==3?.08f:0));
|
|
motion.targetScaleY=expf(i*-.02f+(i==3?-.08f:0));
|
|
[jitter addObject:DYStampKey(CMTimeMake(i,25),shape,NO,.9f,motion)];
|
|
}
|
|
stamp[@"keys"]=@[];
|
|
BOOL stable=DYMergeTracking(stamp,jitter,frameDuration);
|
|
NSArray *smoothed=stamp[@"keys"];
|
|
CMTime center=CMTimeMake(3,25);
|
|
auto filtered=DYStampMotionAtTime(stamp,center);
|
|
float expectedSpike=.04f*6/16;
|
|
run.record(@"clone-stamp-smooths-both-positions-and-log-scales-and-keeps-analysis-endpoints",
|
|
stable&&smoothed.count==7&&[smoothed.firstObject isEqual:jitter.firstObject]&&
|
|
[smoothed.lastObject isEqual:jitter.lastObject]&&
|
|
fabs(DYMaskAtTime(stamp,center).centerX-p.centerX-.03f-expectedSpike)<1e-6&&
|
|
fabs(filtered.sourceOffsetY-.03f-expectedSpike)<1e-6&&
|
|
fabs(logf(filtered.sourceScaleX)-.09f)<1e-6&&fabs(logf(filtered.targetScaleY)+.09f)<1e-6);
|
|
stamp[@"keys"]=@[];
|
|
stable=DYMergeTracking(stamp,jitter.reverseObjectEnumerator.allObjects,frameDuration);
|
|
run.record(@"clone-stamp-smoothing-is-independent-of-analysis-direction",stable&&[stamp[@"keys"] isEqual:smoothed]);
|
|
stamp[@"enabled"]=@NO;Pixels disabled=frame(next,@"clone-stamp-disabled-render");
|
|
run.record(@"clone-stamp-disabled-is-identical",difference(disabled,baseline).maximum==0);
|
|
stamp[@"enabled"]=@YES;NSError *failure=nil;
|
|
NSURL *cube=[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"unsupported-clone.cube"]];
|
|
run.record(@"clone-stamp-spatial-state-refuses-static-cube-export",![renderer exportLUT:cube uniforms:u paths:@{} spider:nil tools:doc error:&failure]&&failure);
|
|
}
|
|
|
|
{
|
|
// Sample the real final GPU pass using linear X/Y ramps and opaque alpha.
|
|
const NSUInteger w=64,h=36;
|
|
DYDiagnosticTile *source=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:w height:h]autorelease];
|
|
DYDiagnosticTile *destination=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:w height:h]autorelease];
|
|
Pixels grid(w*h*4);
|
|
for(NSUInteger y=0;y<h;y++)for(NSUInteger x=0;x<w;x++){
|
|
NSUInteger i=(y*w+x)*4;grid[i]=(x+.5)/w;grid[i+1]=(y+.5)/h;grid[i+2]=.1;grid[i+3]=1;
|
|
}
|
|
[[source metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,w,h)mipmapLevel:0 withBytes:grid.data() bytesPerRow:w*8];
|
|
DYRenderer *renderer=[[[DYRenderer alloc]init]autorelease];DYUniforms u=DYToolUniforms(@{@"type":@"lens"});
|
|
NSMutableDictionary *doc=DYMutablePlist(DYInitialToolDocument(nil));
|
|
const double angle=-M_PI/6,aspect=w/double(h),c=cos(angle),s=sin(angle),zoom=c-s*aspect;
|
|
doc[@"levelRotation"]=@(angle);
|
|
NSError *failure=nil;
|
|
BOOL ok=[renderer renderSource:source destination:destination uniforms:u paths:@{} spider:nil tools:DYToolRenderSnapshot(doc,kCMTimeZero) colorManagement:nil hostPrimaries:kFxColorPrimaries_Rec709 error:&failure];
|
|
Pixels corrected=read(destination,gpu);
|
|
double worst=0,alpha=1;
|
|
for(NSUInteger y=0;y<h;y++)for(NSUInteger x=0;x<w;x++){
|
|
NSUInteger i=(y*w+x)*4;
|
|
double dx=((x+.5)/w-.5)/zoom,dy=((y+.5)/h-.5)/zoom;
|
|
double sx=std::clamp(.5+c*dx+s*dy/aspect,.5/w,1-.5/w);
|
|
double sy=std::clamp(.5+c*dy-s*dx*aspect,.5/h,1-.5/h);
|
|
worst=std::max({worst,fabs(corrected[i]-sx),fabs(corrected[i+1]-sy)});
|
|
alpha=MIN(alpha,corrected[i+3]);
|
|
}
|
|
run.record(@"level-metal-inverse-rotation-and-full-corner-coverage",ok&&worst<.002&&alpha==1,@{@"error":reason(failure),@"maximumError":@(worst),@"minimumAlpha":@(alpha)});
|
|
u.lensStrength=80;
|
|
BOOL positiveOK=[renderer renderSource:source destination:destination uniforms:u paths:@{} spider:nil tools:doc colorManagement:nil hostPrimaries:kFxColorPrimaries_Rec709 error:&failure];Pixels warped=read(destination,gpu);
|
|
u.lensStrength=-80;
|
|
BOOL negativeOK=[renderer renderSource:source destination:destination uniforms:u paths:@{} spider:nil tools:doc colorManagement:nil hostPrimaries:kFxColorPrimaries_Rec709 error:&failure];Pixels opposite=read(destination,gpu);
|
|
run.record(@"level-then-lens-keeps-both-spatial-operations-active",positiveOK&&negativeOK&&difference(warped,corrected).maximum>.01&&difference(warped,opposite).maximum>.01);
|
|
u.lensStrength=0;doc[@"levelMeasureOnly"]=@YES;
|
|
BOOL measured=[renderer renderSource:source destination:destination uniforms:u paths:@{} spider:nil tools:doc colorManagement:nil hostPrimaries:kFxColorPrimaries_Rec709 error:&failure];
|
|
run.record(@"level-measure-only-preserves-source-pixels",measured&&difference(read(destination,gpu),grid).maximum<.002);
|
|
[doc removeObjectForKey:@"levelMeasureOnly"];
|
|
NSURL *cube=[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"unsupported-level.cube"]];
|
|
run.record(@"level-spatial-transform-is-refused-by-cube-export",![renderer exportLUT:cube uniforms:u paths:@{} spider:nil tools:doc error:&failure]&&failure);
|
|
}
|
|
|
|
{
|
|
DYDiagnosticManager *base=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(base,nil);
|
|
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];
|
|
auto drain=[](){double end=NSProcessInfo.processInfo.systemUptime+.07;while(NSProcessInfo.processInfo.systemUptime<end)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.002]];};drain();
|
|
id<FxOnScreenControl_v4> osc=(id)[[NSClassFromString(@"DYToolOSC")alloc]initWithAPIManager:host];
|
|
DYDiagnosticTile *overlay=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:640 height:400]autorelease];
|
|
[osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero];
|
|
id viewer=[(id)osc valueForKey:@"viewerControls"];
|
|
BOOL update=NO;
|
|
auto down=[&](double x,double y){
|
|
NSInteger part=0;
|
|
[osc hitTestOSCAtMousePositionX:x mousePositionY:y activePart:&part atTime:kCMTimeZero];
|
|
[osc mouseDownAtPositionX:x positionY:y activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];return part;
|
|
};
|
|
auto up=[&](double x,double y,NSInteger part){[osc mouseUpAtPositionX:x positionY:y activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];};
|
|
auto click=[&](double x,double y){NSInteger part=down(x,y);up(x,y,part);};
|
|
auto control=[&](NSInteger part){
|
|
for(NSDictionary *a in [viewer valueForKey:@"areas"])if([a[@"part"]integerValue]==part){
|
|
NSRect r=[a[@"rect"]rectValue];click(NSMidX(r),400-NSMidY(r));break;
|
|
}
|
|
};
|
|
auto angle=[&](){return [DYReadTools(host,kCMTimeZero).document[@"levelRotation"] doubleValue];};
|
|
int undo=base->_undoStarts;
|
|
control(20026);
|
|
click(150,280);click(390,200);drain();
|
|
run.record(@"level-osc-two-points-horizontal-one-undo",fabs(angle()+atan2(80.,240.))<1e-6&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
|
|
NSDictionary *savedLevel=[[DYReadTools(host,kCMTimeZero).document copy]autorelease];
|
|
run.record(@"level-placed-line-is-persisted-with-reference-points",[savedLevel[@"levelReference"][@"points"]count]==4&&[[(id)osc valueForKey:@"levelPlaced"]boolValue]);
|
|
[osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero];
|
|
NSPoint lineFirst=[[(id)osc valueForKey:@"levelFirst"]pointValue];
|
|
NSRect imageRect=[[(id)osc valueForKey:@"imageRect"]rectValue];
|
|
DYLevelTransform transform(angle(),NSWidth(imageRect)/NSHeight(imageRect));NSPoint display=transform.toOutput(lineFirst);
|
|
double endpointX=NSMinX(imageRect)+display.x*NSWidth(imageRect),endpointY=400-NSMinY(imageRect)-display.y*NSHeight(imageRect);
|
|
NSInteger endpoint=down(endpointX,endpointY);up(endpointX+6,endpointY+10,endpoint);drain();
|
|
run.record(@"level-retained-endpoint-edits-with-one-undo",endpoint==10016&&base->_undoStarts==undo+2&&base->_undoEnds==undo+2&&![DYReadTools(host,kCMTimeZero).document[@"levelReference"]isEqual:savedLevel[@"levelReference"]]);
|
|
control(20034);drain();
|
|
run.record(@"level-measure-toggle-preserves-line-and-angle",[DYReadTools(host,kCMTimeZero).document[@"levelMeasureOnly"]boolValue]&&[DYReadTools(host,kCMTimeZero).document[@"levelReference"][@"points"]count]==4);
|
|
control(20026);control(20026);drain();
|
|
run.record(@"level-reopening-restores-saved-line",[[(id)osc valueForKey:@"levelPlaced"]boolValue]);
|
|
undo=base->_undoStarts-1;
|
|
control(20033);drain();
|
|
control(20032);
|
|
NSInteger part=down(200,270);up(230,150,part);drain();
|
|
run.record(@"level-osc-reset-and-vertical-drag-each-create-one-undo",fabs(angle()-(M_PI_2-atan2(120.,30.)))<1e-6&&base->_undoStarts==undo+3&&base->_undoEnds==undo+3);
|
|
double previous=angle();
|
|
click(180,200);
|
|
BOOL handled=NO;
|
|
[osc keyDownAtPositionX:250 positionY:225 keyPressed:27 modifiers:0 forceUpdate:&update didHandle:&handled atTime:kCMTimeZero];drain();
|
|
run.record(@"level-osc-escape-discards-uncommitted-point",handled&&angle()==previous&&base->_undoStarts==undo+3);
|
|
[osc release];[plugin release];drain();
|
|
}
|
|
|
|
{
|
|
for(NSString *starter in [DYToolTypes()arrayByAddingObject:@"cst"]){
|
|
DYDiagnosticManager *host=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(host,nil);
|
|
NSDictionary *doc=DYInitialToolDocument(starter);BOOL valid=DYValidToolDocument(doc)&&DYWriteTools(host,doc,kCMTimeZero);
|
|
DYInspector *inspector=[[[DYInspector alloc]initWithAPIManager:host]autorelease];[inspector refresh];
|
|
NSString *expected=[starter isEqual:@"cst"]?@"primary":starter;
|
|
NSUInteger visible=0;BOOL match=NO,cstFields=YES;
|
|
for(NSDictionary *card in [inspector valueForKey:@"cards"])if(![card[@"removed"]boolValue]){visible++;match=[card[@"section"][@"key"]isEqual:expected];if([starter isEqual:@"cst"]){cstFields=[card[@"section"][@"title"]isEqual:@"CST 色彩空间转换"];for(NSDictionary *row in card[@"section"][@"rows"])cstFields&=![row[@"key"]isEqual:@"cmexposure"]&&![row[@"key"]isEqual:@"primaryBalance"];}}
|
|
NSMutableDictionary *expanded=DYMutablePlist(doc);BOOL add=DYInsertTool(expanded,@"curve",[@"base:" stringByAppendingString:expected])!=nil;
|
|
run.record([@"standalone-initial-module-and-add-layer-" stringByAppendingString:starter],valid&&visible==1&&match&&cstFields&&add&&DYValidToolDocument(expanded));
|
|
}
|
|
}
|