/*
 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
 */

#import <Cocoa/Cocoa.h>
#import <OpenGL/gl.h>
#import <OpenGL/OpenGL.h>

@protocol GlassOffscreenProtocol

// as destination (to draw into)
- (void)bindForWidth:(NSUInteger)width andHeight:(NSUInteger)height;
- (void)unbind;

// as source (to show)
- (void)blitForWidth:(NSUInteger)width andHeight:(NSUInteger)height;

- (NSSize)size;

@end

@interface GlassOffscreen : NSObject <GlassOffscreenProtocol>
{
    NSRecursiveLock             *_lock;
    id<GlassOffscreenProtocol>  _offscreen;
    
    CGFloat                     _backgroundR;
    CGFloat                     _backgroundG;
    CGFloat                     _backgroundB;
    CGFloat                     _backgroundA;
}

- (void)setBackgroundColor:(NSColor*)color;

- (void)blit;

// need locks to set contexts, which may differ for OffscreenProtocol bind/unbind and blit
- (void)lock;
- (void)unlock;

@end
