macos_quartz_core_spi.h 5.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /**************************************************************************/
  2. /* macos_quartz_core_spi.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #pragma once
  31. // Copyright 2014 The Chromium Authors. All rights reserved.
  32. //
  33. // Redistribution and use in source and binary forms, with or without
  34. // modification, are permitted provided that the following conditions are met:
  35. // * Redistributions of source code must retain the above copyright
  36. // notice, this list of conditions and the following disclaimer.
  37. // * Redistributions in binary form must reproduce the above copyright
  38. // notice, this list of conditions and the following disclaimer in the
  39. // documentation and/or other materials provided with the distribution.
  40. // * Neither the name of the OpenEmu Team nor the
  41. // names of its contributors may be used to endorse or promote products
  42. // derived from this software without specific prior written permission.
  43. //
  44. // THIS SOFTWARE IS PROVIDED BY OpenEmu Team ''AS IS'' AND ANY
  45. // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  46. // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  47. // DISCLAIMED. IN NO EVENT SHALL OpenEmu Team BE LIABLE FOR ANY
  48. // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  49. // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  50. // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  51. // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  52. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  53. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  54. #import <Foundation/Foundation.h>
  55. #import <Quartz/Quartz.h>
  56. #include <stdint.h>
  57. // https://chromium.googlesource.com/chromium/src/+/refs/heads/main/ui/base/cocoa/remote_layer_api.h
  58. // The CAContextID type identifies a CAContext across processes. This is the
  59. // token that is passed from the process that is sharing the CALayer that it is
  60. // rendering to the process that will be displaying that CALayer.
  61. typedef uint32_t CAContextID;
  62. // The CAContext has a static CAContextID which can be sent to another process.
  63. // When a CALayerHost is created using that CAContextID in another process, the
  64. // content displayed by that CALayerHost will be the content of the CALayer
  65. // that is set as the |layer| property on the CAContext.
  66. @interface CAContext : NSObject
  67. + (instancetype)contextWithCGSConnection:(CAContextID)contextId options:(NSDictionary *)optionsDict;
  68. @property(readonly) CAContextID contextId;
  69. @property(retain) CALayer *layer;
  70. @end
  71. // The CALayerHost is created in the process that will display the content
  72. // being rendered by another process. Setting the |contextId| property on
  73. // an object of this class will make this layer display the content of the
  74. // CALayer that is set to the CAContext with that CAContextID in the layer
  75. // sharing process.
  76. @interface CALayerHost : CALayer
  77. @property CAContextID contextId;
  78. @end
  79. // The CGSConnectionID is used to create the CAContext in the process that is
  80. // going to share the CALayers that it is rendering to another process to
  81. // display.
  82. typedef uint32_t CGSConnectionID;
  83. extern "C" CGSConnectionID CGSMainConnectionID(void);
  84. extern "C" NSString *const kCAContextCIFilterBehavior;