The Pedigree Project  0.1
Display.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef MACHINE_DISPLAY_H
21 #define MACHINE_DISPLAY_H
22 
23 #include "pedigree/kernel/compiler.h"
24 #include "pedigree/kernel/graphics/Graphics.h"
25 #include "pedigree/kernel/machine/Device.h"
26 #include "pedigree/kernel/processor/types.h"
27 #include "pedigree/kernel/utilities/List.h"
28 
29 class String;
30 
46 {
47  public:
49  struct rgb_t
50  {
51  uint8_t r, g, b, a;
52  } PACKED;
53 
55  struct PixelFormat
56  {
57  uint8_t mRed;
58  uint8_t pRed;
59  uint8_t mGreen;
60  uint8_t pGreen;
61  uint8_t mBlue;
62  uint8_t pBlue;
63  uint8_t mAlpha;
64  uint8_t pAlpha;
65  uint8_t nBpp;
66  uint32_t nPitch;
67  };
68 
70  struct ScreenMode
71  {
72  ScreenMode();
73 
74  uint32_t id;
75  uint32_t width;
76  uint32_t height;
77  uint32_t refresh;
78  uintptr_t framebuffer;
79  PixelFormat pf;
80 
81  Graphics::PixelFormat pf2;
82  uint32_t bytesPerLine;
83  uint32_t bytesPerPixel;
84 
85  bool textMode; // is a text mode, not a graphics mode
86  };
87 
88  Display();
89  Display(Device *p);
90  virtual ~Display();
91 
92  virtual Type getType();
93 
94  virtual void getName(String &str);
95 
96  virtual void dump(String &str);
97 
101  virtual void *getFramebuffer();
102 
106  virtual rgb_t *newBuffer();
107 
109  virtual void setCurrentBuffer(rgb_t *pBuffer);
110 
117  virtual void updateBuffer(
118  rgb_t *pBuffer, size_t x1 = ~0UL, size_t y1 = ~0UL, size_t x2 = ~0UL,
119  size_t y2 = ~0UL);
120 
123  virtual void killBuffer(rgb_t *pBuffer);
124 
127  virtual void bitBlit(
128  rgb_t *pBuffer, size_t fromX, size_t fromY, size_t toX, size_t toY,
129  size_t width, size_t height);
130 
133  virtual void fillRectangle(
134  rgb_t *pBuffer, size_t x, size_t y, size_t width, size_t height,
135  rgb_t colour);
136 
139  virtual bool getPixelFormat(PixelFormat &pf);
140 
143  virtual bool getCurrentScreenMode(ScreenMode &sm);
144 
147  virtual bool getScreenModes(List<ScreenMode *> &sms);
148 
151  virtual bool setScreenMode(ScreenMode sm);
152 
155  virtual bool setScreenMode(size_t modeId);
156 
158  virtual bool setScreenMode(size_t nWidth, size_t nHeight, size_t nBpp);
159 };
160 
161 #endif
uint8_t mAlpha
Alpha mask.
Definition: Display.h:63
uint8_t mRed
Red mask.
Definition: Display.h:57
Definition: String.h:49
uint8_t pGreen
Position of green field.
Definition: Display.h:60
Definition: Device.h:43
uint8_t nBpp
Bits per pixel (total).
Definition: Display.h:65
Definition: List.h:64
uint32_t nPitch
Bytes per scanline.
Definition: Display.h:66
uint8_t pAlpha
Position of the alpha field.
Definition: Display.h:64
uint8_t pBlue
Position of blue field.
Definition: Display.h:62
uint8_t mGreen
Green mask.
Definition: Display.h:59
uint8_t mBlue
Blue mask.
Definition: Display.h:61
Type
Definition: Device.h:50
uint8_t pRed
Position of red field.
Definition: Display.h:58