2013-09-03 19:18:28 +00:00
|
|
|
/*
|
|
|
|
* This file is part of mpv.
|
|
|
|
*
|
2017-06-24 14:50:52 +00:00
|
|
|
* mpv is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2013-09-03 19:18:28 +00:00
|
|
|
*
|
|
|
|
* mpv is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2017-06-24 14:50:52 +00:00
|
|
|
* GNU Lesser General Public License for more details.
|
2013-09-03 19:18:28 +00:00
|
|
|
*
|
2017-06-24 14:50:52 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
|
2013-09-03 19:18:28 +00:00
|
|
|
*/
|
|
|
|
|
2014-10-05 20:31:33 +00:00
|
|
|
#include "osdep/macosx_compat.h"
|
|
|
|
#include "video/out/cocoa_common.h"
|
|
|
|
#include "video_view.h"
|
2013-09-03 19:18:28 +00:00
|
|
|
|
2014-10-05 20:31:33 +00:00
|
|
|
@implementation MpvVideoView
|
|
|
|
@synthesize adapter = _adapter;
|
|
|
|
|
2016-12-15 22:06:04 +00:00
|
|
|
- (id)initWithFrame:(NSRect)frame
|
|
|
|
{
|
2014-10-05 20:31:33 +00:00
|
|
|
self = [super initWithFrame:frame];
|
|
|
|
if (self) {
|
|
|
|
[self setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setFrameSize:(NSSize)size
|
|
|
|
{
|
|
|
|
[super setFrameSize:size];
|
|
|
|
[self.adapter setNeedsResize];
|
2013-09-03 19:18:28 +00:00
|
|
|
}
|
2014-10-08 17:23:47 +00:00
|
|
|
|
|
|
|
- (NSRect)frameInPixels
|
|
|
|
{
|
|
|
|
return [self convertRectToBacking:[self frame]];
|
|
|
|
}
|
2014-10-18 16:30:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
- (void)drawRect:(NSRect)rect
|
|
|
|
{
|
2017-03-07 02:16:29 +00:00
|
|
|
[[NSColor blackColor] setFill];
|
|
|
|
NSRectFill(rect);
|
2014-10-18 16:30:22 +00:00
|
|
|
[self.adapter performAsyncResize:[self frameInPixels].size];
|
|
|
|
}
|
2013-09-03 19:18:28 +00:00
|
|
|
@end
|