comment some debugging printf.
[pcsx_rearmed.git] / plugins / dfxvideo / draw_pl.c
CommitLineData
b60f2812 1/*
76f7048e 2 * (C) notaz, 2010-2011
b60f2812 3 *
4 * This work is licensed under the terms of the GNU GPLv2 or later.
5 * See the COPYING file in the top-level directory.
6 */
7
8#define _IN_DRAW
9
b60f2812 10#include "gpu.h"
b60f2812 11
e64dc4c5 12#include "../../frontend/plugin_lib.h"
da710571 13#include "pcnt.h"
b60f2812 14
15// misc globals
b60f2812 16long lLowerpart;
b60f2812 17BOOL bCheckMask = FALSE;
a96a5eb2 18unsigned short sSetMask;
19unsigned long lSetMask;
b60f2812 20
fa56d360 21static void blit(void)
b60f2812 22{
69f0df9c 23 int px = PSXDisplay.DisplayPosition.x & ~1; // XXX: align needed by bgr*_to_...
16f7d5e7 24 int py = PSXDisplay.DisplayPosition.y;
b60f2812 25 int w = PreviousPSXDisplay.Range.x1;
26 int h = PreviousPSXDisplay.DisplayMode.y;
16f7d5e7 27 unsigned short *srcs = psxVuw + py * 1024 + px;
b60f2812 28
a327967e 29 if (w <= 0)
30 return;
31
b60f2812 32 // account for centering
33 h -= PreviousPSXDisplay.Range.y0;
fa56d360 34
35 rcbs->pl_vout_flip(srcs, 1024, PSXDisplay.RGB24, w, h);
b60f2812 36}
37
b60f2812 38void DoBufferSwap(void)
39{
f2019b6e 40 static int fbw, fbh, fb24bpp;
72228559 41
16f7d5e7 42 if (PreviousPSXDisplay.DisplayMode.x == 0 || PreviousPSXDisplay.DisplayMode.y == 0)
b60f2812 43 return;
44
d352cde2 45 /* careful if rearranging this code, we try to set mode and flip
46 * to get the hardware apply both changes at the same time */
16f7d5e7 47 if (PreviousPSXDisplay.DisplayMode.x != fbw || PreviousPSXDisplay.DisplayMode.y != fbh
f2019b6e 48 || PSXDisplay.RGB24 != fb24bpp) {
16f7d5e7 49 fbw = PreviousPSXDisplay.DisplayMode.x;
50 fbh = PreviousPSXDisplay.DisplayMode.y;
b60f2812 51 fb24bpp = PSXDisplay.RGB24;
e4c83ca6 52 rcbs->pl_vout_set_mode(fbw, fbh, fbw, fbh, fb24bpp ? 24 : 16);
b60f2812 53 }
54
72228559 55 pcnt_start(PCNT_BLIT);
fa56d360 56 blit();
72228559 57 pcnt_end(PCNT_BLIT);
b60f2812 58}
59
a96a5eb2 60void DoClearScreenBuffer(void)
b60f2812 61{
62}
63
b60f2812 64unsigned long ulInitDisplay(void)
65{
76f7048e 66 if (rcbs->pl_vout_open() != 0)
b60f2812 67 return 0;
68
69 return 1; /* ok */
70}
71
72void CloseDisplay(void)
73{
76f7048e 74 rcbs->pl_vout_close();
b60f2812 75}