From 64e784e77b45cdbcd4ce17187c9fa4259b0ddefb Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 21 Apr 2022 17:47:02 -0400 Subject: Remove unused return type from backend destroy methods Since this is essentially a destructor, I don't think there's anything really useful to do with errors here, and in practice no backends actually used it anyway. --- src/mac_cairo.m | 14 +++++++------- src/mac_gl.m | 5 ++--- src/mac_stub.m | 5 ++--- src/mac_vulkan.m | 5 ++--- src/stub.h | 5 ++--- src/types.h | 2 +- src/win_cairo.c | 6 ++---- src/win_gl.c | 6 ++---- src/x11.h | 2 +- src/x11_cairo.c | 6 ++---- src/x11_gl.c | 3 +-- 11 files changed, 24 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/mac_cairo.m b/src/mac_cairo.m index facb5c1..33fc89a 100644 --- a/src/mac_cairo.m +++ b/src/mac_cairo.m @@ -1,4 +1,4 @@ -// Copyright 2019-2020 David Robillard +// Copyright 2019-2022 David Robillard // SPDX-License-Identifier: ISC #include "implementation.h" @@ -64,7 +64,7 @@ puglMacCairoCreate(PuglView* view) return PUGL_SUCCESS; } -static PuglStatus +static void puglMacCairoDestroy(PuglView* view) { PuglCairoView* const drawView = (PuglCairoView*)view->impl->drawView; @@ -73,7 +73,6 @@ puglMacCairoDestroy(PuglView* view) [drawView release]; view->impl->drawView = nil; - return PUGL_SUCCESS; } static PuglStatus @@ -87,10 +86,11 @@ puglMacCairoEnter(PuglView* view, const PuglExposeEvent* expose) assert(!drawView->surface); assert(!drawView->cr); - const double scale = 1.0 / [[NSScreen mainScreen] backingScaleFactor]; - CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; - const CGSize sizePx = {view->frame.width, view->frame.height}; - const CGSize sizePt = CGContextConvertSizeToUserSpace(context, sizePx); + const double scale = 1.0 / [[NSScreen mainScreen] backingScaleFactor]; + CGContextRef context = + (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; + const CGSize sizePx = {view->frame.width, view->frame.height}; + const CGSize sizePt = CGContextConvertSizeToUserSpace(context, sizePx); // Convert coordinates to standard Cairo space CGContextTranslateCTM(context, 0.0, -sizePt.height); diff --git a/src/mac_gl.m b/src/mac_gl.m index 25fcede..dd94e54 100644 --- a/src/mac_gl.m +++ b/src/mac_gl.m @@ -1,4 +1,4 @@ -// Copyright 2019-2020 David Robillard +// Copyright 2019-2022 David Robillard // SPDX-License-Identifier: ISC #include "implementation.h" @@ -120,7 +120,7 @@ puglMacGlCreate(PuglView* view) return PUGL_SUCCESS; } -static PuglStatus +static void puglMacGlDestroy(PuglView* view) { PuglOpenGLView* const drawView = (PuglOpenGLView*)view->impl->drawView; @@ -129,7 +129,6 @@ puglMacGlDestroy(PuglView* view) [drawView release]; view->impl->drawView = nil; - return PUGL_SUCCESS; } static PuglStatus diff --git a/src/mac_stub.m b/src/mac_stub.m index 3812479..a0d0322 100644 --- a/src/mac_stub.m +++ b/src/mac_stub.m @@ -1,4 +1,4 @@ -// Copyright 2019-2020 David Robillard +// Copyright 2019-2022 David Robillard // SPDX-License-Identifier: ISC #include "implementation.h" @@ -53,7 +53,7 @@ puglMacStubCreate(PuglView* view) return PUGL_SUCCESS; } -static PuglStatus +static void puglMacStubDestroy(PuglView* view) { PuglStubView* const drawView = (PuglStubView*)view->impl->drawView; @@ -62,7 +62,6 @@ puglMacStubDestroy(PuglView* view) [drawView release]; view->impl->drawView = nil; - return PUGL_SUCCESS; } const PuglBackend* diff --git a/src/mac_vulkan.m b/src/mac_vulkan.m index 82db3c3..619b75f 100644 --- a/src/mac_vulkan.m +++ b/src/mac_vulkan.m @@ -1,4 +1,4 @@ -// Copyright 2012-2020 David Robillard +// Copyright 2012-2022 David Robillard // SPDX-License-Identifier: ISC #define VK_NO_PROTOTYPES 1 @@ -89,7 +89,7 @@ puglMacVulkanCreate(PuglView* view) return PUGL_SUCCESS; } -static PuglStatus +static void puglMacVulkanDestroy(PuglView* view) { PuglVulkanView* const drawView = (PuglVulkanView*)view->impl->drawView; @@ -98,7 +98,6 @@ puglMacVulkanDestroy(PuglView* view) [drawView release]; view->impl->drawView = nil; - return PUGL_SUCCESS; } struct PuglVulkanLoaderImpl { diff --git a/src/stub.h b/src/stub.h index 104f869..699bbb9 100644 --- a/src/stub.h +++ b/src/stub.h @@ -1,4 +1,4 @@ -// Copyright 2012-2021 David Robillard +// Copyright 2012-2022 David Robillard // SPDX-License-Identifier: ISC #ifndef PUGL_SRC_STUB_H @@ -24,11 +24,10 @@ puglStubCreate(PuglView* const view) return PUGL_SUCCESS; } -static inline PuglStatus +static inline void puglStubDestroy(PuglView* const view) { (void)view; - return PUGL_SUCCESS; } static inline PuglStatus diff --git a/src/types.h b/src/types.h index e4ca16b..107e359 100644 --- a/src/types.h +++ b/src/types.h @@ -74,7 +74,7 @@ struct PuglBackendImpl { PuglStatus (*create)(PuglView*); /// Destroy surface and drawing context - PuglStatus (*destroy)(PuglView*); + void (*destroy)(PuglView*); /// Enter drawing context, for drawing if expose is non-null PuglStatus (*enter)(PuglView*, const PuglExposeEvent*); diff --git a/src/win_cairo.c b/src/win_cairo.c index dce061d..ddc9554 100644 --- a/src/win_cairo.c +++ b/src/win_cairo.c @@ -1,4 +1,4 @@ -// Copyright 2012-2021 David Robillard +// Copyright 2012-2022 David Robillard // SPDX-License-Identifier: ISC #include "stub.h" @@ -89,7 +89,7 @@ puglWinCairoOpen(PuglView* view) return PUGL_SUCCESS; } -static PuglStatus +static void puglWinCairoDestroy(PuglView* view) { PuglInternals* const impl = view->impl; @@ -99,8 +99,6 @@ puglWinCairoDestroy(PuglView* view) puglWinCairoDestroyDrawContext(view); free(surface); impl->surface = NULL; - - return PUGL_SUCCESS; } static PuglStatus diff --git a/src/win_gl.c b/src/win_gl.c index 327ba38..718a93c 100644 --- a/src/win_gl.c +++ b/src/win_gl.c @@ -1,4 +1,4 @@ -// Copyright 2012-2020 David Robillard +// Copyright 2012-2022 David Robillard // SPDX-License-Identifier: ISC #include "stub.h" @@ -238,7 +238,7 @@ puglWinGlCreate(PuglView* view) return PUGL_SUCCESS; } -static PuglStatus +static void puglWinGlDestroy(PuglView* view) { PuglWinGlSurface* surface = (PuglWinGlSurface*)view->impl->surface; @@ -248,8 +248,6 @@ puglWinGlDestroy(PuglView* view) free(surface); view->impl->surface = NULL; } - - return PUGL_SUCCESS; } static PuglStatus diff --git a/src/x11.h b/src/x11.h index b4daf95..e55355a 100644 --- a/src/x11.h +++ b/src/x11.h @@ -1,4 +1,4 @@ -// Copyright 2012-2021 David Robillard +// Copyright 2012-2022 David Robillard // SPDX-License-Identifier: ISC #ifndef PUGL_SRC_X11_H diff --git a/src/x11_cairo.c b/src/x11_cairo.c index 107a4f3..6aafb50 100644 --- a/src/x11_cairo.c +++ b/src/x11_cairo.c @@ -1,4 +1,4 @@ -// Copyright 2012-2020 David Robillard +// Copyright 2012-2022 David Robillard // SPDX-License-Identifier: ISC #include "types.h" @@ -67,7 +67,7 @@ puglX11CairoCreate(PuglView* view) return PUGL_SUCCESS; } -static PuglStatus +static void puglX11CairoDestroy(PuglView* view) { PuglInternals* const impl = view->impl; @@ -75,8 +75,6 @@ puglX11CairoDestroy(PuglView* view) puglX11CairoClose(view); free(surface); - - return PUGL_SUCCESS; } static PuglStatus diff --git a/src/x11_gl.c b/src/x11_gl.c index 06e2b22..934fc18 100644 --- a/src/x11_gl.c +++ b/src/x11_gl.c @@ -195,7 +195,7 @@ puglX11GlCreate(PuglView* view) return PUGL_SUCCESS; } -static PuglStatus +static void puglX11GlDestroy(PuglView* view) { PuglX11GlSurface* surface = (PuglX11GlSurface*)view->impl->surface; @@ -204,7 +204,6 @@ puglX11GlDestroy(PuglView* view) free(surface); view->impl->surface = NULL; } - return PUGL_SUCCESS; } PuglGlFunc -- cgit v1.2.1