disregard extraSize when initially setting the aspect ratio

This commit is contained in:
leethomas 2016-05-22 19:09:21 -07:00
parent 1d61f987cb
commit de27b34891

View file

@ -714,21 +714,8 @@ void NativeWindowMac::SetAspectRatio(double aspect_ratio,
// it as a float, and Cocoa expects an NSRect with explicit width & height // it as a float, and Cocoa expects an NSRect with explicit width & height
// arguments. Instead we derive those args ourselves from the given aspect // arguments. Instead we derive those args ourselves from the given aspect
// ratio. // ratio.
double width = roundf([window_ frame].size.height * aspect_ratio);
gfx::Size windowSize = this->GetSize(); double height = roundf(width / aspect_ratio);
gfx::Size contentSize = this->GetContentSize();
double extraWidthPlusFrame =
windowSize.width() - contentSize.width() + extra_size.width();
double extraHeightPlusFrame =
windowSize.height() - contentSize.height() + extra_size.height();
double width =
roundf(([window_ frame].size.height - extraHeightPlusFrame) *
aspect_ratio + extraWidthPlusFrame);
double height =
roundf((width - extraWidthPlusFrame) /
aspect_ratio + extraHeightPlusFrame);
[window_ setAspectRatio:NSMakeSize(width, height)]; [window_ setAspectRatio:NSMakeSize(width, height)];
} }