disable standalone pluign builds
[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
62d7fa95 12#include "../gpulib/cspace.h"
e64dc4c5 13#include "../../frontend/plugin_lib.h"
da710571 14#include "pcnt.h"
b60f2812 15
16// misc globals
b60f2812 17long lLowerpart;
b60f2812 18BOOL bCheckMask = FALSE;
a96a5eb2 19unsigned short sSetMask;
20unsigned long lSetMask;
b60f2812 21
fa56d360 22static void blit(void)
b60f2812 23{
69f0df9c 24 int px = PSXDisplay.DisplayPosition.x & ~1; // XXX: align needed by bgr*_to_...
16f7d5e7 25 int py = PSXDisplay.DisplayPosition.y;
b60f2812 26 int w = PreviousPSXDisplay.Range.x1;
27 int h = PreviousPSXDisplay.DisplayMode.y;
16f7d5e7 28 unsigned short *srcs = psxVuw + py * 1024 + px;
b60f2812 29
a327967e 30 if (w <= 0)
31 return;
32
b60f2812 33 // account for centering
34 h -= PreviousPSXDisplay.Range.y0;
fa56d360 35
36 rcbs->pl_vout_flip(srcs, 1024, PSXDisplay.RGB24, w, h);
b60f2812 37}
38
b60f2812 39void DoBufferSwap(void)
40{
f2019b6e 41 static int fbw, fbh, fb24bpp;
72228559 42
16f7d5e7 43 if (PreviousPSXDisplay.DisplayMode.x == 0 || PreviousPSXDisplay.DisplayMode.y == 0)
b60f2812 44 return;
45
d352cde2 46 /* careful if rearranging this code, we try to set mode and flip
47 * to get the hardware apply both changes at the same time */
16f7d5e7 48 if (PreviousPSXDisplay.DisplayMode.x != fbw || PreviousPSXDisplay.DisplayMode.y != fbh
f2019b6e 49 || PSXDisplay.RGB24 != fb24bpp) {
16f7d5e7 50 fbw = PreviousPSXDisplay.DisplayMode.x;
51 fbh = PreviousPSXDisplay.DisplayMode.y;
b60f2812 52 fb24bpp = PSXDisplay.RGB24;
e4c83ca6 53 rcbs->pl_vout_set_mode(fbw, fbh, fbw, fbh, fb24bpp ? 24 : 16);
b60f2812 54 }
55
72228559 56 pcnt_start(PCNT_BLIT);
fa56d360 57 blit();
72228559 58 pcnt_end(PCNT_BLIT);
b60f2812 59}
60
a96a5eb2 61void DoClearScreenBuffer(void)
b60f2812 62{
63}
64
b60f2812 65unsigned long ulInitDisplay(void)
66{
76f7048e 67 if (rcbs->pl_vout_open() != 0)
b60f2812 68 return 0;
69
70 return 1; /* ok */
71}
72
73void CloseDisplay(void)
74{
76f7048e 75 rcbs->pl_vout_close();
b60f2812 76}