Bug 1901043 Comment 7 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

> Following up comment #4

I  may have figured out what the "trusted" means in `CGDataProviderCreateTrustedWithCopyOfData()`. If I'm right it doesn't mean "TrustedUI". Instead it means something like "[a bitmap] created the standard way", as opposed to "[a bitmap] created using a `CGContextDelegate` callback".

`CGBitmapContextCreateImage()`, before it does anything else, first calls `CGContextDelegateImplementsCallback()` with `callback` (`arg1`) set to `0x1a`. By digging through the `CoreGraphics` framework I've found that `0x1a` == `kCGContextDelegateCreateImage`. If this callback is implemented, `CGBitmapContextCreateImage()` calls it (indirectly, via `CGContextDelegateCreateImage()`). Otherwise it goes on to create a bitmap "in the standard way".

This distinction between "trusted" and "non-trusted" is moot, though. The whole `CGContextDelegate` API (including `CGContextDelegateSetCallback()`) is undocumented (though [there's been some work to reverse engineer it](https://github.com/DnMllr/freequartz/blob/master/CoreGraphics/CGContextDelegate.c)). So it's highly unlikely that anyone besides Apple uses it. And Apple does use it, in a few cases, to set a `kCGContextDelegateCreateBitmap` callback. But the callback is always Apple code, usually also in the `CoreGraphics` framework (there's one more case in the `RenderBox` framework).
> Following up comment #4

I  may have figured out what the "trusted" means in `CGDataProviderCreateTrustedWithCopyOfData()`. If I'm right it doesn't mean "TrustedUI". Instead it means something like "[a bitmap] created the standard way", as opposed to "[a bitmap] created using a `CGContextDelegate` callback".

`CGBitmapContextCreateImage()`, before it does anything else, first calls `CGContextDelegateImplementsCallback()` with `callback` (`arg1`) set to `0x1a`. By digging through the `CoreGraphics` framework I've found that `0x1a` == `kCGContextDelegateCreateImage`. If this callback is implemented, `CGBitmapContextCreateImage()` calls it (indirectly, via `CGContextDelegateCreateImage()`). Otherwise it goes on to create a bitmap "in the standard way".

This distinction between "trusted" and "non-trusted" is moot, though. The whole `CGContextDelegate` API (including `CGContextDelegateSetCallback()`) is undocumented (though [there's been some work to reverse engineer it](https://github.com/DnMllr/freequartz/blob/master/CoreGraphics/CGContextDelegate.c)). So it's highly unlikely that anyone besides Apple uses it. And Apple does use it, in a few cases, to set a `kCGContextDelegateCreateBitmap` callback. But the callback is always Apple code, usually also in the `CoreGraphics` framework (there's one more case in the `RenderBox` framework).

For the record, the `RenderBox` call, whose name is mangled, is `create_image(CGContextDelegate*, CGRenderingState*, CGGState*)`.
> Following up comment #4

I  may have figured out what the "trusted" means in `CGDataProviderCreateTrustedWithCopyOfData()`. If I'm right it doesn't mean "TrustedUI". Instead it means something like "[a bitmap] created the standard way", as opposed to "[a bitmap] created using a `CGContextDelegate` callback".

`CGBitmapContextCreateImage()`, before it does anything else, first calls `CGContextDelegateImplementsCallback()` with `callback` (`arg1`) set to `0x1a`. By digging through the `CoreGraphics` framework I've found that `0x1a` == `kCGContextDelegateCreateImage`. If this callback is implemented, `CGBitmapContextCreateImage()` calls it (indirectly, via `CGContextDelegateCreateImage()`). Otherwise it goes on to create a bitmap "in the standard way".

This distinction between "trusted" and "non-trusted" is moot, though. The whole `CGContextDelegate` API (including `CGContextDelegateSetCallback()`) is undocumented (though [there's been some work to reverse engineer it](https://github.com/DnMllr/freequartz/blob/master/CoreGraphics/CGContextDelegate.c)). So it's highly unlikely that anyone besides Apple uses it. And Apple does use it, in a few cases, to set a `kCGContextDelegateCreateBitmap` callback. But the callback is always Apple code, usually also in the `CoreGraphics` framework (there's one more case in the `RenderBox` framework).

For the record, the `RenderBox` callback, whose name is mangled, is `create_image(CGContextDelegate*, CGRenderingState*, CGGState*)`.
> Following up comment #4

I  may have figured out what the "trusted" means in `CGDataProviderCreateTrustedWithCopyOfData()`. If I'm right it doesn't mean "TrustedUI". Instead it means something like "[a bitmap] created the standard way", as opposed to "[a bitmap] created using a `CGContextDelegate` callback".

`CGBitmapContextCreateImage()`, before it does anything else, first calls `CGContextDelegateImplementsCallback()` with `callback` (`arg1`) set to `0x1a`. By digging through the `CoreGraphics` framework I've found that `0x1a` == `kCGContextDelegateCreateImage`. If this callback is implemented, `CGBitmapContextCreateImage()` calls it (indirectly, via `CGContextDelegateCreateImage()`). Otherwise it goes on to create a bitmap "in the standard way".

This distinction between "trusted" and "non-trusted" is moot, though. The whole `CGContextDelegate` API (including `CGContextDelegateSetCallback()`) is undocumented (though [there's been some work to reverse engineer it](https://github.com/DnMllr/freequartz/blob/master/CoreGraphics/CGContextDelegate.c)). So it's highly unlikely that anyone besides Apple uses it. And Apple does use it, in a few cases, to set a `kCGContextDelegateCreateImage` callback. But the callback is always Apple code, usually also in the `CoreGraphics` framework (there's one more case in the `RenderBox` framework).

For the record, the `RenderBox` callback, whose name is mangled, is `create_image(CGContextDelegate*, CGRenderingState*, CGGState*)`.
> Following up comment #4

I  may have figured out what the "trusted" means in `CGDataProviderCreateTrustedWithCopyOfData()`. If I'm right it doesn't mean "TrustedUI". Instead it means something like "[a bitmap] created the standard way", as opposed to "[a bitmap] created using a `CGContextDelegate` callback".

`CGBitmapContextCreateImage()`, before it does anything else, first calls `CGContextDelegateImplementsCallback()` with `type` (`arg1`) set to `0x1a`. By digging through the `CoreGraphics` framework I've found that `0x1a` == `kCGContextDelegateCreateImage`. If this callback is implemented, `CGBitmapContextCreateImage()` calls it (indirectly, via `CGContextDelegateCreateImage()`). Otherwise it goes on to create a bitmap "in the standard way".

This distinction between "trusted" and "non-trusted" is moot, though. The whole `CGContextDelegate` API (including `CGContextDelegateSetCallback()`) is undocumented (though [there's been some work to reverse engineer it](https://github.com/DnMllr/freequartz/blob/master/CoreGraphics/CGContextDelegate.c)). So it's highly unlikely that anyone besides Apple uses it. And Apple does use it, in a few cases, to set a `kCGContextDelegateCreateImage` callback. But the callback is always Apple code, usually also in the `CoreGraphics` framework (there's one more case in the `RenderBox` framework).

For the record, the `RenderBox` callback, whose name is mangled, is `create_image(CGContextDelegate*, CGRenderingState*, CGGState*)`.

Back to Bug 1901043 Comment 7