/* photon_clear_to_color: * Accelerated screen clear routine. */ static void photon_clear_to_color(BITMAP *bmp, int color) { struct Ph_rect dest_rect = { { bmp->cl + bmp->x_ofs, bmp->ct + bmp->y_ofs }, { bmp->x_ofs + bmp->cr, bmp->y_ofs + bmp->cb } }; struct BITMAP *parent; /* find parent */ parent = bmp; while (parent->id & BMP_ID_SUB) parent = (BITMAP *)parent->extra; /* set fill color */ /* if (bmp->vtable->color_depth == 8) PgSetFillColor(color); else */ PgSetFillColor(PgRGB(getr(color), getg(color), getb(color))); PhDCSetCurrent(BMP_EXTRA(parent)->context); PgDrawRect(&dest_rect, Pg_DRAW_FILL); if (parent == pseudo_screen) ph_update_window(&dest_rect); else PgFlush(); }
/* photon_rectfill: * Accelerated rectangle fill routine. */ static void photon_rectfill(BITMAP *bmp, int x1, int y1, int x2, int y2, int color) { struct Ph_rect dest_rect; struct BITMAP *parent; if (_drawing_mode != DRAW_MODE_SOLID) { _orig_rectfill(bmp, x1, y1, x2, y2, color); return; } if (x2 < x1) { int tmp = x1; x1 = x2; x2 = tmp; } if (y2 < y1) { int tmp = y1; y1 = y2; y2 = tmp; } if (bmp->clip) { if (x1 < bmp->cl) x1 = bmp->cl; if (x2 >= bmp->cr) x2 = bmp->cr-1; if (x2 < x1) return; if (y1 < bmp->ct) y1 = bmp->ct; if (y2 >= bmp->cb) y2 = bmp->cb-1; if (y2 < y1) return; } dest_rect.ul.x = x1 + bmp->x_ofs; dest_rect.ul.y = y1 + bmp->y_ofs; dest_rect.lr.x = x2 + bmp->x_ofs; dest_rect.lr.y = y2 + bmp->y_ofs; /* find parent */ parent = bmp; while (parent->id & BMP_ID_SUB) parent = (BITMAP *)parent->extra; /* set fill color */ /* if (bmp->vtable->color_depth == 8) PgSetFillColor(color); else */ PgSetFillColor(PgRGB(getr(color), getg(color), getb(color))); PhDCSetCurrent(BMP_EXTRA(parent)->context); PgDrawRect(&dest_rect, Pg_DRAW_FILL); if (parent == pseudo_screen) ph_update_window(&dest_rect); else PgFlush(); }
int ph_DisplayYUVOverlay(_THIS, SDL_Overlay* overlay, SDL_Rect* src, SDL_Rect* dst) { int rtncode; PhPoint_t pos; SDL_Rect backrect; PhRect_t windowextent; int winchanged=0; if ((overlay == NULL) || (overlay->hwdata==NULL)) { return -1; } if (overlay->hwdata->State == OVERLAY_STATE_UNINIT) { return -1; } PtGetAbsPosition(window, &pos.x, &pos.y); if ((pos.x!=overlay->hwdata->CurrentWindowPos.x) || (pos.y!=overlay->hwdata->CurrentWindowPos.y)) { winchanged=1; overlay->hwdata->CurrentWindowPos.x=pos.x; overlay->hwdata->CurrentWindowPos.y=pos.y; } /* If CurrentViewPort position/size has been changed, then move/resize the viewport */ if ((overlay->hwdata->CurrentViewPort.pos.x != dst->x) || (overlay->hwdata->CurrentViewPort.pos.y != dst->y) || (overlay->hwdata->CurrentViewPort.size.w != dst->w) || (overlay->hwdata->CurrentViewPort.size.h != dst->h) || (overlay->hwdata->scaler_on==0) || (winchanged==1) || (overlay->hwdata->forcedredraw==1)) { if (overlay->hwdata->ischromakey==1) { /* restore screen behind the overlay/chroma color. */ backrect.x=overlay->hwdata->CurrentViewPort.pos.x; backrect.y=overlay->hwdata->CurrentViewPort.pos.y; backrect.w=overlay->hwdata->CurrentViewPort.size.w; backrect.h=overlay->hwdata->CurrentViewPort.size.h; this->UpdateRects(this, 1, &backrect); /* Draw the new rectangle of the chroma color at the viewport position */ PgSetFillColor(overlay->hwdata->chromakey); PgDrawIRect(dst->x, dst->y, dst->x+dst->w-1, dst->y+dst->h-1, Pg_DRAW_FILL); PgFlush(); } overlay->hwdata->props.flags |= Pg_SCALER_PROP_SCALER_ENABLE; overlay->hwdata->scaler_on = 1; PhWindowQueryVisible(Ph_QUERY_CONSOLE, 0, PtWidgetRid(window), &windowextent); overlay->hwdata->CurrentViewPort.pos.x = pos.x-windowextent.ul.x+dst->x; overlay->hwdata->CurrentViewPort.pos.y = pos.y-windowextent.ul.y+dst->y; overlay->hwdata->CurrentViewPort.size.w = dst->w; overlay->hwdata->CurrentViewPort.size.h = dst->h; PhAreaToRect(&overlay->hwdata->CurrentViewPort, &overlay->hwdata->props.viewport); overlay->hwdata->CurrentViewPort.pos.x = dst->x; overlay->hwdata->CurrentViewPort.pos.y = dst->y; rtncode = PgConfigScalerChannel(overlay->hwdata->channel, &(overlay->hwdata->props)); switch(rtncode) { case -1: SDL_SetError("PgConfigScalerChannel() function failed\n"); SDL_FreeYUVOverlay(overlay); return -1; case 1: grab_ptrs2(overlay->hwdata->channel, overlay->hwdata->FrameData0, overlay->hwdata->FrameData1); break; case 0: default: break; } } /* if (overlay->hwdata->locked==0) { overlay->hwdata->current = PgNextVideoFrame(overlay->hwdata->channel); if (overlay->hwdata->current == -1) { SDL_SetError("ph_LockYUVOverlay: PgNextFrame() failed, bailing out\n"); SDL_FreeYUVOverlay(overlay); return 0; } if (overlay->hwdata->current == 0) { overlay->hwdata->CurrentFrameData = overlay->hwdata->FrameData0; } else { overlay->hwdata->CurrentFrameData = overlay->hwdata->FrameData1; } if (overlay->planes > 0) { overlay->pitches[0] = overlay->hwdata->channel->yplane1->pitch; overlay->pixels[0] = overlay->hwdata->CurrentFrameData->Y; } if (overlay->planes > 1) { overlay->pitches[1] = overlay->hwdata->channel->uplane1->pitch; overlay->pixels[1] = overlay->hwdata->CurrentFrameData->U; } if (overlay->planes > 2) { overlay->pitches[2] = overlay->hwdata->channel->vplane1->pitch; overlay->pixels[2] = overlay->hwdata->CurrentFrameData->V; } } */ return 0; }