JANITORIAL: Fix code formatting

This commit is contained in:
Eugene Sandulenko 2023-12-19 14:51:01 +01:00
parent 6ebbf46718
commit 8e1b2130a9
3 changed files with 12 additions and 23 deletions

View File

@ -68,8 +68,7 @@ void GrBuff::alloc_pixmap() {
pixmap = NewHandle(pitch * height, "pixmap");
if (!pixmap) {
term_message("GrBuff::alloc_pixmap(): Trying to free up %d bytes", pitch * height);
if (MakeMem(pitch * height, "pixmap"))
{
if (MakeMem(pitch * height, "pixmap")) {
pixmap = NewHandle(pitch * height, "pixmap");
if (!pixmap)
error_show(FL, 15, "pixmap h:%d w:%d bytes:%d", height, pitch, pitch * height);
@ -82,8 +81,7 @@ void GrBuff::alloc_pixmap() {
}
uint8 *GrBuff::get_pixmap() {
if (pixmap)
{
if (pixmap) {
lock();
return (uint8 *)*pixmap;
}
@ -91,8 +89,7 @@ uint8 *GrBuff::get_pixmap() {
}
Buffer *GrBuff::get_buffer() {
if (pixmap)
{
if (pixmap) {
lock();
dummy.data = (uint8 *)*pixmap;
dummy.w = w;
@ -109,7 +106,6 @@ void GrBuff::refresh_video(int32 scrnX, int32 scrnY, int32 x1, int32 y1, int32 x
vmng_refresh_video(scrnX, scrnY, x1, y1, x2, y2, get_buffer());
}
int32 gr_buffer_free(Buffer *buf) {
buf->w = buf->h = buf->stride = 0;
@ -155,11 +151,11 @@ int32 gr_buffer_init(Buffer *buf, const char *name, int32 w, int32 h) {
memset(buf->data, 0, buf->stride * h);
return(true);
return (true);
}
bool gr_buffer_rect_copy_2(const Buffer *from, Buffer *to, int32 sx, int32 sy,
int32 dx, int32 dy, int32 w, int32 h) {
int32 dx, int32 dy, int32 w, int32 h) {
// stupid check for no data
if (!from || !to || !from->data || !to->data)
error_show(FL, 'BUF!', "buff_rect_copy2");

View File

@ -58,17 +58,13 @@ static uint8 scale_sprite(Buffer *S, Buffer *D, uint32 ScaleX, uint32 ScaleY) {
error_show(FL, 'OOM!', "scaled buffer h:%uld w:%uld", D->h, D->stride);
ErrY = 50;
for (i = 0; i < S->h; ++i)
{
for (i = 0; i < S->h; ++i) {
ErrY += ScaleY;
while (ErrY >= 100)
{
while (ErrY >= 100) {
ErrX = 50;
for (j = 0; j < S->w; ++j)
{
for (j = 0; j < S->w; ++j) {
ErrX += ScaleX;
while (ErrX >= 100)
{
while (ErrX >= 100) {
*pScaled++ = *pData;
ErrX -= 100;
}

View File

@ -42,12 +42,10 @@ enum {
static RenderResult skip_RLE8_line() {
uint8 *from = _GR(sourceAddress);
for (;;)
{
for (;;) {
if (*from++)
++from;
else if (*from++ <= kJumpXY)
{
else if (*from++ <= kJumpXY) {
_GR(sourceAddress) = from;
return (RenderResult)(*(from - 1));
} else
@ -342,8 +340,7 @@ static RenderResult r_4() {
int32 PixelPos = _GR(StartingPixelPos);
long Inc = _GR(Increment);
for (;;)
{
for (;;) {
#ifdef OPTIMIZE_CLIP
if (Inc == 1) {
if (PixelPos >= _GR(RightPorch)) {