Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

iOS: Clean up uses of string literal constants #56658

Merged
merged 1 commit into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterMetalLayer.h"

#include <CoreMedia/CoreMedia.h>
#include <IOSurface/IOSurfaceObjC.h>
#include <Metal/Metal.h>
#include <UIKit/UIKit.h>
Expand Down Expand Up @@ -316,9 +317,9 @@ - (IOSurface*)createIOSurface {

if (self.colorspace != nil) {
CFStringRef name = CGColorSpaceGetName(self.colorspace);
IOSurfaceSetValue(res, CFSTR("IOSurfaceColorSpace"), name);
IOSurfaceSetValue(res, kIOSurfaceColorSpace, name);
} else {
IOSurfaceSetValue(res, CFSTR("IOSurfaceColorSpace"), kCGColorSpaceSRGB);
IOSurfaceSetValue(res, kIOSurfaceColorSpace, kCGColorSpaceSRGB);
}
return (__bridge_transfer IOSurface*)res;
}
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/darwin/ios/framework/Source/IOKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extern "C" {
#define IOKIT
#include <device/device_types.h>

static const char* kIOServicePlane = "IOService";
constexpr const char* kIOServicePlane = "IOService";

typedef io_object_t io_registry_entry_t;
typedef io_object_t io_service_t;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#import "flutter/shell/platform/darwin/macos/framework/Source/FlutterSurface.h"

#import <CoreMedia/CoreMedia.h>
#import <Metal/Metal.h>

#import "flutter/fml/platform/darwin/cf_utils.h"
Expand Down Expand Up @@ -74,7 +75,7 @@ + (FlutterSurface*)fromFlutterMetalTexture:(const FlutterMetalTexture*)texture {
}

+ (IOSurfaceRef)createIOSurfaceWithSize:(CGSize)size {
unsigned pixelFormat = 'BGRA';
unsigned pixelFormat = kCVPixelFormatType_32BGRA;
unsigned bytesPerElement = 4;

size_t bytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, size.width * bytesPerElement);
Expand All @@ -89,7 +90,7 @@ + (IOSurfaceRef)createIOSurfaceWithSize:(CGSize)size {
};

IOSurfaceRef res = IOSurfaceCreate((CFDictionaryRef)options);
IOSurfaceSetValue(res, CFSTR("IOSurfaceColorSpace"), kCGColorSpaceSRGB);
IOSurfaceSetValue(res, kIOSurfaceColorSpace, kCGColorSpaceSRGB);
return res;
}

Expand Down