2003-01-19 23:14:22 +03:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Copyright (c) 2001-2003, OpenBeOS
|
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
// copy of this software and associated documentation files (the "Software"),
|
|
|
|
// to deal in the Software without restriction, including without limitation
|
|
|
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
// and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
// Software is furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
// DEALINGS IN THE SOFTWARE.
|
|
|
|
//
|
|
|
|
// File Name: AccelerantDriver.cpp
|
|
|
|
// Author: Gabe Yoder <gyoder@stny.rr.com>
|
|
|
|
// Description: A display driver which works directly with the
|
|
|
|
// accelerant for the graphics card.
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
#include "AccelerantDriver.h"
|
|
|
|
#include "ServerCursor.h"
|
|
|
|
#include "ServerBitmap.h"
|
2003-02-01 23:42:02 +03:00
|
|
|
#include "LayerData.h"
|
2003-01-19 23:14:22 +03:00
|
|
|
#include <FindDirectory.h>
|
|
|
|
#include <graphic_driver.h>
|
|
|
|
#include <malloc.h>
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Sets up internal variables needed by AccelerantDriver
|
|
|
|
|
|
|
|
*/
|
|
|
|
AccelerantDriver::AccelerantDriver(void) : DisplayDriver()
|
|
|
|
{
|
|
|
|
//drawmode = DRAW_COPY;
|
|
|
|
drawmode = 0;
|
|
|
|
|
|
|
|
cursor=NULL;
|
|
|
|
under_cursor=NULL;
|
|
|
|
cursorframe.Set(0,0,0,0);
|
|
|
|
|
|
|
|
card_fd = -1;
|
|
|
|
accelerant_image = -1;
|
|
|
|
// accelerant_hook = NULL;
|
|
|
|
mode_list = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Deletes the heap memory used by the AccelerantDriver
|
|
|
|
|
|
|
|
*/
|
|
|
|
AccelerantDriver::~AccelerantDriver(void)
|
|
|
|
{
|
|
|
|
if (cursor)
|
|
|
|
delete cursor;
|
|
|
|
if (under_cursor)
|
|
|
|
delete under_cursor;
|
|
|
|
if (mode_list)
|
|
|
|
free(mode_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Initializes the driver object.
|
|
|
|
\return true if successful, false if not
|
|
|
|
|
|
|
|
Initialize sets up the driver for display, including the initial clearing
|
|
|
|
of the screen. If things do not go as they should, false should be returned.
|
|
|
|
*/
|
|
|
|
bool AccelerantDriver::Initialize(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char signature[1024];
|
|
|
|
char path[PATH_MAX];
|
|
|
|
struct stat accelerant_stat;
|
|
|
|
const static directory_which dirs[] =
|
|
|
|
{
|
|
|
|
B_USER_ADDONS_DIRECTORY,
|
|
|
|
B_COMMON_ADDONS_DIRECTORY,
|
|
|
|
B_BEOS_ADDONS_DIRECTORY
|
|
|
|
};
|
|
|
|
|
|
|
|
//card_fd = open("/dev/graphics/1002_4755_000400",B_READ_WRITE);
|
|
|
|
card_fd = open("/dev/graphics/nv10_010000",B_READ_WRITE);
|
|
|
|
//card_fd = open("/dev/graphics/stub",B_READ_WRITE);
|
|
|
|
if ( card_fd < 0 )
|
2003-02-01 23:42:02 +03:00
|
|
|
{
|
|
|
|
printf("Failed to open graphics device\n");
|
2003-01-19 23:14:22 +03:00
|
|
|
return false;
|
2003-02-01 23:42:02 +03:00
|
|
|
}
|
|
|
|
|
2003-01-19 23:14:22 +03:00
|
|
|
if (ioctl(card_fd, B_GET_ACCELERANT_SIGNATURE, &signature, sizeof(signature)) != B_OK)
|
|
|
|
{
|
|
|
|
close(card_fd);
|
|
|
|
return false;
|
|
|
|
}
|
2003-02-01 23:42:02 +03:00
|
|
|
//printf("signature %s\n",signature);
|
|
|
|
|
2003-01-19 23:14:22 +03:00
|
|
|
accelerant_image = -1;
|
|
|
|
for (i=0; i<3; i++)
|
|
|
|
{
|
|
|
|
if (find_directory (dirs[i], -1, false, path, PATH_MAX) != B_OK)
|
|
|
|
continue;
|
|
|
|
strcat(path,"/accelerants/");
|
|
|
|
strcat(path,signature);
|
|
|
|
if (stat(path, &accelerant_stat) != 0)
|
|
|
|
continue;
|
|
|
|
accelerant_image = load_add_on(path);
|
|
|
|
if (accelerant_image >= 0)
|
|
|
|
{
|
|
|
|
if ( get_image_symbol(accelerant_image,B_ACCELERANT_ENTRY_POINT,
|
|
|
|
B_SYMBOL_TYPE_ANY,(void**)(&accelerant_hook)) != B_OK )
|
|
|
|
return false;
|
2003-02-01 23:42:02 +03:00
|
|
|
|
2003-01-19 23:14:22 +03:00
|
|
|
init_accelerant InitAccelerant;
|
|
|
|
InitAccelerant = (init_accelerant)accelerant_hook(B_INIT_ACCELERANT,NULL);
|
|
|
|
if (!InitAccelerant || (InitAccelerant(card_fd) != B_OK))
|
|
|
|
return false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (accelerant_image < 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
int mode_count;
|
|
|
|
accelerant_mode_count GetModeCount = (accelerant_mode_count)accelerant_hook(B_ACCELERANT_MODE_COUNT, NULL);
|
|
|
|
if ( !GetModeCount )
|
|
|
|
return false;
|
|
|
|
mode_count = GetModeCount();
|
|
|
|
if ( !mode_count )
|
|
|
|
return false;
|
|
|
|
get_mode_list GetModeList = (get_mode_list)accelerant_hook(B_GET_MODE_LIST, NULL);
|
|
|
|
if ( !GetModeList )
|
|
|
|
return false;
|
|
|
|
mode_list = (display_mode *)calloc(sizeof(display_mode), mode_count);
|
|
|
|
if ( !mode_list )
|
|
|
|
return false;
|
|
|
|
if ( GetModeList(mode_list) != B_OK )
|
|
|
|
return false;
|
2003-02-01 23:42:02 +03:00
|
|
|
|
|
|
|
#if 0
|
2003-01-19 23:14:22 +03:00
|
|
|
set_display_mode SetDisplayMode = (set_display_mode)accelerant_hook(B_SET_DISPLAY_MODE, NULL);
|
|
|
|
if ( !SetDisplayMode )
|
|
|
|
return false;
|
|
|
|
/* Use the first mode in the list */
|
|
|
|
if ( SetDisplayMode(mode_list) != B_OK )
|
|
|
|
return false;
|
2003-02-01 23:42:02 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
get_display_mode GetDisplayMode = (get_display_mode)accelerant_hook(B_GET_DISPLAY_MODE,NULL);
|
|
|
|
if ( !GetDisplayMode )
|
|
|
|
return false;
|
|
|
|
if ( GetDisplayMode(&mDisplayMode) != B_OK )
|
|
|
|
return FALSE;
|
|
|
|
//_SetDepth(mDisplayMode.space);
|
|
|
|
_SetWidth(mDisplayMode.virtual_width);
|
|
|
|
_SetHeight(mDisplayMode.virtual_height);
|
|
|
|
//_SetMode(mDisplayMode.flags); ???
|
|
|
|
|
|
|
|
|
2003-01-19 23:14:22 +03:00
|
|
|
get_frame_buffer_config GetFrameBufferConfig = (get_frame_buffer_config)accelerant_hook(B_GET_FRAME_BUFFER_CONFIG, NULL);
|
|
|
|
if ( !GetFrameBufferConfig )
|
|
|
|
return false;
|
|
|
|
if ( GetFrameBufferConfig(&mFrameBufferConfig) != B_OK )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Shuts down the driver's video subsystem
|
|
|
|
|
|
|
|
Any work done by Initialize() should be undone here. Note that Shutdown() is
|
|
|
|
called even if Initialize() was unsuccessful.
|
|
|
|
*/
|
|
|
|
void AccelerantDriver::Shutdown(void)
|
|
|
|
{
|
2003-02-03 03:53:16 +03:00
|
|
|
uninit_accelerant UninitAccelerant = (uninit_accelerant)accelerant_hook(B_UNINIT_ACCELERANT,NULL);
|
2003-01-19 23:14:22 +03:00
|
|
|
if ( UninitAccelerant )
|
|
|
|
UninitAccelerant();
|
|
|
|
if (accelerant_image >= 0)
|
|
|
|
unload_add_on(accelerant_image);
|
|
|
|
if (card_fd >= 0)
|
|
|
|
close(card_fd);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Called for all BView::CopyBits calls
|
2003-01-29 03:11:21 +03:00
|
|
|
\param src Source rectangle.
|
|
|
|
\param rect Destination rectangle.
|
2003-01-19 23:14:22 +03:00
|
|
|
|
|
|
|
Bounds checking must be done in this call. If the destination is not the same size
|
|
|
|
as the source, the source should be scaled to fit.
|
|
|
|
*/
|
|
|
|
void AccelerantDriver::CopyBits(BRect src, BRect dest)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Called for all BView::DrawBitmap calls
|
2003-01-29 03:11:21 +03:00
|
|
|
\param bmp Bitmap to be drawn. It will always be non-NULL and valid. The color
|
2003-01-19 23:14:22 +03:00
|
|
|
space is not guaranteed to match.
|
2003-01-29 03:11:21 +03:00
|
|
|
\param src Source rectangle
|
|
|
|
\param dest Destination rectangle. Source will be scaled to fit if not the same size.
|
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
2003-01-19 23:14:22 +03:00
|
|
|
|
|
|
|
Bounds checking must be done in this call.
|
|
|
|
*/
|
|
|
|
void AccelerantDriver::DrawBitmap(ServerBitmap *bmp, BRect src, BRect dest, LayerData *d)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Utilizes the font engine to draw a string to the frame buffer
|
2003-01-29 03:11:21 +03:00
|
|
|
\param string String to be drawn. Always non-NULL.
|
|
|
|
\param length Number of characters in the string to draw. Always greater than 0. If greater
|
2003-01-19 23:14:22 +03:00
|
|
|
than the number of characters in the string, draw the entire string.
|
2003-01-29 03:11:21 +03:00
|
|
|
\param pt Point at which the baseline starts. Characters are to be drawn 1 pixel above
|
2003-01-19 23:14:22 +03:00
|
|
|
this for backwards compatibility. While the point itself is guaranteed to be inside
|
|
|
|
the frame buffers coordinate range, the clipping of each individual glyph must be
|
|
|
|
performed by the driver itself.
|
2003-01-29 03:11:21 +03:00
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
\param delta Extra character padding
|
2003-01-19 23:14:22 +03:00
|
|
|
*/
|
|
|
|
void AccelerantDriver::DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *delta=NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Called for all BView::FillArc calls
|
2003-01-29 03:11:21 +03:00
|
|
|
\param r Rectangle enclosing the entire arc
|
|
|
|
\param angle Starting angle for the arc in degrees
|
|
|
|
\param span Span of the arc in degrees. Ending angle = angle+span.
|
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
\param pat 8-byte array containing the pattern to use. Always non-NULL.
|
2003-01-19 23:14:22 +03:00
|
|
|
|
|
|
|
Bounds checking must be done in this call because only part of the arc may end up
|
|
|
|
being clipped.
|
|
|
|
*/
|
|
|
|
void AccelerantDriver::FillArc(BRect r, float angle, float span, LayerData *d, int8 *pat)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Called for all BView::FillBezier calls.
|
2003-01-29 03:11:21 +03:00
|
|
|
\param pts 4-element array of BPoints in the order of start, end, and then the two control
|
2003-01-19 23:14:22 +03:00
|
|
|
points.
|
2003-01-29 03:11:21 +03:00
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
\param pat 8-byte array containing the pattern to use. Always non-NULL.
|
2003-01-19 23:14:22 +03:00
|
|
|
|
|
|
|
Bounds checking must be done in this call.
|
|
|
|
*/
|
|
|
|
void AccelerantDriver::FillBezier(BPoint *pts, LayerData *d, int8 *pat)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Called for all BView::FillEllipse calls
|
|
|
|
\param BRect enclosing the ellipse to be drawn.
|
2003-01-29 03:11:21 +03:00
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
\param pat 8-byte array containing the pattern to use. Always non-NULL.
|
2003-01-19 23:14:22 +03:00
|
|
|
|
|
|
|
Bounds checking must be done in this call because only part of the ellipse may end up
|
|
|
|
being clipped.
|
|
|
|
*/
|
|
|
|
void AccelerantDriver::FillEllipse(BRect r, LayerData *d, int8 *pat)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Called for all BView::FillPolygon calls
|
2003-01-29 03:11:21 +03:00
|
|
|
\param ptlist Array of BPoints defining the polygon.
|
|
|
|
\param numpts Number of points in the BPoint array.
|
|
|
|
\param rect Rectangle which contains the polygon
|
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
\param pat 8-byte array containing the pattern to use. Always non-NULL.
|
2003-01-19 23:14:22 +03:00
|
|
|
|
|
|
|
The points in the array are not guaranteed to be within the framebuffer's
|
|
|
|
coordinate range.
|
|
|
|
*/
|
|
|
|
void AccelerantDriver::FillPolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Called for all BView::FillRect calls
|
2003-01-29 03:11:21 +03:00
|
|
|
\param r BRect to be filled. Guaranteed to be in the frame buffer's coordinate space
|
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
\param pat 8-byte array containing the pattern to use. Always non-NULL.
|
2003-01-19 23:14:22 +03:00
|
|
|
|
|
|
|
*/
|
|
|
|
void AccelerantDriver::FillRect(BRect r, LayerData *d, int8 *pat)
|
|
|
|
{
|
2003-02-01 23:42:02 +03:00
|
|
|
/* Need to add check for possible hardware acceleration of this */
|
|
|
|
/* Need to deal with pattern */
|
|
|
|
_Lock();
|
|
|
|
|
|
|
|
switch (mDisplayMode.space)
|
|
|
|
{
|
|
|
|
case B_CMAP8:
|
|
|
|
{
|
|
|
|
} break;
|
|
|
|
case B_RGB16_BIG:
|
|
|
|
case B_RGB16_LITTLE:
|
|
|
|
case B_RGB15_BIG:
|
|
|
|
case B_RGBA15_BIG:
|
|
|
|
case B_RGB15_LITTLE:
|
|
|
|
case B_RGBA15_LITTLE:
|
|
|
|
{
|
|
|
|
} break;
|
|
|
|
case B_RGB32_BIG:
|
|
|
|
case B_RGBA32_BIG:
|
|
|
|
case B_RGB32_LITTLE:
|
|
|
|
case B_RGBA32_LITTLE:
|
|
|
|
{
|
|
|
|
uint32 *fb = (uint32 *)((uint8 *)mFrameBufferConfig.frame_buffer + (int)r.top*mFrameBufferConfig.bytes_per_row);
|
|
|
|
int x,y;
|
|
|
|
rgb_color color = d->highcolor.GetColor32();
|
|
|
|
uint32 drawcolor = (color.alpha << 24) | (color.red << 16) | (color.green << 8) | (color.blue);
|
|
|
|
for (y=(int)r.top; y<=(int)r.bottom; y++)
|
|
|
|
{
|
|
|
|
for (x=(int)r.left; x<=r.right; x++)
|
|
|
|
{
|
|
|
|
fb[x] = drawcolor;
|
|
|
|
}
|
|
|
|
fb = (uint32 *)((uint8 *)fb + mFrameBufferConfig.bytes_per_row);
|
|
|
|
}
|
|
|
|
} break;
|
|
|
|
default:
|
|
|
|
printf("Error: Unknown color space\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
_Unlock();
|
2003-01-19 23:14:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Called for all BView::FillRoundRect calls
|
2003-01-29 03:11:21 +03:00
|
|
|
\param r Rectangle to fill
|
2003-01-19 23:14:22 +03:00
|
|
|
\param X radius of the corner arcs
|
|
|
|
\param Y radius of the corner arcs
|
2003-01-29 03:11:21 +03:00
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
\param pat 8-byte array containing the pattern to use. Always non-NULL.
|
2003-01-19 23:14:22 +03:00
|
|
|
|
|
|
|
Bounds checking must be done in this call because only part of the roundrect may end
|
|
|
|
up being clipped.
|
|
|
|
*/
|
|
|
|
void AccelerantDriver::FillRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//void AccelerantDriver::FillShape(SShape *sh, LayerData *d, int8 *pat)
|
|
|
|
//{
|
|
|
|
//}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Called for all BView::FillTriangle calls
|
2003-01-29 03:11:21 +03:00
|
|
|
\param pts Array of 3 BPoints. Always non-NULL.
|
|
|
|
\param r BRect enclosing the triangle. While it will definitely enclose the triangle,
|
2003-01-19 23:14:22 +03:00
|
|
|
it may not be within the frame buffer's bounds.
|
2003-01-29 03:11:21 +03:00
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
\param pat 8-byte array containing the pattern to use. Always non-NULL.
|
2003-01-19 23:14:22 +03:00
|
|
|
|
|
|
|
Bounds checking must be done in this call because only part of the triangle may end
|
|
|
|
up being clipped.
|
|
|
|
*/
|
|
|
|
void AccelerantDriver::FillTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Hides the cursor.
|
|
|
|
|
|
|
|
Hide calls are not nestable, unlike that of the BApplication class. Subclasses should
|
|
|
|
call _SetCursorHidden(true) somewhere within this function to ensure that data is
|
|
|
|
maintained accurately.
|
|
|
|
*/
|
|
|
|
void AccelerantDriver::HideCursor(void)
|
|
|
|
{
|
2003-01-20 23:38:49 +03:00
|
|
|
// _SetCursorHidden(true);
|
2003-01-19 23:14:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Moves the cursor to the given point.
|
2003-01-29 03:11:21 +03:00
|
|
|
\param x Cursor's new x coordinate
|
|
|
|
\param y Cursor's new y coordinate
|
2003-01-19 23:14:22 +03:00
|
|
|
|
|
|
|
The coordinates passed to MoveCursorTo are guaranteed to be within the frame buffer's
|
|
|
|
range, but the cursor data itself will need to be clipped. A check to see if the
|
|
|
|
cursor is obscured should be made and if so, a call to _SetCursorObscured(false)
|
|
|
|
should be made the cursor in addition to displaying at the passed coordinates.
|
|
|
|
*/
|
|
|
|
void AccelerantDriver::MoveCursorTo(float x, float y)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Inverts the colors in the rectangle.
|
2003-01-29 03:11:21 +03:00
|
|
|
\param r Rectangle of the area to be inverted. Guaranteed to be within bounds.
|
2003-01-19 23:14:22 +03:00
|
|
|
*/
|
|
|
|
void AccelerantDriver::InvertRect(BRect r)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Shows the cursor.
|
|
|
|
|
|
|
|
Show calls are not nestable, unlike that of the BApplication class. Subclasses should
|
|
|
|
call _SetCursorHidden(false) somewhere within this function to ensure that data is
|
|
|
|
maintained accurately.
|
|
|
|
*/
|
|
|
|
void AccelerantDriver::ShowCursor(void)
|
|
|
|
{
|
2003-01-20 23:38:49 +03:00
|
|
|
//_SetCursorHidden(false);
|
2003-01-19 23:14:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Obscures the cursor.
|
|
|
|
|
|
|
|
Obscure calls are not nestable. Subclasses should call _SetCursorObscured(true)
|
|
|
|
somewhere within this function to ensure that data is maintained accurately. When the
|
|
|
|
next call to MoveCursorTo() is made, the cursor will be shown again.
|
|
|
|
*/
|
|
|
|
void AccelerantDriver::ObscureCursor(void)
|
|
|
|
{
|
2003-01-20 23:38:49 +03:00
|
|
|
//_SetCursorObscured(true);
|
2003-01-19 23:14:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Changes the cursor.
|
2003-01-29 03:11:21 +03:00
|
|
|
\param cursor The new cursor. Guaranteed to be non-NULL.
|
2003-01-19 23:14:22 +03:00
|
|
|
|
|
|
|
The driver does not take ownership of the given cursor. Subclasses should make
|
|
|
|
a copy of the cursor passed to it. The default version of this function hides the
|
|
|
|
cursor, replaces it, and shows the cursor if previously visible.
|
|
|
|
*/
|
|
|
|
void AccelerantDriver::SetCursor(ServerCursor *cursor)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-01-29 03:11:21 +03:00
|
|
|
/*!
|
|
|
|
\brief Called for all BView::StrokeArc calls
|
|
|
|
\param r Rectangle enclosing the entire arc
|
|
|
|
\param angle Starting angle for the arc in degrees
|
|
|
|
\param span Span of the arc in degrees. Ending angle = angle+span.
|
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
\param pat 8-byte array containing the pattern to use. Always non-NULL.
|
|
|
|
|
|
|
|
Bounds checking must be done in this call because only part of the arc may end up
|
|
|
|
being clipped.
|
|
|
|
*/void AccelerantDriver::StrokeArc(BRect r, float angle, float span, LayerData *d, int8 *pat)
|
2003-01-19 23:14:22 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-01-29 03:11:21 +03:00
|
|
|
/*!
|
|
|
|
\brief Called for all BView::StrokeBezier calls.
|
|
|
|
\param pts 4-element array of BPoints in the order of start, end, and then the two control
|
|
|
|
points.
|
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
\param pat 8-byte array containing the pattern to use. Always non-NULL.
|
|
|
|
|
|
|
|
Bounds checking must be done in this call.
|
|
|
|
*/
|
2003-01-19 23:14:22 +03:00
|
|
|
void AccelerantDriver::StrokeBezier(BPoint *pts, LayerData *d, int8 *pat)
|
|
|
|
{
|
2003-02-03 03:53:16 +03:00
|
|
|
/* Need to add bounds checking code */
|
|
|
|
/* Probably should check to make sure that we have at least 4 points */
|
|
|
|
double Ax, Bx, Cx, Dx;
|
|
|
|
double Ay, By, Cy, Dy;
|
|
|
|
int x, y;
|
|
|
|
int lastx=-1, lasty=-1;
|
|
|
|
double t;
|
|
|
|
double dt = .001;
|
|
|
|
double dt2, dt3;
|
|
|
|
double X, Y, dx, ddx, dddx, dy, ddy, dddy;
|
|
|
|
|
|
|
|
Ax = -pts[0].x + 3*pts[1].x - 3*pts[2].x + pts[3].x;
|
|
|
|
Bx = 3*pts[0].x - 6*pts[1].x + 3*pts[2].x;
|
|
|
|
Cx = -3*pts[0].x + 3*pts[1].x;
|
|
|
|
Dx = pts[0].x;
|
|
|
|
|
|
|
|
Ay = -pts[0].y + 3*pts[1].y - 3*pts[2].y + pts[3].y;
|
|
|
|
By = 3*pts[0].y - 6*pts[1].y + 3*pts[2].y;
|
|
|
|
Cy = -3*pts[0].y + 3*pts[1].y;
|
|
|
|
Dy = pts[0].y;
|
|
|
|
|
|
|
|
dt2 = dt * dt;
|
|
|
|
dt3 = dt2 * dt;
|
|
|
|
X = Dx;
|
|
|
|
dx = Ax*dt3 + Bx*dt2 + Cx*dt;
|
|
|
|
ddx = 6*Ax*dt3 + 2*Bx*dt2;
|
|
|
|
dddx = 6*Ax*dt3;
|
|
|
|
Y = Dy;
|
|
|
|
dy = Ay*dt3 + By*dt2 + Cy*dt;
|
|
|
|
ddy = 6*Ay*dt3 + 2*By*dt2;
|
|
|
|
dddy = 6*Ay*dt3;
|
|
|
|
|
|
|
|
lastx = -1;
|
|
|
|
lasty = -1;
|
|
|
|
|
|
|
|
for (t=0; t<=1; t+=dt)
|
|
|
|
{
|
|
|
|
x = ROUND(X);
|
|
|
|
y = ROUND(Y);
|
|
|
|
if ( (x!=lastx) || (y!=lasty) )
|
|
|
|
SetThickPixel(x,y,d->pensize,d->highcolor);
|
|
|
|
lastx = x;
|
|
|
|
lasty = y;
|
|
|
|
|
|
|
|
X += dx;
|
|
|
|
dx += ddx;
|
|
|
|
ddx += dddx;
|
|
|
|
Y += dy;
|
|
|
|
dy += ddy;
|
|
|
|
ddy += dddy;
|
|
|
|
}
|
2003-01-19 23:14:22 +03:00
|
|
|
}
|
|
|
|
|
2003-01-29 03:11:21 +03:00
|
|
|
/*!
|
|
|
|
\brief Called for all BView::StrokeEllipse calls
|
|
|
|
\param r BRect enclosing the ellipse to be drawn.
|
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
\param pat 8-byte array containing the pattern to use. Always non-NULL.
|
|
|
|
|
|
|
|
Bounds checking must be done in this call because only part of the ellipse may end up
|
|
|
|
being clipped.
|
|
|
|
*/
|
2003-01-19 23:14:22 +03:00
|
|
|
void AccelerantDriver::StrokeEllipse(BRect r, LayerData *d, int8 *pat)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-01-29 03:11:21 +03:00
|
|
|
/*!
|
|
|
|
\brief Draws a line. Really.
|
|
|
|
\param start Starting point
|
|
|
|
\param end Ending point
|
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
\param pat 8-byte array containing the pattern to use. Always non-NULL.
|
|
|
|
|
|
|
|
The endpoints themselves are guaranteed to be in bounds, but clipping for lines with
|
|
|
|
a thickness greater than 1 will need to be done.
|
|
|
|
*/
|
2003-01-19 23:14:22 +03:00
|
|
|
void AccelerantDriver::StrokeLine(BPoint start, BPoint end, LayerData *d, int8 *pat)
|
|
|
|
{
|
2003-02-03 03:53:16 +03:00
|
|
|
_Lock();
|
|
|
|
int x1 = ROUND(start.x);
|
|
|
|
int y1 = ROUND(start.y);
|
|
|
|
int x2 = ROUND(end.x);
|
|
|
|
int y2 = ROUND(end.y);
|
|
|
|
int dx = x2 - x1;
|
|
|
|
int dy = y2 - y1;
|
|
|
|
int steps, k;
|
|
|
|
double xInc, yInc;
|
|
|
|
double x = x1;
|
|
|
|
double y = y1;
|
|
|
|
|
|
|
|
if ( abs(dx) > abs(dy) )
|
|
|
|
steps = abs(dx);
|
|
|
|
else
|
|
|
|
steps = abs(dy);
|
|
|
|
xInc = dx / (double) steps;
|
|
|
|
yInc = dy / (double) steps;
|
|
|
|
|
|
|
|
SetPixel(ROUND(x),ROUND(y),d->highcolor);
|
|
|
|
for (k=0; k<steps; k++)
|
|
|
|
{
|
|
|
|
x += xInc;
|
|
|
|
y += yInc;
|
|
|
|
SetPixel(ROUND(x),ROUND(y),d->highcolor);
|
|
|
|
}
|
|
|
|
_Unlock();
|
2003-01-19 23:14:22 +03:00
|
|
|
}
|
|
|
|
|
2003-01-29 03:11:21 +03:00
|
|
|
/*!
|
|
|
|
\brief Called for all BView::StrokePolygon calls
|
|
|
|
\param ptlist Array of BPoints defining the polygon.
|
|
|
|
\param numpts Number of points in the BPoint array.
|
|
|
|
\param rect Rectangle which contains the polygon
|
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
\param pat 8-byte array containing the pattern to use. Always non-NULL.
|
|
|
|
|
|
|
|
The points in the array are not guaranteed to be within the framebuffer's
|
|
|
|
coordinate range.
|
|
|
|
*/
|
2003-01-19 23:14:22 +03:00
|
|
|
void AccelerantDriver::StrokePolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat, bool is_closed=true)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-01-29 03:11:21 +03:00
|
|
|
/*!
|
|
|
|
\brief Called for all BView::StrokeRect calls
|
|
|
|
\param r BRect to be filled. Guaranteed to be in the frame buffer's coordinate space
|
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
\param pat 8-byte array containing the pattern to use. Always non-NULL.
|
|
|
|
|
|
|
|
*/
|
2003-01-19 23:14:22 +03:00
|
|
|
void AccelerantDriver::StrokeRect(BRect r, LayerData *d, int8 *pat)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-01-29 03:11:21 +03:00
|
|
|
/*!
|
|
|
|
\brief Called for all BView::StrokeRoundRect calls
|
|
|
|
\param r The rect itself
|
|
|
|
\param xrad X radius of the corner arcs
|
|
|
|
\param yrad Y radius of the corner arcs
|
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
\param pat 8-byte array containing the pattern to use. Always non-NULL.
|
|
|
|
|
|
|
|
Bounds checking must be done in this call because only part of the roundrect may end
|
|
|
|
up being clipped.
|
|
|
|
*/
|
2003-01-19 23:14:22 +03:00
|
|
|
void AccelerantDriver::StrokeRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//void AccelerantDriver::StrokeShape(SShape *sh, LayerData *d, int8 *pat)
|
|
|
|
//{
|
|
|
|
//}
|
|
|
|
|
2003-01-29 03:11:21 +03:00
|
|
|
/*!
|
|
|
|
\brief Called for all BView::StrokeTriangle calls
|
|
|
|
\param pts Array of 3 BPoints. Always non-NULL.
|
|
|
|
\param r BRect enclosing the triangle. While it will definitely enclose the triangle,
|
|
|
|
it may not be within the frame buffer's bounds.
|
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
\param pat 8-byte array containing the pattern to use. Always non-NULL.
|
|
|
|
|
|
|
|
Bounds checking must be done in this call because only part of the triangle may end
|
|
|
|
up being clipped.
|
|
|
|
*/
|
2003-01-19 23:14:22 +03:00
|
|
|
void AccelerantDriver::StrokeTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-01-29 03:11:21 +03:00
|
|
|
/*!
|
|
|
|
\brief Draws a series of lines - optimized for speed
|
|
|
|
\param pts Array of BPoints pairs
|
|
|
|
\param numlines Number of lines to be drawn
|
|
|
|
\param colors Array of colors for each respective line
|
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
|
|
|
|
Data for this call is passed directly from userland - this call is responsible for all
|
|
|
|
checking. All lines are to be processed in the call using the same LayerData settings
|
|
|
|
for each line.
|
|
|
|
*/
|
2003-01-19 23:14:22 +03:00
|
|
|
void AccelerantDriver::StrokeLineArray(BPoint *pts, int32 numlines, RGBColor *colors, LayerData *d)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-01-29 03:11:21 +03:00
|
|
|
/*!
|
|
|
|
\brief Sets the screen mode to specified resolution and color depth.
|
|
|
|
\param mode constant as defined in GraphicsDefs.h
|
|
|
|
|
|
|
|
Subclasses must include calls to _SetDepth, _SetHeight, _SetWidth, and _SetMode
|
|
|
|
to update the state variables kept internally by the DisplayDriver class.
|
|
|
|
*/
|
2003-01-19 23:14:22 +03:00
|
|
|
void AccelerantDriver::SetMode(int32 mode)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-01-29 03:11:21 +03:00
|
|
|
/*!
|
|
|
|
\brief Dumps the contents of the frame buffer to a file.
|
|
|
|
\param path Path and leaf of the file to be created without an extension
|
|
|
|
\return False if unimplemented or unsuccessful. True if otherwise.
|
|
|
|
|
|
|
|
Subclasses should add an extension based on what kind of file is saved
|
|
|
|
*/
|
2003-01-19 23:14:22 +03:00
|
|
|
bool AccelerantDriver::DumpToFile(const char *path)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2003-01-29 03:11:21 +03:00
|
|
|
/*!
|
|
|
|
\brief Gets the width of a string in pixels
|
|
|
|
\param string Source null-terminated string
|
|
|
|
\param length Number of characters in the string
|
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
\return Width of the string in pixels
|
|
|
|
|
|
|
|
This corresponds to BView::StringWidth.
|
|
|
|
*/
|
2003-01-19 23:14:22 +03:00
|
|
|
float AccelerantDriver::StringWidth(const char *string, int32 length, LayerData *d)
|
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
2003-01-29 03:11:21 +03:00
|
|
|
/*!
|
|
|
|
\brief Gets the height of a string in pixels
|
|
|
|
\param string Source null-terminated string
|
|
|
|
\param length Number of characters in the string
|
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
\return Height of the string in pixels
|
|
|
|
|
|
|
|
The height calculated in this function does not include any padding - just the
|
|
|
|
precise maximum height of the characters within and does not necessarily equate
|
|
|
|
with a font's height, i.e. the strings 'case' and 'alps' will have different values
|
|
|
|
even when called with all other values equal.
|
|
|
|
*/
|
2003-01-19 23:14:22 +03:00
|
|
|
float AccelerantDriver::StringHeight(const char *string, int32 length, LayerData *d)
|
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
2003-01-29 03:11:21 +03:00
|
|
|
/*!
|
|
|
|
\brief Retrieves the bounding box each character in the string
|
|
|
|
\param string Source null-terminated string
|
|
|
|
\param count Number of characters in the string
|
|
|
|
\param mode Metrics mode for either screen or printing
|
|
|
|
\param delta Optional glyph padding. This value may be NULL.
|
|
|
|
\param rectarray Array of BRect objects which will have at least count elements
|
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
|
|
|
|
See BFont::GetBoundingBoxes for more details on this function.
|
|
|
|
*/
|
|
|
|
void AccelerantDriver::GetBoundingBoxes(const char *string, int32 count,
|
|
|
|
font_metric_mode mode, escapement_delta *delta, BRect *rectarray, LayerData *d)
|
2003-01-19 23:14:22 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-01-29 03:11:21 +03:00
|
|
|
/*!
|
|
|
|
\brief Retrieves the escapements for each character in the string
|
|
|
|
\param string Source null-terminated string
|
|
|
|
\param charcount Number of characters in the string
|
|
|
|
\param delta Optional glyph padding. This value may be NULL.
|
|
|
|
\param escapements Array of escapement_delta objects which will have at least charcount elements
|
|
|
|
\param offsets Actual offset values when iterating over the string. This array will also
|
|
|
|
have at least charcount elements and the values placed therein will reflect
|
|
|
|
the current kerning/spacing mode.
|
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
|
|
|
|
See BFont::GetEscapements for more details on this function.
|
|
|
|
*/
|
|
|
|
void AccelerantDriver::GetEscapements(const char *string, int32 charcount,
|
|
|
|
escapement_delta *delta, escapement_delta *escapements, escapement_delta *offsets, LayerData *d)
|
2003-01-19 23:14:22 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-01-29 03:11:21 +03:00
|
|
|
/*!
|
|
|
|
\brief Retrieves the inset values of each glyph from its escapement values
|
|
|
|
\param string Source null-terminated string
|
|
|
|
\param charcount Number of characters in the string
|
|
|
|
\param edgearray Array of edge_info objects which will have at least charcount elements
|
|
|
|
\param d Data structure containing any other data necessary for the call. Always non-NULL.
|
|
|
|
|
|
|
|
See BFont::GetEdges for more details on this function.
|
|
|
|
*/
|
|
|
|
void AccelerantDriver::GetEdges(const char *string, int32 charcount, edge_info *edgearray, LayerData *d)
|
2003-01-19 23:14:22 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-01-29 03:11:21 +03:00
|
|
|
/*!
|
|
|
|
\brief Determines whether a font contains a certain string of characters
|
|
|
|
\param string Source null-terminated string
|
|
|
|
\param charcount Number of characters in the string
|
|
|
|
\param hasarray Array of booleans which will have at least charcount elements
|
|
|
|
|
|
|
|
See BFont::GetHasGlyphs for more details on this function.
|
|
|
|
*/
|
2003-01-19 23:14:22 +03:00
|
|
|
void AccelerantDriver::GetHasGlyphs(const char *string, int32 charcount, bool *hasarray)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-01-29 03:11:21 +03:00
|
|
|
/*!
|
|
|
|
\brief Truncates an array of strings to a certain width
|
|
|
|
\param instrings Array of null-terminated strings
|
|
|
|
\param stringcount Number of strings passed to the function
|
|
|
|
\param mode Truncation mode
|
|
|
|
\param maxwidth Maximum width for all strings
|
|
|
|
\param outstrings String array provided by the caller into which the truncated strings are
|
|
|
|
to be placed.
|
|
|
|
|
|
|
|
See BFont::GetTruncatedStrings for more details on this function.
|
|
|
|
*/
|
|
|
|
void AccelerantDriver::GetTruncatedStrings( const char **instrings, int32 stringcount,
|
|
|
|
uint32 mode, float maxwidth, char **outstrings)
|
2003-01-19 23:14:22 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-02-03 03:53:16 +03:00
|
|
|
void AccelerantDriver::SetPixel(int x, int y, RGBColor col)
|
|
|
|
{
|
|
|
|
switch (mDisplayMode.space)
|
|
|
|
{
|
|
|
|
case B_CMAP8:
|
|
|
|
{
|
|
|
|
} break;
|
|
|
|
case B_RGB16_BIG:
|
|
|
|
case B_RGB16_LITTLE:
|
|
|
|
case B_RGB15_BIG:
|
|
|
|
case B_RGBA15_BIG:
|
|
|
|
case B_RGB15_LITTLE:
|
|
|
|
case B_RGBA15_LITTLE:
|
|
|
|
{
|
|
|
|
} break;
|
|
|
|
case B_RGB32_BIG:
|
|
|
|
case B_RGBA32_BIG:
|
|
|
|
case B_RGB32_LITTLE:
|
|
|
|
case B_RGBA32_LITTLE:
|
|
|
|
{
|
|
|
|
uint32 *fb = (uint32 *)((uint8 *)mFrameBufferConfig.frame_buffer + y*mFrameBufferConfig.bytes_per_row);
|
|
|
|
rgb_color color = col.GetColor32();
|
|
|
|
fb[x] = (color.alpha << 24) | (color.red << 16) | (color.green << 8) | (color.blue);
|
|
|
|
} break;
|
|
|
|
default:
|
|
|
|
printf("Error: Unknown color space\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccelerantDriver::SetThickPixel(int x, int y, int thick, RGBColor col)
|
|
|
|
{
|
|
|
|
switch (mDisplayMode.space)
|
|
|
|
{
|
|
|
|
case B_CMAP8:
|
|
|
|
{
|
|
|
|
} break;
|
|
|
|
case B_RGB16_BIG:
|
|
|
|
case B_RGB16_LITTLE:
|
|
|
|
case B_RGB15_BIG:
|
|
|
|
case B_RGBA15_BIG:
|
|
|
|
case B_RGB15_LITTLE:
|
|
|
|
case B_RGBA15_LITTLE:
|
|
|
|
{
|
|
|
|
} break;
|
|
|
|
case B_RGB32_BIG:
|
|
|
|
case B_RGBA32_BIG:
|
|
|
|
case B_RGB32_LITTLE:
|
|
|
|
case B_RGBA32_LITTLE:
|
|
|
|
{
|
|
|
|
int i,j;
|
|
|
|
uint32 *fb = (uint32 *)((uint8 *)mFrameBufferConfig.frame_buffer + (y-thick/2)*mFrameBufferConfig.bytes_per_row) + x-thick/2;
|
|
|
|
rgb_color color = col.GetColor32();
|
|
|
|
uint32 drawcolor = (color.alpha << 24) | (color.red << 16) | (color.green << 8) | (color.blue);
|
|
|
|
for (i=0; i<thick; i++)
|
|
|
|
{
|
|
|
|
for (j=0; j<thick; j++)
|
|
|
|
{
|
|
|
|
fb[j] = drawcolor;
|
|
|
|
}
|
|
|
|
fb = (uint32 *)((uint8 *)fb + mFrameBufferConfig.bytes_per_row);
|
|
|
|
}
|
|
|
|
} break;
|
|
|
|
default:
|
|
|
|
printf("Error: Unknown color space\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccelerantDriver::HLine(int32 x1, int32 x2, int32 y, RGBColor col)
|
|
|
|
{
|
|
|
|
switch (mDisplayMode.space)
|
|
|
|
{
|
|
|
|
case B_CMAP8:
|
|
|
|
{
|
|
|
|
} break;
|
|
|
|
case B_RGB16_BIG:
|
|
|
|
case B_RGB16_LITTLE:
|
|
|
|
case B_RGB15_BIG:
|
|
|
|
case B_RGBA15_BIG:
|
|
|
|
case B_RGB15_LITTLE:
|
|
|
|
case B_RGBA15_LITTLE:
|
|
|
|
{
|
|
|
|
} break;
|
|
|
|
case B_RGB32_BIG:
|
|
|
|
case B_RGBA32_BIG:
|
|
|
|
case B_RGB32_LITTLE:
|
|
|
|
case B_RGBA32_LITTLE:
|
|
|
|
{
|
|
|
|
uint32 *fb = (uint32 *)((uint8 *)mFrameBufferConfig.frame_buffer + y*mFrameBufferConfig.bytes_per_row);
|
|
|
|
rgb_color color = col.GetColor32();
|
|
|
|
uint32 drawcolor = (color.alpha << 24) | (color.red << 16) | (color.green << 8) | (color.blue);
|
|
|
|
int x;
|
|
|
|
if ( x1 > x2 )
|
|
|
|
{
|
|
|
|
x = x2;
|
|
|
|
x2 = x1;
|
|
|
|
x1 = x;
|
|
|
|
}
|
|
|
|
for (x=x1; x<x2; x++)
|
|
|
|
fb[x] = drawcolor;
|
|
|
|
} break;
|
|
|
|
default:
|
|
|
|
printf("Error: Unknown color space\n");
|
|
|
|
}
|
|
|
|
}
|