Build CGLPixelSurface

This commit is contained in:
Sergey Bugaev 2017-07-14 00:35:47 +03:00
parent 73c051bcb3
commit 74900145cc
4 changed files with 23 additions and 4 deletions

View File

@ -383,7 +383,6 @@ add_framework(AppKit
system
CoreFoundation
Foundation
CoreGraphics
Onyx2D
CoreText
# native libraries
@ -396,4 +395,5 @@ add_framework(AppKit
CIRCULAR_DEPENDENCIES
OpenGL
QuartzCore
CoreGraphics
)

View File

@ -1,7 +1,13 @@
#import <CoreGraphics/CGLPixelSurface.h>
#import <CoreGraphics/CGWindow.h>
#import <Onyx2D/O2Image.h>
// this should be fixed upstream
#ifndef DARLING
#import <AppKit/O2Surface_DIBSection.h>
#else
#import <AppKit/O2Surface_cairo.h>
#endif
@implementation CGLPixelSurface
@ -59,7 +65,11 @@
_bufferObjects=malloc(_numberOfBuffers*sizeof(GLuint));
_readPixels=malloc(_numberOfBuffers*sizeof(void *));
_staticPixels=malloc(_numberOfBuffers*sizeof(void *));
#ifndef DARLING
_surface=[[O2Surface_DIBSection alloc] initWithWidth:_width height:-_height compatibleWithDeviceContext:nil];
#else
_surface=[[O2Surface_cairo alloc] initWithWidth:_width height:-_height compatibleWithContext:nil];
#endif
for(i=0;i<_numberOfBuffers;i++){
_bufferObjects[i]=0;
@ -251,7 +261,7 @@ static inline uint32_t premultiplyPixel(uint32_t value){
}
-(NSString *)description {
return [NSString stringWithFormat:@"<%@ %p:size={ %d %d } surface=%@",isa,self,_width,_height,_surface];
return [NSString stringWithFormat:@"<%@ %p:size={ %d %d } surface=%@", [self class], self, _width, _height, _surface];
}
@end

View File

@ -11,6 +11,9 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
-mmacosx-version-min=10.10"
)
find_package(PkgConfig REQUIRED)
pkg_check_modules(PC_CAIRO cairo)
include_directories(
${CMAKE_SOURCE_DIR}/src/external/foundation/include
${CMAKE_SOURCE_DIR}/src/external/foundation/include/Foundation
@ -32,6 +35,8 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_SOURCE_DIR}/../CoreText
${PC_CAIRO_INCLUDE_DIRS}
)
set(CoreGraphics_sources
@ -53,7 +58,7 @@ set(CoreGraphics_sources
CGImageProperties.m
CGImageSource.m
CGLayer.m
# CGLPixelSurface.m
CGLPixelSurface.m
CGPath.m
CGPattern.m
CGPDFContext.m
@ -78,4 +83,8 @@ add_framework(CoreGraphics
CoreFoundation
Foundation
Onyx2D
GL
CIRCULAR_DEPENDENCIES
AppKit
OpenGL
)

View File

@ -73,10 +73,10 @@ add_framework(QuartzCore
system
CoreFoundation
Foundation
CoreGraphics
Onyx2D
# native libraries
GL
CIRCULAR_DEPENDENCIES
OpenGL
CoreGraphics
)