Skip to content

Commit

Permalink
Use a correct scaling factor
Browse files Browse the repository at this point in the history
this amazing pointPixelScale discovery was brought to you by the equally amazing @saagarjha
  • Loading branch information
Mnpn committed Oct 10, 2023
1 parent 475d8a0 commit e435e5e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Azayaka.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 36;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 35BSP6SUG9;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -298,7 +298,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = "1.1.1-beta1";
MARKETING_VERSION = "1.1.1-beta2";
PRODUCT_BUNDLE_IDENTIFIER = dev.mnpn.Azayaka;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -315,7 +315,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 36;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 35BSP6SUG9;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -330,7 +330,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = "1.1.1-beta1";
MARKETING_VERSION = "1.1.1-beta2";
PRODUCT_BUNDLE_IDENTIFIER = dev.mnpn.Azayaka;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
6 changes: 2 additions & 4 deletions Azayaka/Recording.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ extension AppDelegate {
conf.height = 2

if !audioOnly {
let scale: Int = Int((screen != nil ? NSScreen.screens.first(where: { $0.displayID == screen?.displayID })!.backingScaleFactor : NSScreen.main?.backingScaleFactor) ?? 1)
// todo: find relevant scaling factor. it seems windows are available on all displays though, and there's no way to get a window's display, so this is tricky
conf.width = streamType == .screen ? availableContent!.displays[0].width*scale : Int((window?.frame.width)!*CGFloat(scale))
conf.height = streamType == .screen ? availableContent!.displays[0].height*scale : Int((window?.frame.height)!*CGFloat(scale))
conf.width = Int(filter.contentRect.width) * Int(filter.pointPixelScale)
conf.height = Int(filter.contentRect.height) * Int(filter.pointPixelScale)
}

conf.minimumFrameInterval = CMTime(value: 1, timescale: audioOnly ? CMTimeScale.max : CMTimeScale(ud.integer(forKey: "frameRate")))
Expand Down

0 comments on commit e435e5e

Please sign in to comment.