Add opt-in local remote geometry sampling for More Space reproduction (build 48)

这个提交包含在:
mac 于 2026-11-02 22:34:33 +08:00 提交
1 父节点 2360ec5c91
当前提交 3ba2c0b823
3 个文件已更改
+44 -6

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

+39 -1
查看文件
@@ -21,6 +21,41 @@ static NSString *const DYBrowserSidebarPreference=@"com.dayu.color.lookLUTPrevie
static NSString *const DYBrowserRecentFolder=@"@recent";
static NSString *DYBrowserPreference(NSString *key,DYLUTLibrary *library){return [NSString stringWithFormat:@"%@|%@",key,library.rootURL.path];}
// Opt-in, local-only geometry samples. No LUT names, paths or image data.
static void DYBrowserGeometrySample(NSView *root,NSString *phase){
if(![NSUserDefaults.standardUserDefaults boolForKey:@"DYBrowserGeometryDiagnostics"]||!root)return;
NSMutableArray *views=[NSMutableArray array];
for(NSView *view=root;view&&views.count<8;view=view.superview){
NSMutableDictionary *sample=[NSMutableDictionary dictionaryWithDictionary:@{
@"class":NSStringFromClass(view.class),@"frame":NSStringFromRect(view.frame),@"bounds":NSStringFromRect(view.bounds),
@"visibleRect":NSStringFromRect(view.visibleRect),@"windowRect":NSStringFromRect([view convertRect:view.bounds toView:nil]),
@"flipped":@(view.flipped),@"autoresizesSubviews":@(view.autoresizesSubviews),@"autoresizingMask":@(view.autoresizingMask),
@"frameRotation":@(view.frameRotation),@"boundsRotation":@(view.boundsRotation),@"wantsLayer":@(view.wantsLayer)}];
if(view.layer){CALayer *layer=view.layer;CATransform3D t=layer.transform;sample[@"layer"]=@{
@"frame":NSStringFromRect(NSRectFromCGRect(layer.frame)),@"bounds":NSStringFromRect(NSRectFromCGRect(layer.bounds)),
@"position":NSStringFromPoint(NSPointFromCGPoint(layer.position)),@"anchorPoint":NSStringFromPoint(NSPointFromCGPoint(layer.anchorPoint)),
@"contentsScale":@(layer.contentsScale),@"geometryFlipped":@(layer.geometryFlipped),
@"transform":@[@(t.m11),@(t.m12),@(t.m21),@(t.m22),@(t.m41),@(t.m42)]};}
[views addObject:sample];
}
NSMutableDictionary *record=[NSMutableDictionary dictionaryWithDictionary:@{@"phase":phase,@"time":@(NSDate.timeIntervalSinceReferenceDate),@"views":views}];
NSWindow *window=root.window;
if(window){record[@"window"]=@{@"class":NSStringFromClass(window.class),@"frame":NSStringFromRect(window.frame),
@"contentFrame":NSStringFromRect(window.contentView.frame),@"contentBounds":NSStringFromRect(window.contentView.bounds),
@"contentLayoutRect":NSStringFromRect(window.contentLayoutRect),@"backingScaleFactor":@(window.backingScaleFactor),
@"screenRect":NSStringFromRect([window convertRectToScreen:[root convertRect:root.bounds toView:nil]])};}
NSMutableArray *screens=[NSMutableArray array];
for(NSScreen *screen in NSScreen.screens)[screens addObject:@{@"frame":NSStringFromRect(screen.frame),@"visibleFrame":NSStringFromRect(screen.visibleFrame),@"backingScaleFactor":@(screen.backingScaleFactor)}];
record[@"screens"]=screens;
NSString *logs=[NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,NSUserDomainMask,YES).firstObject stringByAppendingPathComponent:@"Logs/大鱼调色"];
[NSFileManager.defaultManager createDirectoryAtPath:logs withIntermediateDirectories:YES attributes:nil error:nil];
NSString *path=[logs stringByAppendingPathComponent:[NSString stringWithFormat:@"BrowserGeometry-%d.jsonl",NSProcessInfo.processInfo.processIdentifier]];
NSData *json=[NSJSONSerialization dataWithJSONObject:record options:0 error:nil];if(!json)return;
if(![NSFileManager.defaultManager fileExistsAtPath:path])[NSFileManager.defaultManager createFileAtPath:path contents:nil attributes:nil];
NSFileHandle *file=[NSFileHandle fileHandleForWritingAtPath:path];
@try{if([file seekToEndOfFile]<1024*1024){[file writeData:json];[file writeData:[@"\n" dataUsingEncoding:NSUTF8StringEncoding]];}}@finally{[file closeFile];}
}
@interface DYBrowserCanvas : NSView
@property(copy) NSDictionary *palette;
@property(copy) NSString *fillKey;
@@ -230,8 +265,10 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b
parent.postsFrameChangedNotifications=YES;parent.postsBoundsChangedNotifications=YES;
for(NSNotificationName name in @[NSViewFrameDidChangeNotification,NSViewBoundsDidChangeNotification])[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(remoteParentGeometryChanged:) name:name object:parent];
[parent addSubview:_root];[self layoutBrowser];[_root setNeedsDisplay:YES];
DYBrowserGeometrySample(_root,@"attached-before-sdk-reply");
// Attach synchronously: the SDK reads the first child before reply returns.
dispatch_async(dispatch_get_main_queue(),^{if(!_closed)[self configurePresentationWindow];});
dispatch_async(dispatch_get_main_queue(),^{if(!_closed){[self configurePresentationWindow];DYBrowserGeometrySample(_root,@"after-sdk-reply");}});
if([NSUserDefaults.standardUserDefaults boolForKey:@"DYBrowserGeometryDiagnostics"])dispatch_after(dispatch_time(DISPATCH_TIME_NOW,NSEC_PER_SEC),dispatch_get_main_queue(),^{if(!_closed)DYBrowserGeometrySample(_root,@"settled");});
NSAccessibilityPostNotification(parent,NSAccessibilityLayoutChangedNotification);
}
- (void)fitRemoteParent{
@@ -241,6 +278,7 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b
}
- (void)remoteParentGeometryChanged:(NSNotification *)notification{
if(notification.object==_root.superview)[self fitRemoteParent];
DYBrowserGeometrySample(_root,notification.name);
}
- (void)configurePresentationWindow{
NSWindow *window=_root.window;if(!window||window==self.window)return;
+3 -3
查看文件
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.7.2</string>
<string>1.7.3</string>
<key>CFBundleVersion</key>
<string>47</string>
<string>48</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>PlugInKit</key>
@@ -71,7 +71,7 @@
<key>uuid</key>
<string>1C17B73B-F229-4C09-A434-EAF6DFF5F22A</string>
<key>version</key>
<string>1.7.2</string>
<string>1.7.3</string>
</dict>
<dict>
<key>className</key>
+2 -2
查看文件
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.7.2</string>
<string>1.7.3</string>
<key>CFBundleVersion</key>
<string>47</string>
<string>48</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>