?? ddraw.h
字號:
/* * Copyright (C) 2005-2007 gulikoza * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *//* $Id$ */#ifndef DDRAW_H#define DDRAW_H#define MODULE "DDraw"#if (HAVE_DDRAW_H)#include <ddraw.h>struct private_hwdata { LPDIRECTDRAWSURFACE3 dd_surface; LPDIRECTDRAWSURFACE3 dd_writebuf;};struct private_yuvhwdata { LPDIRECTDRAWSURFACE3 surface; Uint16 pitches[3]; Uint8 *planes[3];};class DDraw : public Output {private: char deint; Overlay * overlay;protected:public: DDraw():overlay(NULL) { ERROR_MSG("Created " MODULE " object"); } ~DDraw() { Free(); ERROR_MSG("Destroyed " MODULE " object"); } int Create(int w, int h, Uint32 f, SDL_Surface * s) { width = w; height = h; format = f; surface = s; h = h>>half; if(!(surface->flags&SDL_HWSURFACE)) { ERROR_MSG("Failed to create ddraw surface, back to normal overlay"); } overlay = new Overlay(); overlay->SetDeinterlace(deint); return (overlay->Create(w, h, f, s)); } void Free(void) { LOG_MSG("Freeing video surface"); if(overlay) delete overlay; overlay = NULL; } void SetDeinterlace(char d) { deint = d; if(overlay) overlay->SetDeinterlace(d); } int CopyData(struct Buffer * buffer) { if(overlay) return overlay->CopyData(buffer); return -1; } int SwapBuffers(SDL_Rect * clip) { int ret; RECT rect; SDL_Overlay * ovl; rect.top = clip->y; rect.left = clip->x; rect.right = clip->w + clip->x; rect.bottom = clip->h + clip->y; if(overlay) { if(!(surface->flags&SDL_HWSURFACE)) { return overlay->SwapBuffers(clip); } if((ovl=overlay->GetSurface()) == NULL) return -1; ret = IDirectDrawSurface3_Blt(surface->hwdata->dd_writebuf, &rect, ovl->hwdata->surface, NULL, DDBLT_WAIT, NULL); switch (ret) { case DD_OK: break; case DDERR_SURFACELOST: IDirectDrawSurface3_Restore(ovl->hwdata->surface); IDirectDrawSurface3_Restore(surface->hwdata->dd_surface); break; default: LOG_MSG("Failed to blit, error %X", ret); } SDL_Flip(surface); return 0; } return -1; }};#endif // HAVE_DDRAW_H#undef MODULE#endif // DDRAW_H
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -