public virtual void SetBoundsSize(NSSize newSize)
{
NSSize scale;
//NSDebugLLog(@"NSView", @"%@ setBoundsSize: %@", self, NSStringFromSize(newSize));
if (newSize.Width < 0)
{
//NSWarnMLog(@"given negative width", 0);
newSize.Width = 0;
}
if (newSize.Height < 0)
{
//NSWarnMLog(@"given negative height", 0);
newSize.Height = 0;
}
scale = _computeScale(_frame.Size, newSize);
if (scale.Width != 1 || scale.Height != 1)
{
_is_rotated_or_scaled_from_base = true;
}
if (_boundsMatrix == null)
{
_boundsMatrix = (NSAffineTransform)NSAffineTransform.Alloc().Init();
}
_boundsMatrix.ScaleTo(scale.Width, scale.Height);
if (!_is_rotated_from_base)
{
scale = _computeScale(_bounds.Size, newSize);
_bounds.Origin = NS.MakePoint(_bounds.Origin.X / scale.Width, _bounds.Origin.Y / scale.Height);
//_bounds.Origin.X = _bounds.Origin.X / scale.Width;
//_bounds.Origin.Y = _bounds.Origin.Y / scale.Height;
_bounds.Size = newSize;
}
else
{
NSAffineTransform matrix;
NSRect frame = _frame;
frame.Origin = NS.MakePoint(0, 0);
matrix = (NSAffineTransform)_boundsMatrix.Copy();
matrix.Invert();
matrix.BoundingRectFor(frame, ref _bounds);
//RELEASE(matrix);
}
if (_coordinates_valid)
{
//FIXME
//(*invalidateImp)(self, invalidateSel);
}
this.ResetCursorRects();
if (_post_bounds_changes)
{
//[nc postNotificationName: NSViewBoundsDidChangeNotification object: self];
}
}