Add 10.13 compatibility

Apple renamed CGColorSpaceCopyICCProfile to CGColorSpaceCopyICCData in
10.13. If you compile code with a minimum OS required of 10.13 or
newer, [-Werror,-Wdeprecated-declarations] will cause an error to
occur on use of the function with the old name.

Add a compile switch so that no error is emitted regardless of the
deployment configuration.

Bug: chromium:1322548
Change-Id: Ie969aa9e5c4fc9bee2ec88b126d4c07701c3e9e6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261953
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#36855}
This commit is contained in:
Avi Drissman
2022-05-11 11:12:40 -04:00
committed by WebRTC LUCI CQ
parent 4ca02df647
commit 7555ac5316

View File

@ -10,6 +10,8 @@
#include "modules/desktop_capture/mac/desktop_frame_cgimage.h"
#include <AvailabilityMacros.h>
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
@ -73,7 +75,11 @@ std::unique_ptr<DesktopFrameCGImage> DesktopFrameCGImage::CreateFromCGImage(
CGColorSpaceRef cg_color_space = CGImageGetColorSpace(cg_image.get());
if (cg_color_space) {
#if !defined(MAC_OS_X_VERSION_10_13) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_13
rtc::ScopedCFTypeRef<CFDataRef> cf_icc_profile(CGColorSpaceCopyICCProfile(cg_color_space));
#else
rtc::ScopedCFTypeRef<CFDataRef> cf_icc_profile(CGColorSpaceCopyICCData(cg_color_space));
#endif
if (cf_icc_profile) {
const uint8_t* data_as_byte =
reinterpret_cast<const uint8_t*>(CFDataGetBytePtr(cf_icc_profile.get()));