Keep the attached inspector header visible and refresh its curve histogram from output

这个提交包含在:
mac 于 2026-11-05 18:00:53 +08:00 提交
1 父节点 54ca7150f8
当前提交 43320c7ccd
9 个文件已更改
+73 -26

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

+19 -1
查看文件
@@ -16,6 +16,17 @@
}
- (NSData *)scopePreview{@synchronized(_previewLock){return [[_scopePreview retain]autorelease];}}
- (NSDictionary *)scopeMetadata{@synchronized(_previewLock){return [[_scopeMetadata retain]autorelease];}}
- (NSData*)outputHistogram{
DYScopeSample *sample=nil;
@synchronized(_previewLock){_outputHistogramObserved=YES;sample=[[_scopeLatest retain]autorelease];}
return sample.canvasHistogram;
}
- (void)queueOutputHistogramNotification{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW,NSEC_PER_SEC/30),dispatch_get_main_queue(),^{
@synchronized(_previewLock){_outputHistogramNotificationPending=NO;}
[NSNotificationCenter.defaultCenter postNotificationName:@"DYOutputHistogramDidChange" object:self];
});
}
- (NSData *)canvasHistogramAtTime:(CMTime)time{
if(!CMTIME_IS_NUMERIC(time))return nil;
DYScopeSample *sample=nil;
@@ -47,7 +58,14 @@
FxRect bounds=tile.tilePixelBounds,image=tile.imagePixelBounds;BOOL whole=bounds.left==image.left&&bounds.right==image.right&&bounds.top==image.top&&bounds.bottom==image.bottom;
sample.metadata=@{@"time":@(CMTimeGetSeconds(time)),@"timeValue":@(time.value),@"timeScale":@(time.timescale),@"timeEpoch":@(time.epoch),@"source":context[@"destination"]?:@"宿主 RGB",@"wholeImage":@(whole),@"region":whole?@"整帧取样":@"仅当前宿主输出分块",@"width":@(dyscope::Width),@"height":@(dyscope::Height)};
[buffer release];[entry release];[context release];
BOOL start=NO;@synchronized(_previewLock){if(serial>=_scopeLatestSerial){[_scopeLatest release];_scopeLatest=[sample retain];_scopeLatestSerial=serial;}if(_scopeEnabled&&serial==_scopeLatestSerial&&(generation==_scopeGeneration||!CMTIME_IS_NUMERIC(_scopeRequestedTime)||CMTimeCompare(time,_scopeRequestedTime)==0)){sample.generation=_scopeGeneration;[_scopePending release];_scopePending=[sample retain];if(!_scopeWorkerRunning){_scopeWorkerRunning=YES;start=YES;}}}[sample release];
BOOL start=NO,notifyHistogram=NO;@synchronized(_previewLock){
if(serial>=_scopeLatestSerial){
[_scopeLatest release];_scopeLatest=[sample retain];_scopeLatestSerial=serial;
if(_outputHistogramObserved&&!_outputHistogramNotificationPending){_outputHistogramNotificationPending=YES;notifyHistogram=YES;}
}
if(_scopeEnabled&&serial==_scopeLatestSerial&&(generation==_scopeGeneration||!CMTIME_IS_NUMERIC(_scopeRequestedTime)||CMTimeCompare(time,_scopeRequestedTime)==0)){sample.generation=_scopeGeneration;[_scopePending release];_scopePending=[sample retain];if(!_scopeWorkerRunning){_scopeWorkerRunning=YES;start=YES;}}
}[sample release];
if(notifyHistogram)[self queueOutputHistogramNotification];
if(start)dispatch_async(_scopeQueue,^{[self processPendingScopeSamples];});
}@catch(NSException *exception){/* Scope diagnostics must never fail rendering. */}}
}