Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
b669e9f6
Commit
b669e9f6
authored
Oct 31, 2018
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12994 from vpisarev:fix_imshow_mac
parents
850053f9
ebdc8702
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
window_cocoa.mm
modules/highgui/src/window_cocoa.mm
+7
-5
No files found.
modules/highgui/src/window_cocoa.mm
View file @
b669e9f6
...
...
@@ -230,7 +230,7 @@ CV_IMPL void cvShowImage( const char* name, const CvArr* arr)
if (oldImageSize.height != imageSize.height || oldImageSize.width != imageSize.width)
{
//Set new view size considering sliders (reserve height and min width)
NSSize scaledImageSize;
NSSize scaledImageSize
= imageSize
;
if ([[window contentView] respondsToSelector:@selector(convertSizeFromBacking:)])
{
// Only resize for retina displays if the image is bigger than the screen
...
...
@@ -239,13 +239,14 @@ CV_IMPL void cvShowImage( const char* name, const CvArr* arr)
screenSize.height -= titleBarHeight;
if (imageSize.width > screenSize.width || imageSize.height > screenSize.height)
{
CGFloat fx = screenSize.width/std::max(imageSize.width, (CGFloat)1.f);
CGFloat fy = screenSize.height/std::max(imageSize.height, (CGFloat)1.f);
CGFloat min_f = std::min(fx, fy);
scaledImageSize = [[window contentView] convertSizeFromBacking:imageSize];
scaledImageSize.width = std::min(scaledImageSize.width, min_f*imageSize.width);
scaledImageSize.height = std::min(scaledImageSize.height, min_f*imageSize.height);
}
}
else
{
scaledImageSize = imageSize;
}
NSSize contentSize = vrectOld.size;
contentSize.height = scaledImageSize.height + [window contentView].sliderHeight;
contentSize.width = std::max<int>(scaledImageSize.width, MIN_SLIDER_WIDTH);
...
...
@@ -735,6 +736,7 @@ void cv::setWindowTitle(const String& winname, const String& title)
static NSSize constrainAspectRatio(NSSize base, NSSize constraint) {
CGFloat heightDiff = (base.height / constraint.height);
CGFloat widthDiff = (base.width / constraint.width);
if (heightDiff == 0) heightDiff = widthDiff;
if (widthDiff == heightDiff) {
return base;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment