only use native NSImage dimension
This commit is contained in:
committed by
Vadim Zeitlin
parent
84f68aa764
commit
148732993a
@@ -37,6 +37,7 @@ WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromCGImage( CGImageRef image, double
|
||||
WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromIconRef( WXHICON iconref );
|
||||
WX_NSImage WXDLLIMPEXP_CORE wxOSXGetIconForType(OSType type );
|
||||
void WXDLLIMPEXP_CORE wxOSXSetImageSize(WX_NSImage image, CGFloat width, CGFloat height);
|
||||
CGSize WXDLLIMPEXP_CORE wxOSXGetImageSize(WX_NSImage image);
|
||||
CGImageRef WXDLLIMPEXP_CORE wxOSXCreateCGImageFromNSImage( WX_NSImage nsimage, double *scale = NULL );
|
||||
CGImageRef WXDLLIMPEXP_CORE wxOSXGetCGImageFromNSImage( WX_NSImage nsimage, CGRect* r, CGContextRef cg);
|
||||
CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromNSImage( WX_NSImage nsimage, bool *isTemplate = NULL);
|
||||
|
@@ -42,11 +42,8 @@ public:
|
||||
virtual bool IsOk() const wxOVERRIDE { return m_nsImage != NULL; }
|
||||
virtual void Free();
|
||||
|
||||
void SetWidth( int width ) { m_width = width; }
|
||||
void SetHeight( int height ) { m_height = height; }
|
||||
|
||||
int GetWidth() const { return m_width; }
|
||||
int GetHeight() const { return m_height; }
|
||||
int GetWidth() const { return (int) wxOSXGetImageSize(m_nsImage).width; }
|
||||
int GetHeight() const { return (int) wxOSXGetImageSize(m_nsImage).height; }
|
||||
|
||||
WX_NSImage GetNSImage() const;
|
||||
|
||||
@@ -55,9 +52,6 @@ private:
|
||||
void Create( NSImage* icon, int desiredWidth, int desiredHeight );
|
||||
NSImage* m_nsImage;
|
||||
|
||||
int m_width;
|
||||
int m_height;
|
||||
|
||||
// We can (easily) copy m_iconRef so we don't implement the copy ctor.
|
||||
wxDECLARE_NO_COPY_CLASS(wxIconRefData);
|
||||
};
|
||||
@@ -78,24 +72,18 @@ wxIconRefData::wxIconRefData( WXHICON iconref, int desiredWidth, int desiredHeig
|
||||
ReleaseIconRef(iconref);
|
||||
}
|
||||
|
||||
void wxIconRefData::Create( NSImage* icon, int desiredWidth, int desiredHeight )
|
||||
void wxIconRefData::Create( NSImage* icon, int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight) )
|
||||
{
|
||||
if ( icon )
|
||||
{
|
||||
m_nsImage = icon;
|
||||
wxMacCocoaRetain(icon);
|
||||
}
|
||||
|
||||
// Standard sizes
|
||||
SetWidth( desiredWidth == -1 ? 32 : desiredWidth ) ;
|
||||
SetHeight( desiredHeight == -1 ? 32 : desiredHeight ) ;
|
||||
}
|
||||
|
||||
void wxIconRefData::Init()
|
||||
{
|
||||
m_nsImage = NULL;
|
||||
m_width =
|
||||
m_height = 0;
|
||||
}
|
||||
|
||||
void wxIconRefData::Free()
|
||||
|
@@ -297,6 +297,11 @@ void wxOSXSetImageSize(WX_NSImage image, CGFloat width, CGFloat height)
|
||||
[image setSize:NSMakeSize(width, height)];
|
||||
}
|
||||
|
||||
CGSize wxOSXGetImageSize(WX_NSImage image)
|
||||
{
|
||||
return NSSizeToCGSize([image size]);
|
||||
}
|
||||
|
||||
CGImageRef wxOSXCreateCGImageFromNSImage( WX_NSImage nsimage, double *scaleptr )
|
||||
{
|
||||
// based on http://www.mail-archive.com/cocoa-dev@lists.apple.com/msg18065.html
|
||||
|
Reference in New Issue
Block a user