diff options
author | Neil Hodgson <nyamatongwe@gmail.com> | 2019-06-16 09:21:30 +1000 |
---|---|---|
committer | Neil Hodgson <nyamatongwe@gmail.com> | 2019-06-16 09:21:30 +1000 |
commit | a25b9227ece3c61b5abe55f0b0d76216190ba9dc (patch) | |
tree | 3ba2a8ecea6b54c8b354d82bfc785c5ae0e7e478 | |
parent | 9aa30a8b9d05b183226f99b3e3981a3acab8cb90 (diff) | |
download | scintilla-mirror-a25b9227ece3c61b5abe55f0b0d76216190ba9dc.tar.gz |
Backport: Fix Xcode static analysis warning by renmaing GetImage to CreateImage.
A naming convention is used by the analyzer where a "Create" prefix is used when
the reference is owned by the caller and a "Get" prefix when the reference is
not owned so should not be released.
Backport of changeset 7573:9da2019c1c9d.
-rw-r--r-- | cocoa/PlatCocoa.h | 2 | ||||
-rw-r--r-- | cocoa/PlatCocoa.mm | 12 | ||||
-rw-r--r-- | cocoa/ScintillaCocoa.mm | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/cocoa/PlatCocoa.h b/cocoa/PlatCocoa.h index c9b3a8355..9824734e3 100644 --- a/cocoa/PlatCocoa.h +++ b/cocoa/PlatCocoa.h @@ -82,7 +82,7 @@ public: void PenColour(ColourDesired fore) override; /** Returns a CGImageRef that represents the surface. Returns NULL if this is not possible. */ - CGImageRef GetImage(); + CGImageRef CreateImage(); void CopyImageRectangle(Surface &surfaceSource, PRectangle srcRect, PRectangle dstRect); int LogPixelsY() override; diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm index 20a160d8e..3f0904374 100644 --- a/cocoa/PlatCocoa.mm +++ b/cocoa/PlatCocoa.mm @@ -298,9 +298,9 @@ void SurfaceImpl::FillColour(const ColourDesired& back) //-------------------------------------------------------------------------------------------------- -CGImageRef SurfaceImpl::GetImage() +CGImageRef SurfaceImpl::CreateImage() { - // For now, assume that GetImage can only be called on PixMap surfaces. + // For now, assume that CreateImage can only be called on PixMap surfaces. if (!bitmapData) return NULL; @@ -485,7 +485,7 @@ void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) SurfaceImpl& patternSurface = static_cast<SurfaceImpl &>(surfacePattern); // For now, assume that copy can only be called on PixMap surfaces. Shows up black. - CGImageRef image = patternSurface.GetImage(); + CGImageRef image = patternSurface.CreateImage(); if (image == NULL) { FillRectangle(rc, ColourDesired(0)); @@ -812,7 +812,7 @@ void SurfaceImpl::Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) void SurfaceImpl::CopyImageRectangle(Surface &surfaceSource, PRectangle srcRect, PRectangle dstRect) { SurfaceImpl& source = static_cast<SurfaceImpl &>(surfaceSource); - CGImageRef image = source.GetImage(); + CGImageRef image = source.CreateImage(); CGRect src = PRectangleToCGRect(srcRect); CGRect dst = PRectangleToCGRect(dstRect); @@ -845,7 +845,7 @@ void SurfaceImpl::Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSou SurfaceImpl& source = static_cast<SurfaceImpl &>(surfaceSource); // Get the CGImageRef - CGImageRef image = source.GetImage(); + CGImageRef image = source.CreateImage(); // If we could not get an image reference, fill the rectangle black if ( image == NULL ) { @@ -1343,7 +1343,7 @@ static NSImage* ImageFromXPM(XPM* pxpm) SurfaceImpl* surfaceIXPM = static_cast<SurfaceImpl*>(surfaceXPM.get()); CGContextClearRect(surfaceIXPM->GetContext(), CGRectMake(0, 0, width, height)); pxpm->Draw(surfaceXPM.get(), rcxpm); - CGImageRef imageRef = surfaceIXPM->GetImage(); + CGImageRef imageRef = surfaceIXPM->CreateImage(); img = [[NSImage alloc] initWithCGImage:imageRef size: NSZeroSize]; CGImageRelease(imageRef); } diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 3eaf17665..7c70b2e60 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -1456,7 +1456,7 @@ void ScintillaCocoa::StartDrag() // the full rectangle which may include non-selected text. NSBitmapImageRep* bitmap = NULL; - CGImageRef imagePixmap = pixmap.GetImage(); + CGImageRef imagePixmap = pixmap.CreateImage(); if (imagePixmap) bitmap = [[[NSBitmapImageRep alloc] initWithCGImage: imagePixmap] autorelease]; CGImageRelease(imagePixmap); |