mirror of
https://github.com/TomHarte/CLK.git
synced 2024-10-19 14:25:35 +00:00
Respects machine aspect ratio.
To an extent. Doesn't currently deal with cropping of machines when the window aspect ratio is smaller.
This commit is contained in:
parent
230b9fc9e6
commit
7ac88536dd
@ -103,7 +103,7 @@ using BufferingScanTarget = Outputs::Display::BufferingScanTarget;
|
|||||||
@param size New drawable size in pixels
|
@param size New drawable size in pixels
|
||||||
*/
|
*/
|
||||||
- (void)mtkView:(nonnull MTKView *)view drawableSizeWillChange:(CGSize)size {
|
- (void)mtkView:(nonnull MTKView *)view drawableSizeWillChange:(CGSize)size {
|
||||||
uniforms()->aspectRatioMultiplier = float((4.0 / 3.0) / (size.width / size.height));
|
uniforms()->aspectRatioMultiplier = float(_scanTarget.modals().aspect_ratio / (size.width / size.height));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setModals:(const Outputs::Display::ScanTarget::Modals &)modals view:(nonnull MTKView *)view {
|
- (void)setModals:(const Outputs::Display::ScanTarget::Modals &)modals view:(nonnull MTKView *)view {
|
||||||
@ -113,6 +113,7 @@ using BufferingScanTarget = Outputs::Display::BufferingScanTarget;
|
|||||||
uniforms()->scale[0] = modals.output_scale.x;
|
uniforms()->scale[0] = modals.output_scale.x;
|
||||||
uniforms()->scale[1] = modals.output_scale.y;
|
uniforms()->scale[1] = modals.output_scale.y;
|
||||||
uniforms()->lineWidth = 0.75f / modals.expected_vertical_lines; // TODO: return to 1.0 (or slightly more), once happy.
|
uniforms()->lineWidth = 0.75f / modals.expected_vertical_lines; // TODO: return to 1.0 (or slightly more), once happy.
|
||||||
|
uniforms()->aspectRatioMultiplier = float(modals.aspect_ratio / (view.bounds.size.width / view.bounds.size.height));
|
||||||
|
|
||||||
const auto toRGB = to_rgb_matrix(modals.composite_colour_space);
|
const auto toRGB = to_rgb_matrix(modals.composite_colour_space);
|
||||||
uniforms()->toRGB = simd::float3x3(
|
uniforms()->toRGB = simd::float3x3(
|
||||||
@ -156,6 +157,9 @@ using BufferingScanTarget = Outputs::Display::BufferingScanTarget;
|
|||||||
height:BufferingScanTarget::WriteAreaHeight
|
height:BufferingScanTarget::WriteAreaHeight
|
||||||
mipmapped:NO];
|
mipmapped:NO];
|
||||||
textureDescriptor.resourceOptions = SharedResourceOptionsTexture;
|
textureDescriptor.resourceOptions = SharedResourceOptionsTexture;
|
||||||
|
if(@available(macOS 10.14, *)) {
|
||||||
|
textureDescriptor.allowGPUOptimizedContents = NO;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: the call below is the only reason why this project now requires macOS 10.13; is it all that helpful versus just uploading each frame?
|
// TODO: the call below is the only reason why this project now requires macOS 10.13; is it all that helpful versus just uploading each frame?
|
||||||
const NSUInteger bytesPerRow = BufferingScanTarget::WriteAreaWidth * _bytesPerInputPixel;
|
const NSUInteger bytesPerRow = BufferingScanTarget::WriteAreaWidth * _bytesPerInputPixel;
|
||||||
|
Loading…
Reference in New Issue
Block a user