[Bf-blender-cvs] [087a4898676] master: Cleanup: simplify GHOST cursor API, no functional changes
Brecht Van Lommel
noreply at git.blender.org
Sun Jun 16 20:29:52 CEST 2019
Commit: 087a4898676d744d4aaa46a59b47186825495820
Author: Brecht Van Lommel
Date: Sun Jun 16 19:45:57 2019 +0200
Branches: master
https://developer.blender.org/rB087a4898676d744d4aaa46a59b47186825495820
Cleanup: simplify GHOST cursor API, no functional changes
===================================================================
M intern/ghost/GHOST_C-api.h
M intern/ghost/GHOST_IWindow.h
M intern/ghost/intern/GHOST_C-api.cpp
M intern/ghost/intern/GHOST_Window.cpp
M intern/ghost/intern/GHOST_Window.h
M intern/ghost/intern/GHOST_WindowCocoa.h
M intern/ghost/intern/GHOST_WindowCocoa.mm
M intern/ghost/intern/GHOST_WindowNULL.h
M intern/ghost/intern/GHOST_WindowSDL.cpp
M intern/ghost/intern/GHOST_WindowSDL.h
M intern/ghost/intern/GHOST_WindowWin32.cpp
M intern/ghost/intern/GHOST_WindowWin32.h
M intern/ghost/intern/GHOST_WindowX11.cpp
M intern/ghost/intern/GHOST_WindowX11.h
M intern/ghost/test/multitest/MultiTest.c
M source/blender/windowmanager/intern/wm_cursors.c
M source/blender/windowmanager/wm_cursors.h
===================================================================
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index b54c097c2ab..0f735711b24 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -324,20 +324,6 @@ extern GHOST_TStandardCursor GHOST_GetCursorShape(GHOST_WindowHandle windowhandl
extern GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle,
GHOST_TStandardCursor cursorshape);
-/**
- * Set the shape of the cursor to a custom cursor.
- * \param windowhandle The handle to the window
- * \param bitmap The bitmap data for the cursor.
- * \param mask The mask data for the cursor.
- * \param hotX The X coordinate of the cursor hotspot.
- * \param hotY The Y coordinate of the cursor hotspot.
- * \return Indication of success.
- */
-extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
- GHOST_TUns8 bitmap[16][2],
- GHOST_TUns8 mask[16][2],
- int hotX,
- int hotY);
/**
* Set the shape of the cursor to a custom cursor of specified size.
* \param windowhandle The handle to the window
@@ -347,18 +333,17 @@ extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle
* \param sizey The height of the cursor
* \param hotX The X coordinate of the cursor hotspot.
* \param hotY The Y coordinate of the cursor hotspot.
- * \param fg_color, bg_color Colors of the cursor
+ * \param canInvertColor Let macOS invert cursor color to match platform convention.
* \return Indication of success.
*/
-extern GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle,
- GHOST_TUns8 *bitmap,
- GHOST_TUns8 *mask,
- int sizex,
- int sizey,
- int hotX,
- int hotY,
- int fg_color,
- int bg_color);
+extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
+ GHOST_TUns8 *bitmap,
+ GHOST_TUns8 *mask,
+ int sizex,
+ int sizey,
+ int hotX,
+ int hotY,
+ GHOST_TUns8 canInvertColor);
/**
* Returns the visibility state of the cursor.
diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h
index 52894a7c38d..1a1844bfe41 100644
--- a/intern/ghost/GHOST_IWindow.h
+++ b/intern/ghost/GHOST_IWindow.h
@@ -287,19 +287,13 @@ class GHOST_IWindow {
* \param hotY The Y coordinate of the cursor hotspot.
* \return Indication of success.
*/
- virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 bitmap[16][2],
- GHOST_TUns8 mask[16][2],
- int hotX,
- int hotY) = 0;
-
virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex,
int sizey,
int hotX,
int hotY,
- int fg_color,
- int bg_color) = 0;
+ bool canInvertColor) = 0;
/**
* Returns the visibility state of the cursor.
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index ef653c114e8..78f171af7d1 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -265,29 +265,17 @@ GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle,
}
GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
- GHOST_TUns8 bitmap[16][2],
- GHOST_TUns8 mask[16][2],
+ GHOST_TUns8 *bitmap,
+ GHOST_TUns8 *mask,
+ int sizex,
+ int sizey,
int hotX,
- int hotY)
+ int hotY,
+ GHOST_TUns8 canInvertColor)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
- return window->setCustomCursorShape(bitmap, mask, hotX, hotY);
-}
-
-GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle,
- GHOST_TUns8 *bitmap,
- GHOST_TUns8 *mask,
- int sizex,
- int sizey,
- int hotX,
- int hotY,
- int fg_color,
- int bg_color)
-{
- GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
-
- return window->setCustomCursorShape(bitmap, mask, sizex, sizey, hotX, hotY, fg_color, bg_color);
+ return window->setCustomCursorShape(bitmap, mask, sizex, sizey, hotX, hotY, canInvertColor);
}
int GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle)
diff --git a/intern/ghost/intern/GHOST_Window.cpp b/intern/ghost/intern/GHOST_Window.cpp
index 76f2d2347db..ca19e251279 100644
--- a/intern/ghost/intern/GHOST_Window.cpp
+++ b/intern/ghost/intern/GHOST_Window.cpp
@@ -192,25 +192,15 @@ GHOST_TSuccess GHOST_Window::setCursorShape(GHOST_TStandardCursor cursorShape)
}
}
-GHOST_TSuccess GHOST_Window::setCustomCursorShape(GHOST_TUns8 bitmap[16][2],
- GHOST_TUns8 mask[16][2],
- int hotX,
- int hotY)
-{
- return setCustomCursorShape(
- (GHOST_TUns8 *)bitmap, (GHOST_TUns8 *)mask, 16, 16, hotX, hotY, 0, 1);
-}
-
GHOST_TSuccess GHOST_Window::setCustomCursorShape(GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex,
int sizey,
int hotX,
int hotY,
- int fg_color,
- int bg_color)
+ bool canInvertColor)
{
- if (setWindowCustomCursorShape(bitmap, mask, sizex, sizey, hotX, hotY, fg_color, bg_color)) {
+ if (setWindowCustomCursorShape(bitmap, mask, sizex, sizey, hotX, hotY, canInvertColor)) {
m_cursorShape = GHOST_kStandardCursorCustom;
return GHOST_kSuccess;
}
diff --git a/intern/ghost/intern/GHOST_Window.h b/intern/ghost/intern/GHOST_Window.h
index 50a563453f6..5f9e8ffdd5e 100644
--- a/intern/ghost/intern/GHOST_Window.h
+++ b/intern/ghost/intern/GHOST_Window.h
@@ -124,19 +124,13 @@ class GHOST_Window : public GHOST_IWindow {
* \param hotY The Y coordinate of the cursor hotspot.
* \return Indication of success.
*/
- GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 bitmap[16][2],
- GHOST_TUns8 mask[16][2],
- int hotX,
- int hotY);
-
GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex,
int sizey,
int hotX,
int hotY,
- int fg_color,
- int bg_color);
+ bool canInvertColor);
/**
* Returns the visibility state of the cursor.
@@ -347,19 +341,13 @@ class GHOST_Window : public GHOST_IWindow {
* Sets the cursor shape on the window using
* native window system calls.
*/
- virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
- GHOST_TUns8 mask[16][2],
- int hotX,
- int hotY) = 0;
-
virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int szx,
int szy,
int hotX,
int hotY,
- int fg,
- int bg) = 0;
+ bool canInvertColor) = 0;
GHOST_TSuccess releaseNativeHandles();
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.h b/intern/ghost/intern/GHOST_WindowCocoa.h
index 5300b07523c..5e857c05a09 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.h
+++ b/intern/ghost/intern/GHOST_WindowCocoa.h
@@ -307,13 +307,7 @@ class GHOST_WindowCocoa : publ
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list