23 #include "pedigree/native/compiler.h" 24 #include "pedigree/native/types.h" 32 Rect(
size_t x_,
size_t y_,
size_t width_,
size_t height_);
36 void update(
size_t x_,
size_t y_,
size_t w_,
size_t h_);
66 inline size_t bitsPerPixel(PixelFormat format)
89 inline size_t bytesPerPixel(PixelFormat format)
91 return bitsPerPixel(format) / 8;
95 inline uint32_t createRgb(uint32_t r, uint32_t g, uint32_t b)
97 return (r << 16) | (g << 8) | b;
146 PedigreeGraphics::PixelFormat getFormat();
149 size_t getBytesPerPixel();
154 void setPalette(uint32_t *palette,
size_t entries);
161 void *getRawBuffer();
165 Framebuffer *createChild(
size_t x,
size_t y,
size_t w,
size_t h);
169 uint32_t source, PedigreeGraphics::PixelFormat srcFormat,
170 uint32_t &dest, PedigreeGraphics::PixelFormat destFormat);
187 const void *srcData, PedigreeGraphics::PixelFormat srcFormat,
188 size_t width,
size_t height);
203 size_t x = ~0UL,
size_t y = ~0UL,
size_t w = ~0UL,
size_t h = ~0UL,
204 bool bChild =
false);
209 size_t destx,
size_t desty,
size_t width,
size_t height);
215 void *pBuffer,
size_t srcx,
size_t srcy,
size_t destx,
size_t desty,
216 size_t width,
size_t height,
217 PedigreeGraphics::PixelFormat format = PedigreeGraphics::Bits32_Argb);
221 size_t x,
size_t y,
size_t width,
size_t height, uint32_t colour,
222 PedigreeGraphics::PixelFormat format = PedigreeGraphics::Bits32_Argb);
226 size_t srcx,
size_t srcy,
size_t destx,
size_t desty,
size_t w,
231 size_t x1,
size_t y1,
size_t x2,
size_t y2, uint32_t colour,
232 PedigreeGraphics::PixelFormat format = PedigreeGraphics::Bits32_Argb);
236 size_t x,
size_t y, uint32_t colour,
237 PedigreeGraphics::PixelFormat format = PedigreeGraphics::Bits32_Argb);
253 bool m_bProviderValid;
258 inline bool convertPixel(
259 uint32_t source, PixelFormat srcFormat, uint32_t &dest,
260 PixelFormat destFormat)
262 if ((srcFormat == destFormat) || (!source))
269 uint8_t amtRed = 0, amtGreen = 0, amtBlue = 0, amtAlpha = 0;
272 if ((srcFormat == Bits32_Argb) || (srcFormat == Bits32_Rgb) ||
273 (srcFormat == Bits24_Rgb))
275 if (srcFormat != Bits24_Rgb)
276 amtAlpha = (source & 0xff000000) >> 24;
277 amtRed = (source & 0xff0000) >> 16;
278 amtGreen = (source & 0xff00) >> 8;
279 amtBlue = (source & 0xff);
281 else if (srcFormat == Bits32_Rgba)
283 amtRed = (source & 0xff000000) >> 24;
284 amtGreen = (source & 0xff0000) >> 16;
285 amtBlue = (source & 0xff00) >> 8;
286 amtAlpha = (source & 0xff);
288 else if ((srcFormat == Bits32_Bgr) || (srcFormat == Bits24_Bgr))
290 amtBlue = (source & 0xff0000) >> 16;
291 amtGreen = (source & 0xff00) >> 8;
292 amtRed = (source & 0xff);
294 else if (srcFormat == Bits16_Argb)
296 amtAlpha = (((source & 0xF000) >> 12) / 0xF) * 0xFF;
297 amtRed = (((source & 0xF00) >> 8) / 0xF) * 0xFF;
298 amtGreen = (((source & 0xF0) >> 4) / 0xF) * 0xFF;
299 amtBlue = ((source & 0xF) / 0xF) * 0xFF;
301 else if (srcFormat == Bits16_Rgb565)
303 amtRed = (((source & 0xF800) >> 11) / 0x1F) * 0xFF;
304 amtGreen = (((source & 0x7E0) >> 5) / 0x3F) * 0xFF;
305 amtBlue = ((source & 0x1F) / 0x1F) * 0xFF;
307 else if (srcFormat == Bits16_Rgb555)
309 amtRed = (((source & 0xF800) >> 10) / 0x1F) * 0xFF;
310 amtGreen = (((source & 0x3E0) >> 5) / 0x1F) * 0xFF;
311 amtBlue = ((source & 0x1F) / 0x1F) * 0xFF;
313 else if (srcFormat == Bits8_Rgb332)
315 amtRed = (((source & 0xE0) >> 5) / 0x7) * 0xFF;
316 amtGreen = (((source & 0x1C) >> 2) / 0x7) * 0xFF;
317 amtBlue = ((source & 0x3) / 0x3) * 0xFF;
325 (amtAlpha << 24) | (amtRed << 16) | (amtGreen << 8) | amtBlue;
329 (amtRed << 24) | (amtGreen << 16) | (amtBlue << 8) | amtAlpha;
332 dest = (amtRed << 16) | (amtGreen << 8) | amtBlue;
335 dest = (amtRed << 16) | (amtGreen << 8) | amtBlue;
338 dest = (amtBlue << 16) | (amtGreen << 8) | amtRed;
346 dest = (amtRed << 10) | (amtGreen << 5) | (amtBlue);
354 dest = (amtRed << 11) | (amtGreen << 5) | (amtBlue);
364 (amtAlpha << 12) | (amtRed << 8) | (amtGreen << 4) | (amtBlue);
374 dest = (amtRed << 5) | (amtGreen << 2) | amtBlue;
GraphicsProvider getProvider()
size_t contextId
For sharing framebuffers across process boundaries.