Cocoa: fix warnings.
parent
7bda30aca4
commit
3103728c15
|
@ -147,7 +147,7 @@ void SolveSpace::ScheduleLater() {
|
||||||
NSTextField *editor;
|
NSTextField *editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
- initWithFrame:(NSRect)frameRect {
|
- (id)initWithFrame:(NSRect)frameRect {
|
||||||
self = [super initWithFrame:frameRect];
|
self = [super initWithFrame:frameRect];
|
||||||
[self setWantsLayer:YES];
|
[self setWantsLayer:YES];
|
||||||
|
|
||||||
|
@ -206,17 +206,19 @@ CONVERT(Rect)
|
||||||
offscreen = new GLOffscreen;
|
offscreen = new GLOffscreen;
|
||||||
|
|
||||||
NSSize size = [self convertSizeToBacking:[self bounds].size];
|
NSSize size = [self convertSizeToBacking:[self bounds].size];
|
||||||
offscreen->begin(size.width, size.height);
|
int width = (int)size.width,
|
||||||
|
height = (int)size.height;
|
||||||
|
offscreen->begin(width, height);
|
||||||
|
|
||||||
[self drawGL];
|
[self drawGL];
|
||||||
GL_CHECK();
|
GL_CHECK();
|
||||||
|
|
||||||
uint8_t *pixels = offscreen->end(![self isFlipped]);
|
uint8_t *pixels = offscreen->end(![self isFlipped]);
|
||||||
CGDataProviderRef provider = CGDataProviderCreateWithData(
|
CGDataProviderRef provider = CGDataProviderCreateWithData(
|
||||||
NULL, pixels, size.width * size.height * 4, NULL);
|
NULL, pixels, width * height * 4, NULL);
|
||||||
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
|
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
|
||||||
CGImageRef image = CGImageCreate(size.width, size.height, 8, 32,
|
CGImageRef image = CGImageCreate(width, height, 8, 32,
|
||||||
size.width * 4, colorspace, kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst,
|
width * 4, colorspace, kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst,
|
||||||
provider, NULL, true, kCGRenderingIntentDefault);
|
provider, NULL, true, kCGRenderingIntentDefault);
|
||||||
|
|
||||||
CGContextDrawImage((CGContextRef) [[NSGraphicsContext currentContext] graphicsPort],
|
CGContextDrawImage((CGContextRef) [[NSGraphicsContext currentContext] graphicsPort],
|
||||||
|
@ -362,7 +364,7 @@ CONVERT(Rect)
|
||||||
|
|
||||||
- (void)scrollWheel:(NSEvent*)event {
|
- (void)scrollWheel:(NSEvent*)event {
|
||||||
NSPoint point = [self ij_to_xy:[self convertPoint:[event locationInWindow] fromView:nil]];
|
NSPoint point = [self ij_to_xy:[self convertPoint:[event locationInWindow] fromView:nil]];
|
||||||
SolveSpace::SS.GW.MouseScroll(point.x, point.y, -[event deltaY]);
|
SolveSpace::SS.GW.MouseScroll(point.x, point.y, (int)-[event deltaY]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseExited:(NSEvent*)event {
|
- (void)mouseExited:(NSEvent*)event {
|
||||||
|
@ -409,7 +411,7 @@ CONVERT(Rect)
|
||||||
- (void)prepareEditorWithMinWidthInChars:(int)minWidthChars {
|
- (void)prepareEditorWithMinWidthInChars:(int)minWidthChars {
|
||||||
NSFont *font = [editor font];
|
NSFont *font = [editor font];
|
||||||
NSGlyph glyphA = [font glyphWithName:@"a"];
|
NSGlyph glyphA = [font glyphWithName:@"a"];
|
||||||
ssassert(glyphA != -1, "Expected font to have U+0061");
|
ssassert(glyphA != (NSGlyph)-1, "Expected font to have U+0061");
|
||||||
CGFloat glyphAWidth = [font advancementForGlyph:glyphA].width;
|
CGFloat glyphAWidth = [font advancementForGlyph:glyphA].width;
|
||||||
|
|
||||||
[editor sizeToFit];
|
[editor sizeToFit];
|
||||||
|
@ -485,8 +487,8 @@ void InitGraphicsWindow() {
|
||||||
|
|
||||||
void GetGraphicsWindowSize(int *w, int *h) {
|
void GetGraphicsWindowSize(int *w, int *h) {
|
||||||
NSSize size = [GWView convertSizeToBacking:[GWView frame].size];
|
NSSize size = [GWView convertSizeToBacking:[GWView frame].size];
|
||||||
*w = size.width;
|
*w = (int)size.width;
|
||||||
*h = size.height;
|
*h = (int)size.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InvalidateGraphics(void) {
|
void InvalidateGraphics(void) {
|
||||||
|
@ -1054,8 +1056,8 @@ void ShowTextWindow(bool visible) {
|
||||||
|
|
||||||
void GetTextWindowSize(int *w, int *h) {
|
void GetTextWindowSize(int *w, int *h) {
|
||||||
NSSize size = [TWView convertSizeToBacking:[TWView frame].size];
|
NSSize size = [TWView convertSizeToBacking:[TWView frame].size];
|
||||||
*w = size.width;
|
*w = (int)size.width;
|
||||||
*h = size.height;
|
*h = (int)size.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InvalidateText(void) {
|
void InvalidateText(void) {
|
||||||
|
|
Loading…
Reference in New Issue