Imported Upstream version 5.2.0.175

Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-06-07 13:16:24 +00:00
parent 4bdbaf4a88
commit 966bba02bb
8776 changed files with 346420 additions and 149650 deletions

View File

@ -37,10 +37,10 @@
using System.IO;
using System.Drawing.Imaging;
using System.Reflection;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
using System.ComponentModel;
using System.Security.Permissions;
namespace System.Drawing
{
@ -133,7 +133,11 @@ namespace System.Drawing
if (resource == null)
throw new ArgumentException ("resource");
Stream s = type.Assembly.GetManifestResourceStream (type, resource);
// For compatibility with the .NET Framework
if (type == null)
throw new NullReferenceException();
Stream s = type.GetTypeInfo ().Assembly.GetManifestResourceStream (type, resource);
if (s == null) {
string msg = Locale.GetText ("Resource '{0}' was not found.", resource);
throw new FileNotFoundException (msg);
@ -228,14 +232,12 @@ namespace System.Drawing
}
[EditorBrowsable (EditorBrowsableState.Advanced)]
[SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
public IntPtr GetHbitmap ()
{
return GetHbitmap(Color.Gray);
}
[EditorBrowsable (EditorBrowsableState.Advanced)]
[SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
public IntPtr GetHbitmap (Color background)
{
IntPtr HandleBmp;
@ -247,7 +249,6 @@ namespace System.Drawing
}
[EditorBrowsable (EditorBrowsableState.Advanced)]
[SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
public IntPtr GetHicon ()
{
IntPtr HandleIcon;

View File

@ -30,7 +30,6 @@
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security.Permissions;
namespace System.Drawing
{
@ -106,7 +105,6 @@ namespace System.Drawing
}
[MonoTODO ("The targetDC parameter has no equivalent in libgdiplus.")]
[SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
public void Render (IntPtr targetDC)
{
throw new NotImplementedException ();

View File

@ -30,7 +30,6 @@
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security.Permissions;
namespace System.Drawing
{
@ -54,7 +53,6 @@ namespace System.Drawing
}
[MonoTODO ("The targetDC parameter has no equivalent in libgdiplus.")]
[SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
public BufferedGraphics Allocate (IntPtr targetDC, Rectangle targetRectangle)
{
throw new NotImplementedException ();

File diff suppressed because it is too large Load Diff

View File

@ -31,9 +31,9 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Reflection;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.ComponentModel;
namespace System.Drawing
@ -428,10 +428,7 @@ namespace System.Drawing
[Browsable(false)]
public bool IsSystemFont {
get {
if (systemFontName == null)
return false;
return StringComparer.InvariantCulture.Compare (systemFontName, string.Empty) != 0;
return !string.IsNullOrEmpty (systemFontName);
}
}
@ -591,7 +588,6 @@ namespace System.Drawing
}
}
[SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
public void ToLogFont (object logFont)
{
if (GDIPlus.RunningOnUnix ()) {
@ -616,7 +612,6 @@ namespace System.Drawing
}
}
[SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
public void ToLogFont (object logFont, Graphics graphics)
{
if (graphics == null)
@ -627,7 +622,7 @@ namespace System.Drawing
}
Type st = logFont.GetType ();
if (!st.IsLayoutSequential)
if (!st.GetTypeInfo ().IsLayoutSequential)
throw new ArgumentException ("logFont", Locale.GetText ("Layout must be sequential."));
// note: there is no exception if 'logFont' isn't big enough

View File

@ -35,7 +35,6 @@ using System.Drawing.Imaging;
using System.Drawing.Text;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Text;
namespace System.Drawing
@ -56,7 +55,7 @@ namespace System.Drawing
IntPtr data,
PlayRecordCallback callbackData);
public delegate bool DrawImageAbort (IntPtr callbackData);
public delegate bool DrawImageAbort (IntPtr callbackdata);
internal Graphics (IntPtr nativeGraphics)
{
@ -1692,7 +1691,6 @@ namespace System.Drawing
}
[EditorBrowsable (EditorBrowsableState.Advanced)]
[SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
public static Graphics FromHdcInternal (IntPtr hdc)
{
GDIPlus.Display = hdc;
@ -1744,7 +1742,6 @@ namespace System.Drawing
}
[EditorBrowsable (EditorBrowsableState.Advanced)]
[SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
public static Graphics FromHwndInternal (IntPtr hwnd)
{
return FromHwnd (hwnd);
@ -2015,13 +2012,11 @@ namespace System.Drawing
}
[EditorBrowsable (EditorBrowsableState.Advanced)]
[SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
public void ReleaseHdc (IntPtr hdc)
{
ReleaseHdcInternal (hdc);
}
[SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
public void ReleaseHdc ()
{
ReleaseHdcInternal (deviceContextHdc);
@ -2029,7 +2024,6 @@ namespace System.Drawing
[MonoLimitation ("Can only be used when hdc was provided by Graphics.GetHdc() method")]
[EditorBrowsable (EditorBrowsableState.Never)]
[SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
public void ReleaseHdcInternal (IntPtr hdc)
{
Status status = Status.InvalidParameter;

View File

@ -36,9 +36,9 @@ using System.Collections;
using System.ComponentModel;
using System.Drawing.Imaging;
using System.IO;
using System.Reflection;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
using System.Security.Permissions;
namespace System.Drawing
{
@ -230,7 +230,11 @@ namespace System.Drawing
if (resource == null)
throw new ArgumentException ("resource");
using (Stream s = type.Assembly.GetManifestResourceStream (type, resource)) {
// For compatibility with the .NET Framework
if (type == null)
throw new NullReferenceException();
using (Stream s = type.GetTypeInfo ().Assembly.GetManifestResourceStream (type, resource)) {
if (s == null) {
string msg = Locale.GetText ("Resource '{0}' was not found.", resource);
throw new FileNotFoundException (msg);
@ -262,7 +266,7 @@ namespace System.Drawing
internal Icon (string resourceName, bool undisposable)
{
using (Stream s = typeof (Icon).Assembly.GetManifestResourceStream (resourceName)) {
using (Stream s = typeof (Icon).GetTypeInfo ().Assembly.GetManifestResourceStream (resourceName)) {
if (s == null) {
string msg = Locale.GetText ("Resource '{0}' was not found.", resourceName);
throw new FileNotFoundException (msg);
@ -338,7 +342,6 @@ namespace System.Drawing
}
#if !MONOTOUCH
[SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
public static Icon FromHandle (IntPtr handle)
{
if (handle == IntPtr.Zero)
@ -861,10 +864,10 @@ Console.WriteLine ("\tbih.biClrImportant: {0}", bih.biClrImportant);
}
imageData [j] = iidata;
bihReader.Close();
bihReader.Dispose ();
}
reader.Close();
reader.Dispose ();
}
}
}

View File

@ -32,7 +32,6 @@
//
using System;
using System.Runtime.Remoting;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
using System.ComponentModel;
@ -795,7 +794,7 @@ public abstract class Image : MarshalByRefObject, IDisposable , ICloneable, ISer
Status status = GDIPlus.GdipDisposeImage (nativeObject);
// dispose the stream (set under Win32 only if SD owns the stream) and ...
if (stream != null) {
stream.Close ();
stream.Dispose ();
stream = null;
}
// ... set nativeObject to null before (possibly) throwing an exception

View File

@ -269,21 +269,7 @@ namespace System.Drawing {
public static Color FromKnownColor (KnownColor kc)
{
Color c;
short n = (short)kc;
if ((n <= 0) || (n >= ArgbValues.Length)) {
// This is what it returns!
c = Color.FromArgb (0, 0, 0, 0);
c.state |= (short) Color.ColorType.Named;
} else {
c = new Color ();
c.state = (short) (Color.ColorType.ARGB | Color.ColorType.Known | Color.ColorType.Named);
if ((n < 27) || (n > 169))
c.state |= (short) Color.ColorType.System;
c.Value = ArgbValues [n];
}
c.knownColor = n;
return c;
return Color.FromKnownColor (kc);
}
public static string GetName (short kc)

View File

@ -30,7 +30,6 @@
using System.Drawing.Drawing2D;
using System.Runtime.InteropServices;
using System.Security.Permissions;
namespace System.Drawing
{
@ -510,7 +509,6 @@ namespace System.Drawing
return result;
}
[SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
public static Region FromHrgn (IntPtr hrgn)
{
if (hrgn == IntPtr.Zero)
@ -639,7 +637,6 @@ namespace System.Drawing
}
}
// why is this a instance method ? and not static ?
[SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
public void ReleaseHrgn (IntPtr regionHandle)
{
if (regionHandle == IntPtr.Zero)

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
5147116609f3fe81556720b34429d83ad6c459e1

View File

@ -34,7 +34,6 @@ using System.Security;
namespace System.Drawing {
[SuppressUnmanagedCodeSecurity]
internal static class MacSupport {
internal static Hashtable contextReference = new Hashtable ();
internal static object lockobj = new object ();