Home | History | Annotate | Download | only in haiku-softpipe
      1 /*
      2  * Copyright 2006-2012, Haiku, Inc. All rights reserved.
      3  * Distributed under the terms of the MIT License.
      4  *
      5  * Authors:
      6  *		Jrme Duval, korli (at) users.berlios.de
      7  * 		Philippe Houdoin, philippe.houdoin (at) free.fr
      8  * 		Artur Wyszynski, harakash (at) gmail.com
      9  *		Alexander von Gluck IV, kallisti5 (at) 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 
     21 class SoftwareRenderer : public BGLRenderer {
     22 public:
     23 								SoftwareRenderer(BGLView *view,
     24 									ulong bgl_options,
     25 									BGLDispatcher *dispatcher);
     26 	virtual						~SoftwareRenderer();
     27 
     28 	virtual	void				LockGL();
     29 	virtual	void				UnlockGL();
     30 
     31 	virtual	void				SwapBuffers(bool vsync = false);
     32 	virtual	void				Draw(BRect updateRect);
     33 	virtual	status_t			CopyPixelsOut(BPoint source, BBitmap *dest);
     34 	virtual	status_t			CopyPixelsIn(BBitmap *source, BPoint dest);
     35 	virtual	void				FrameResized(float width, float height);
     36 
     37 	virtual	void				EnableDirectMode(bool enabled);
     38 	virtual	void				DirectConnected(direct_buffer_info *info);
     39 
     40 private:
     41 
     42 			void				_AllocateBitmap();
     43 
     44 			GalliumContext*		fContextObj;
     45 			BBitmap*			fBitmap;
     46 			context_id			fContextID;
     47 
     48 			bool				fDirectModeEnabled;
     49 			direct_buffer_info*	fInfo;
     50 			BLocker				fInfoLocker;
     51 			ulong				fOptions;
     52 			GLuint				fWidth;
     53 			GLuint				fHeight;
     54 			color_space			fColorSpace;
     55 };
     56 
     57 #endif	// SOFTPIPERENDERER_H
     58