more x86_64 work. started to put the mmu bits together in the (former) stage2 loader.
[newos.git] / apps / window_server / GraphicsContext.h
blob6947117e2988b676597aa194177e76be6658186f
1 #ifndef _GRAPHICS_CONTEXT_H
2 #define _GRAPHICS_CONTEXT_H
4 #include "Renderer.h"
5 #include "Region.h"
7 class Window;
9 class GraphicsContext {
10 public:
12 GraphicsContext();
13 Rect Bounds();
15 inline const Region& ClipRegion();
16 inline void SetClipRegion(const Region&);
17 inline void SetRenderer(Renderer*);
18 inline Renderer* GetRenderer();
19 inline void SetOrigin(int x, int y);
21 void DrawLine(int, int, int, int);
22 void FillRect(int, int, int, int);
23 void Blit(int x, int y, color888 image[], int image_width,
24 int image_height, int imageStrideWidth);
25 void StretchBlit(Rect imageRect, Rect screenRect, color888 image[],
26 int imageStrideWidth);
27 void CopyRect(Rect src, Rect dest, const Region &inCleanRegion,
28 Region &outNotCopied);
30 void SetColor(color888 color);
31 void DrawString(int x, int y, const char *string);
33 private:
35 Region fClipRegion;
36 Renderer *fRenderer;
37 color888 fCurrentColor;
38 int fXOrigin;
39 int fYOrigin;
43 inline const Region& GraphicsContext::ClipRegion()
45 return fClipRegion;
48 inline void GraphicsContext::SetClipRegion(const Region &region)
50 fClipRegion = region;
51 fClipRegion.ConstrainTo(fRenderer->Bounds());
54 inline void GraphicsContext::SetRenderer(Renderer *renderer)
56 fRenderer = renderer;
59 inline Renderer* GraphicsContext::GetRenderer()
61 return fRenderer;
64 inline void GraphicsContext::SetOrigin(int x, int y)
66 fXOrigin = x;
67 fYOrigin = y;
70 inline void GraphicsContext::SetColor(color888 color)
72 fCurrentColor = color;
75 #endif