0.2.0-dev Download ZIP
94 lines ·5.3 KB Raw
| 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 | |
| 31 | #pragma once |
| 32 | |
| 33 | // Copyright 2014 The Chromium Authors. All rights reserved. |
| 34 | // |
| 35 | // Redistribution and use in source and binary forms, with or without |
| 36 | // modification, are permitted provided that the following conditions are met: |
| 37 | // * Redistributions of source code must retain the above copyright |
| 38 | // notice, this list of conditions and the following disclaimer. |
| 39 | // * Redistributions in binary form must reproduce the above copyright |
| 40 | // notice, this list of conditions and the following disclaimer in the |
| 41 | // documentation and/or other materials provided with the distribution. |
| 42 | // * Neither the name of the OpenEmu Team nor the |
| 43 | // names of its contributors may be used to endorse or promote products |
| 44 | // derived from this software without specific prior written permission. |
| 45 | // |
| 46 | // THIS SOFTWARE IS PROVIDED BY OpenEmu Team ''AS IS'' AND ANY |
| 47 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 48 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 49 | // DISCLAIMED. IN NO EVENT SHALL OpenEmu Team BE LIABLE FOR ANY |
| 50 | // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 51 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 52 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 53 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 54 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 55 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 56 | |
| 57 | #import <Foundation/Foundation.h> |
| 58 | #import <Quartz/Quartz.h> |
| 59 | |
| 60 | #include <cstdint> |
| 61 | |
| 62 | // https://chromium.googlesource.com/chromium/src/+/refs/heads/main/ui/base/cocoa/remote_layer_api.h |
| 63 | |
| 64 | // The CAContextID type identifies a CAContext across processes. This is the |
| 65 | // token that is passed from the process that is sharing the CALayer that it is |
| 66 | // rendering to the process that will be displaying that CALayer. |
| 67 | typedef uint32_t CAContextID; |
| 68 | |
| 69 | // The CAContext has a static CAContextID which can be sent to another process. |
| 70 | // When a CALayerHost is created using that CAContextID in another process, the |
| 71 | // content displayed by that CALayerHost will be the content of the CALayer |
| 72 | // that is set as the |layer| property on the CAContext. |
| 73 | @interface CAContext : NSObject |
| 74 | + (instancetype)contextWithCGSConnection:(CAContextID)contextId options:(NSDictionary *)optionsDict; |
| 75 | @property(readonly) CAContextID contextId; |
| 76 | @property(retain) CALayer *layer; |
| 77 | @end |
| 78 | |
| 79 | // The CALayerHost is created in the process that will display the content |
| 80 | // being rendered by another process. Setting the |contextId| property on |
| 81 | // an object of this class will make this layer display the content of the |
| 82 | // CALayer that is set to the CAContext with that CAContextID in the layer |
| 83 | // sharing process. |
| 84 | @interface CALayerHost : CALayer |
| 85 | @property CAContextID contextId; |
| 86 | @end |
| 87 | |
| 88 | // The CGSConnectionID is used to create the CAContext in the process that is |
| 89 | // going to share the CALayers that it is rendering to another process to |
| 90 | // display. |
| 91 | typedef uint32_t CGSConnectionID; |
| 92 | extern "C" CGSConnectionID CGSMainConnectionID(void); |
| 93 | |
| 94 | extern "C" NSString *const kCAContextCIFilterBehavior; |