fix: clip remote workspace backgrounds so page controls remain visible; build72

这个提交包含在:
mac 于 2026-11-04 22:10:25 +08:00 提交
1 父节点 5cf4ba75b3
当前提交 b216cebc70
8 个文件已更改
+253 -39

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

+3 -2
查看文件
@@ -20,9 +20,10 @@
@property(nonatomic,assign) DYColorWorkspace *owner;
@end
@implementation DYWorkspaceRoot
- (instancetype)initWithFrame:(NSRect)frame{if((self=[super initWithFrame:frame]))self.clipsToBounds=YES;return self;}
- (BOOL)isFlipped{return YES;}
- (BOOL)isOpaque{return YES;}
- (void)drawRect:(NSRect)dirty{[DYThemeColor(@"background")setFill];NSRectFill(dirty);}
- (void)drawRect:(NSRect)dirty{[DYThemeColor(@"background")setFill];NSRectFill(NSIntersectionRect(dirty,self.bounds));}
- (void)resizeSubviewsWithOldSize:(NSSize)old{[super resizeSubviewsWithOldSize:old];[_owner layoutWorkspace];}
@end
@interface DYScopePlot:NSView
@@ -87,7 +88,7 @@
_heading=[[DYThemeLabel alloc]init];_heading.stringValue=[NSString stringWithFormat:@"%@ · 辅助工作区",_title];_heading.font=[NSFont systemFontOfSize:14 weight:NSFontWeightSemibold];[_root addSubview:_heading];
_pages=[[NSSegmentedControl alloc]init];_pages.segmentCount=2;[_pages setLabel:@"示波器" forSegment:0];[_pages setLabel:@"风格1 LUT" forSegment:1];_pages.selectedSegment=0;_pages.target=self;_pages.action=@selector(pageChanged:);_pages.accessibilityLabel=@"辅助工作区页面";[_root addSubview:_pages];
_close=[[DYThemeButton alloc]init];_close.title=@"关闭";_close.target=self;_close.action=@selector(closePressed:);_close.bezelStyle=NSBezelStyleRounded;[_root addSubview:_close];
_scopePane=[[DYWorkspaceRoot alloc]init];[_root addSubview:_scopePane];_lutPane=[[NSView alloc]init];[_root addSubview:_lutPane];_lutPane.hidden=YES;
_scopePane=[[DYWorkspaceRoot alloc]init];_scopePane.clipsToBounds=YES;[_root addSubview:_scopePane];_lutPane=[[NSView alloc]init];[_root addSubview:_lutPane];_lutPane.hidden=YES;
_scopeMode=[[DYThemePopUpButton alloc]init];[_scopeMode addItemsWithTitles:@[@"亮度波形",@"RGB 分列",@"直方图"]];_scopeMode.target=self;_scopeMode.action=@selector(scopeModeChanged:);_scopeMode.accessibilityLabel=@"示波器类型";[_scopePane addSubview:_scopeMode];
_hostScopes=[[DYThemeButton alloc]init];_hostScopes.title=@"FCP 示波器";_hostScopes.bezelStyle=NSBezelStyleRounded;_hostScopes.target=self;_hostScopes.action=@selector(toggleHostScopes:);_hostScopes.toolTip=@"打开或关闭 Final Cut Pro 自带的视频示波器;下方是大鱼的显示参考示波器";[_scopePane addSubview:_hostScopes];
_description=[[DYThemeLabel alloc]init];_description.font=[NSFont systemFontOfSize:11];[_scopePane addSubview:_description];
@@ -29,3 +29,25 @@
- (NSProgress *)prepareLUTPath:(NSString *)path completion:(void(^)(NSError*))completion{[_preparedTask release];_preparedTask=[[NSProgress discreteProgressWithTotalUnitCount:1]retain];[_preparedReply release];_preparedReply=[completion copy];return _preparedTask;}
- (void)completePreparation{void(^reply)(NSError*)=[_preparedReply copy];[_preparedReply release];_preparedReply=nil;if(reply)reply(nil);[reply release];}
@end
// Cache only the top content strip. A background-painted sibling must never
// erase the heading/page selector/close button in that strip.
static NSBitmapImageRep *DYWorkspaceHeaderBitmap(NSView *root){
NSRect top=NSMakeRect(0,0,root.bounds.size.width,52);NSBitmapImageRep *bitmap=[root bitmapImageRepForCachingDisplayInRect:top];if(bitmap)[root cacheDisplayInRect:top toBitmapImageRep:bitmap];return bitmap;
}
static NSUInteger DYWorkspaceHeaderInk(NSBitmapImageRep *bitmap,NSView *root,NSView *control){
if(!bitmap||!bitmap.pixelsWide||!bitmap.pixelsHigh)return 0;NSColor *base=[[bitmap colorAtX:0 y:0]colorUsingColorSpace:NSColorSpace.deviceRGBColorSpace];if(!base)return 0;
CGFloat scale=bitmap.pixelsWide/root.bounds.size.width;NSInteger left=MAX(0,NSInteger(floor(NSMinX(control.frame)*scale))),right=MIN(bitmap.pixelsWide,NSInteger(ceil(NSMaxX(control.frame)*scale)));NSUInteger count=0;
for(NSInteger y=0;y<bitmap.pixelsHigh;y++)for(NSInteger x=left;x<right;x++){NSColor *pixel=[[bitmap colorAtX:x y:y]colorUsingColorSpace:NSColorSpace.deviceRGBColorSpace];if(pixel&&(fabs(pixel.redComponent-base.redComponent)+fabs(pixel.greenComponent-base.greenComponent)+fabs(pixel.blueComponent-base.blueComponent)>.12))count++;}
return count;
}
static BOOL DYWorkspaceLargeDirtyPreservesHeader(NSBitmapImageRep *bitmap,NSView *root,NSView *pane){
if(!bitmap)return NO;NSData *before=[NSData dataWithBytes:bitmap.bitmapData length:bitmap.bytesPerRow*bitmap.pixelsHigh];
[NSGraphicsContext saveGraphicsState];NSGraphicsContext *context=[NSGraphicsContext graphicsContextWithBitmapImageRep:bitmap];[NSGraphicsContext setCurrentContext:context];CGContextRef cg=context.CGContext;
// Map the pane's flipped local coordinates into the cached top-strip pixels.
// Intentionally bypass AppKit's clipping here: the draw implementation must
// itself stay within its bounds even for a deliberately oversized dirty rect.
CGContextTranslateCTM(cg,0,bitmap.pixelsHigh);CGContextScaleCTM(cg,bitmap.pixelsWide/root.bounds.size.width,-bitmap.pixelsHigh/52.0);CGContextTranslateCTM(cg,pane.frame.origin.x,pane.frame.origin.y);
[pane drawRect:NSInsetRect(pane.bounds,-200,-200)];[NSGraphicsContext restoreGraphicsState];
NSData *after=[NSData dataWithBytes:bitmap.bitmapData length:bitmap.bytesPerRow*bitmap.pixelsHigh];return [before isEqual:after];
}
@@ -8,7 +8,16 @@
DYColorWorkspace *workspace=[[[DYColorWorkspace alloc]initWithManager:host renderer:scopeRenderer library:scopeLibrary title:@"原片段"]autorelease];
[workspace showRelativeToView:nil];workspaceDrain();NSView *root=[workspace valueForKey:@"root"];
run.record(@"workspace-remote-attaches-within-host-permissions",workspace.visible&&host->_requests==1&&!host->_permissionFailure&&root.superview==host->_parent&&!fixture.visible);
NSView *scopePane=[workspace valueForKey:@"scopePane"],*heading=[workspace valueForKey:@"heading"],*pages=[workspace valueForKey:@"pages"],*closeButton=[workspace valueForKey:@"close"];
NSBitmapImageRep *headerBitmap=DYWorkspaceHeaderBitmap(root);NSUInteger headingInk=DYWorkspaceHeaderInk(headerBitmap,root,heading),pagesInk=DYWorkspaceHeaderInk(headerBitmap,root,pages),closeInk=DYWorkspaceHeaderInk(headerBitmap,root,closeButton);
NSString *headerPNG=[runtime stringByAppendingPathComponent:@"workspace-topbar.png"];BOOL headerSaved=[[headerBitmap representationUsingType:NSBitmapImageFileTypePNG properties:@{}]writeToFile:headerPNG atomically:YES];
run.record(@"workspace-offscreen-topbar-heading-pages-close-render-pixels",headerSaved&&headingInk>20&&pagesInk>50&&closeInk>20,@{@"headingPixels":@(headingInk),@"pagesPixels":@(pagesInk),@"closePixels":@(closeInk),@"path":headerPNG});
run.record(@"workspace-content-and-scope-pane-explicitly-clip",root.clipsToBounds&&scopePane.clipsToBounds);
run.record(@"workspace-oversized-scope-dirty-cannot-erase-topbar",DYWorkspaceLargeDirtyPreservesHeader(headerBitmap,root,scopePane));
[host->_parent setFrameSize:NSMakeSize(800,540)];run.record(@"workspace-follows-remote-container-resize",NSEqualRects(root.frame,host->_parent.bounds));
headerBitmap=DYWorkspaceHeaderBitmap(root);headingInk=DYWorkspaceHeaderInk(headerBitmap,root,heading);pagesInk=DYWorkspaceHeaderInk(headerBitmap,root,pages);closeInk=DYWorkspaceHeaderInk(headerBitmap,root,closeButton);
run.record(@"workspace-topbar-survives-resize-and-large-dirty-redraw",headingInk>20&&pagesInk>50&&closeInk>20&&DYWorkspaceLargeDirtyPreservesHeader(headerBitmap,root,scopePane),@{@"headingPixels":@(headingInk),@"pagesPixels":@(pagesInk),@"closePixels":@(closeInk)});
[workspace showRelativeToView:nil];workspaceDrain();run.record(@"workspace-reopens-existing-host-remote-window",host->_requests==2&&workspace.visible&&root.superview==host->_parent);
[workspace close];[workspace close];run.record(@"workspace-closes-host-window-once-and-stops-scopes",host->_closes==1&&!workspace.visible&&![[scopeRenderer valueForKey:@"scopeEnabled"]boolValue]&&!host->_permissionFailure&&host->_actionDepth==0);
[workspace showRelativeToView:nil];workspaceDrain();[NSNotificationCenter.defaultCenter postNotificationName:NSWindowWillCloseNotification object:fixture];run.record(@"workspace-host-close-cleans-without-recursive-close",!workspace.visible&&host->_closes==1&&!root.superview);
+1 -1
查看文件
@@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.10.0</string>
<key>CFBundleVersion</key>
<string>71</string>
<string>72</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>PlugInKit</key>