mirror of
https://github.com/zakk4223/CocoaSplit.git
synced 2026-05-21 06:46:14 -06:00
Changed how resizing is calculated since relying on deltas somehow broke under 10.12.X (!?!).
This commit is contained in:
parent
03f4001287
commit
90607d183b
4 changed files with 29 additions and 23 deletions
Binary file not shown.
|
|
@ -232,7 +232,7 @@
|
|||
|
||||
|
||||
CMTime pts = frameData.videoPTS;
|
||||
|
||||
NSLog(@"FRAME PTS %@", CMTimeCopyDescription(NULL, pts));
|
||||
|
||||
size_t src_height;
|
||||
size_t src_width;
|
||||
|
|
@ -251,7 +251,8 @@
|
|||
}
|
||||
|
||||
int64_t usePts = av_rescale_q(pts.value, (AVRational){1,1000}, _av_codec_ctx->time_base);
|
||||
|
||||
NSLog(@"USE PTS %lld", usePts);
|
||||
|
||||
if (_last_pts > 0 && usePts <= _last_pts)
|
||||
{
|
||||
//We got the frame too fast, or something else weird happened. Just send the audio along
|
||||
|
|
@ -265,6 +266,7 @@
|
|||
[dest writeEncodedData:frameData];
|
||||
|
||||
}
|
||||
NSLog(@"DID NOT ENCODE");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -437,7 +439,7 @@
|
|||
_av_codec_ctx->width = self.working_width;
|
||||
_av_codec_ctx->height = self.working_height;
|
||||
_av_codec_ctx->time_base.num = 1;
|
||||
_av_codec_ctx->time_base.den = 1000;
|
||||
_av_codec_ctx->time_base.den = captureFPS;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1858,6 +1858,8 @@ static NSArray *_sourceTypes = nil;
|
|||
|
||||
self.layer.bounds = iRect;
|
||||
}
|
||||
|
||||
|
||||
-(void) updateSize:(CGFloat)width height:(CGFloat)height
|
||||
{
|
||||
|
||||
|
|
@ -1871,6 +1873,7 @@ static NSArray *_sourceTypes = nil;
|
|||
|
||||
bool oldResize = self.layer.allowResize;
|
||||
bool tmpResize = oldResize;
|
||||
|
||||
if (self.layer)
|
||||
{
|
||||
if (self.resizeType & kResizeFree)
|
||||
|
|
@ -1892,6 +1895,9 @@ static NSArray *_sourceTypes = nil;
|
|||
} else {
|
||||
if (self.resizeType & kResizeLeft)
|
||||
{
|
||||
//Where does the origin need to be to keep the right side in the same place?
|
||||
CGFloat oldRight = NSMaxX(oldLayout);
|
||||
|
||||
newLayout.origin.x -= delta_w;
|
||||
}
|
||||
|
||||
|
|
@ -1905,6 +1911,7 @@ static NSArray *_sourceTypes = nil;
|
|||
newLayout.size.width = width;
|
||||
newLayout.size.height = height;
|
||||
|
||||
|
||||
self.layer.allowResize = tmpResize;
|
||||
NSRect iRect = NSIntegralRect(newLayout);
|
||||
NSRect cFrame = oldLayout;
|
||||
|
|
|
|||
|
|
@ -727,11 +727,15 @@
|
|||
_inDrag = YES;
|
||||
tmp = [self convertPoint:theEvent.locationInWindow fromView:nil];
|
||||
|
||||
//NSLog(@"DELTA X %f Y %f", theEvent.deltaX, theEvent.deltaY);
|
||||
|
||||
worldPoint = [self realPointforWindowPoint:tmp];
|
||||
|
||||
|
||||
NSRect worldRect = NSIntegralRect(NSMakeRect(worldPoint.x, worldPoint.y , self.selectedSource.globalLayoutPosition.size.width, self.selectedSource.globalLayoutPosition.size.height));
|
||||
|
||||
worldPoint = worldRect.origin;
|
||||
|
||||
|
||||
|
||||
CGFloat dx, dy;
|
||||
dx = (worldPoint.x - self.selectedOriginDistance.x);
|
||||
|
|
@ -740,19 +744,9 @@
|
|||
|
||||
[self adjustDeltas:&dx dy:&dy];
|
||||
|
||||
|
||||
self.selectedOriginDistance = worldPoint;
|
||||
|
||||
if (theEvent.deltaX == 0)
|
||||
{
|
||||
dx = 0;
|
||||
}
|
||||
|
||||
if (theEvent.deltaY == 0)
|
||||
{
|
||||
dy = 0;
|
||||
}
|
||||
|
||||
//NSLog(@"DX %f DY %f", dx, dy);
|
||||
|
||||
if (self.isResizing)
|
||||
{
|
||||
|
|
@ -801,26 +795,29 @@
|
|||
new_width = sPosition.size.width;
|
||||
new_height = sPosition.size.height;
|
||||
|
||||
if (self.resizeType & kResizeRight)
|
||||
if (self.resizeType & kResizeRight && dx)
|
||||
{
|
||||
new_width += dx;
|
||||
new_width = worldPoint.x - sPosition.origin.x;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (self.resizeType & kResizeLeft)
|
||||
if (self.resizeType & kResizeLeft && dx)
|
||||
{
|
||||
new_width -= dx;
|
||||
new_width = (sPosition.origin.x+sPosition.size.width) - worldPoint.x;
|
||||
}
|
||||
|
||||
|
||||
if (self.resizeType & kResizeTop)
|
||||
if (self.resizeType & kResizeTop && dy)
|
||||
{
|
||||
new_height += dy;
|
||||
|
||||
new_height = worldPoint.y - sPosition.origin.y;
|
||||
}
|
||||
|
||||
if (self.resizeType & kResizeBottom)
|
||||
if (self.resizeType & kResizeBottom && dy)
|
||||
{
|
||||
new_height -= dy;
|
||||
|
||||
new_height = NSMaxY(sPosition) - worldPoint.y;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue