1/*
2 * Copyright 2006-2012, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Jérôme Duval, korli@users.berlios.de
7 * 		Philippe Houdoin, philippe.houdoin@free.fr
8 * 		Artur Wyszynski, harakash@gmail.com
9 *		Alexander von Gluck IV, kallisti5@unixzen.com
10 */
11#ifndef SOFTWARERENDERER_H
12#define SOFTWARERENDERER_H
13
14
15#include <kernel/image.h>
16
17#include "GLRenderer.h"
18#include "GalliumContext.h"
19
20
21class SoftwareRenderer : public BGLRenderer, public HGLWinsysContext {
22public:
23								SoftwareRenderer(BGLView *view,
24									ulong bgl_options);
25	virtual						~SoftwareRenderer();
26
27			void				LockGL();
28			void				UnlockGL();
29
30			void				Display(BBitmap* bitmap, BRect* updateRect);
31
32			void				SwapBuffers(bool vsync = false);
33			void				Draw(BRect updateRect);
34			status_t			CopyPixelsOut(BPoint source, BBitmap *dest);
35			status_t			CopyPixelsIn(BBitmap *source, BPoint dest);
36			void				FrameResized(float width, float height);
37
38			void				EnableDirectMode(bool enabled);
39			void				DirectConnected(direct_buffer_info *info);
40
41private:
42			GalliumContext*		fContextObj;
43			context_id			fContextID;
44
45			bool				fDirectModeEnabled;
46			direct_buffer_info*	fInfo;
47			BLocker				fInfoLocker;
48			ulong				fOptions;
49			GLuint				fWidth;
50			GLuint				fHeight;
51			color_space			fColorSpace;
52};
53
54#endif	// SOFTPIPERENDERER_H
55