mirror of
https://github.com/minetest/irrlicht.git
synced 2024-12-26 16:07:31 +01:00
Remove leftover code from software rendering
This commit is contained in:
parent
a9230e5f49
commit
7d3142b969
@ -180,11 +180,6 @@ void CIrrDeviceAndroid::setWindowCaption(const wchar_t* text)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CIrrDeviceAndroid::present(video::IImage* surface, void* windowId, core::rect<s32>* srcClip)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CIrrDeviceAndroid::isWindowActive() const
|
bool CIrrDeviceAndroid::isWindowActive() const
|
||||||
{
|
{
|
||||||
return (Focused && !Paused);
|
return (Focused && !Paused);
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#include "CIrrDeviceStub.h"
|
#include "CIrrDeviceStub.h"
|
||||||
#include "IrrlichtDevice.h"
|
#include "IrrlichtDevice.h"
|
||||||
#include "IImagePresenter.h"
|
|
||||||
#include "ICursorControl.h"
|
#include "ICursorControl.h"
|
||||||
|
|
||||||
#include <android/sensor.h>
|
#include <android/sensor.h>
|
||||||
@ -19,7 +18,7 @@
|
|||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
class CIrrDeviceAndroid : public CIrrDeviceStub, video::IImagePresenter
|
class CIrrDeviceAndroid : public CIrrDeviceStub
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CIrrDeviceAndroid(const SIrrlichtCreationParameters& param);
|
CIrrDeviceAndroid(const SIrrlichtCreationParameters& param);
|
||||||
@ -34,8 +33,6 @@ namespace irr
|
|||||||
|
|
||||||
virtual void setWindowCaption(const wchar_t* text);
|
virtual void setWindowCaption(const wchar_t* text);
|
||||||
|
|
||||||
virtual bool present(video::IImage* surface, void* windowId, core::rect<s32>* srcClip);
|
|
||||||
|
|
||||||
virtual bool isWindowActive() const;
|
virtual bool isWindowActive() const;
|
||||||
|
|
||||||
virtual bool isWindowFocused() const;
|
virtual bool isWindowFocused() const;
|
||||||
|
@ -110,7 +110,7 @@ namespace irr
|
|||||||
CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param)
|
CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param)
|
||||||
: CIrrDeviceStub(param),
|
: CIrrDeviceStub(param),
|
||||||
#ifdef _IRR_COMPILE_WITH_X11_
|
#ifdef _IRR_COMPILE_WITH_X11_
|
||||||
XDisplay(0), VisualInfo(0), Screennr(0), XWindow(0), StdHints(0), SoftwareImage(0),
|
XDisplay(0), VisualInfo(0), Screennr(0), XWindow(0), StdHints(0),
|
||||||
XInputMethod(0), XInputContext(0),
|
XInputMethod(0), XInputContext(0),
|
||||||
HasNetWM(false),
|
HasNetWM(false),
|
||||||
#endif
|
#endif
|
||||||
@ -211,9 +211,6 @@ CIrrDeviceLinux::~CIrrDeviceLinux()
|
|||||||
ContextManager->destroySurface();
|
ContextManager->destroySurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SoftwareImage)
|
|
||||||
XDestroyImage(SoftwareImage);
|
|
||||||
|
|
||||||
if (!ExternalWindow)
|
if (!ExternalWindow)
|
||||||
{
|
{
|
||||||
XDestroyWindow(XDisplay,XWindow);
|
XDestroyWindow(XDisplay,XWindow);
|
||||||
@ -487,21 +484,6 @@ bool CIrrDeviceLinux::createWindow()
|
|||||||
long num;
|
long num;
|
||||||
XGetWMNormalHints(XDisplay, XWindow, StdHints, &num);
|
XGetWMNormalHints(XDisplay, XWindow, StdHints, &num);
|
||||||
|
|
||||||
// create an XImage for the software renderer
|
|
||||||
//(thx to Nadav for some clues on how to do that!)
|
|
||||||
|
|
||||||
if (CreationParams.DriverType == video::EDT_SOFTWARE || CreationParams.DriverType == video::EDT_BURNINGSVIDEO)
|
|
||||||
{
|
|
||||||
SoftwareImage = XCreateImage(XDisplay,
|
|
||||||
VisualInfo->visual, VisualInfo->depth,
|
|
||||||
ZPixmap, 0, 0, Width, Height,
|
|
||||||
BitmapPad(XDisplay), 0);
|
|
||||||
|
|
||||||
// use malloc because X will free it later on
|
|
||||||
if (SoftwareImage)
|
|
||||||
SoftwareImage->data = (char*) malloc(SoftwareImage->bytes_per_line * SoftwareImage->height * sizeof(char));
|
|
||||||
}
|
|
||||||
|
|
||||||
initXInput2();
|
initXInput2();
|
||||||
|
|
||||||
#endif // #ifdef _IRR_COMPILE_WITH_X11_
|
#endif // #ifdef _IRR_COMPILE_WITH_X11_
|
||||||
@ -515,20 +497,6 @@ void CIrrDeviceLinux::createDriver()
|
|||||||
switch(CreationParams.DriverType)
|
switch(CreationParams.DriverType)
|
||||||
{
|
{
|
||||||
#ifdef _IRR_COMPILE_WITH_X11_
|
#ifdef _IRR_COMPILE_WITH_X11_
|
||||||
case video::EDT_SOFTWARE:
|
|
||||||
#ifdef _IRR_COMPILE_WITH_SOFTWARE_
|
|
||||||
VideoDriver = video::createSoftwareDriver(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this);
|
|
||||||
#else
|
|
||||||
os::Printer::log("No Software driver support compiled in.", ELL_ERROR);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
case video::EDT_BURNINGSVIDEO:
|
|
||||||
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
|
|
||||||
VideoDriver = video::createBurningVideoDriver(CreationParams, FileSystem, this);
|
|
||||||
#else
|
|
||||||
os::Printer::log("Burning's video driver was not compiled in.", ELL_ERROR);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
case video::EDT_OPENGL:
|
case video::EDT_OPENGL:
|
||||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||||
{
|
{
|
||||||
@ -765,21 +733,6 @@ bool CIrrDeviceLinux::run()
|
|||||||
Width = event.xconfigure.width;
|
Width = event.xconfigure.width;
|
||||||
Height = event.xconfigure.height;
|
Height = event.xconfigure.height;
|
||||||
|
|
||||||
// resize image data
|
|
||||||
if (SoftwareImage)
|
|
||||||
{
|
|
||||||
XDestroyImage(SoftwareImage);
|
|
||||||
|
|
||||||
SoftwareImage = XCreateImage(XDisplay,
|
|
||||||
VisualInfo->visual, VisualInfo->depth,
|
|
||||||
ZPixmap, 0, 0, Width, Height,
|
|
||||||
BitmapPad(XDisplay), 0);
|
|
||||||
|
|
||||||
// use malloc because X will free it later on
|
|
||||||
if (SoftwareImage)
|
|
||||||
SoftwareImage->data = (char*) malloc(SoftwareImage->bytes_per_line * SoftwareImage->height * sizeof(char));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (VideoDriver)
|
if (VideoDriver)
|
||||||
VideoDriver->OnResize(core::dimension2d<u32>(Width, Height));
|
VideoDriver->OnResize(core::dimension2d<u32>(Width, Height));
|
||||||
}
|
}
|
||||||
@ -1219,60 +1172,6 @@ void CIrrDeviceLinux::setWindowCaption(const wchar_t* text)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! presents a surface in the client area
|
|
||||||
bool CIrrDeviceLinux::present(video::IImage* image, void* windowId, core::rect<s32>* srcRect)
|
|
||||||
{
|
|
||||||
#ifdef _IRR_COMPILE_WITH_X11_
|
|
||||||
// this is only necessary for software drivers.
|
|
||||||
if (!SoftwareImage)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// thx to Nadav, who send me some clues of how to display the image
|
|
||||||
// to the X Server.
|
|
||||||
|
|
||||||
const u32 destwidth = SoftwareImage->width;
|
|
||||||
const u32 minWidth = core::min_(image->getDimension().Width, destwidth);
|
|
||||||
const u32 destPitch = SoftwareImage->bytes_per_line;
|
|
||||||
|
|
||||||
video::ECOLOR_FORMAT destColor;
|
|
||||||
switch (SoftwareImage->bits_per_pixel)
|
|
||||||
{
|
|
||||||
case 16:
|
|
||||||
if (SoftwareImage->depth==16)
|
|
||||||
destColor = video::ECF_R5G6B5;
|
|
||||||
else
|
|
||||||
destColor = video::ECF_A1R5G5B5;
|
|
||||||
break;
|
|
||||||
case 24: destColor = video::ECF_R8G8B8; break;
|
|
||||||
case 32: destColor = video::ECF_A8R8G8B8; break;
|
|
||||||
default:
|
|
||||||
os::Printer::log("Unsupported screen depth.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
u8* srcdata = reinterpret_cast<u8*>(image->getData());
|
|
||||||
u8* destData = reinterpret_cast<u8*>(SoftwareImage->data);
|
|
||||||
|
|
||||||
const u32 destheight = SoftwareImage->height;
|
|
||||||
const u32 srcheight = core::min_(image->getDimension().Height, destheight);
|
|
||||||
const u32 srcPitch = image->getPitch();
|
|
||||||
for (u32 y=0; y!=srcheight; ++y)
|
|
||||||
{
|
|
||||||
video::CColorConverter::convert_viaFormat(srcdata,image->getColorFormat(), minWidth, destData, destColor);
|
|
||||||
srcdata+=srcPitch;
|
|
||||||
destData+=destPitch;
|
|
||||||
}
|
|
||||||
|
|
||||||
GC gc = DefaultGC(XDisplay, DefaultScreen(XDisplay));
|
|
||||||
Window myWindow=XWindow;
|
|
||||||
if (windowId)
|
|
||||||
myWindow = reinterpret_cast<Window>(windowId);
|
|
||||||
XPutImage(XDisplay, myWindow, gc, SoftwareImage, 0, 0, 0, 0, destwidth, destheight);
|
|
||||||
#endif
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! notifies the device that it should close itself
|
//! notifies the device that it should close itself
|
||||||
void CIrrDeviceLinux::closeDevice()
|
void CIrrDeviceLinux::closeDevice()
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#include "CIrrDeviceStub.h"
|
#include "CIrrDeviceStub.h"
|
||||||
#include "IrrlichtDevice.h"
|
#include "IrrlichtDevice.h"
|
||||||
#include "IImagePresenter.h"
|
|
||||||
#include "ICursorControl.h"
|
#include "ICursorControl.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
|
||||||
@ -33,7 +32,7 @@
|
|||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
|
|
||||||
class CIrrDeviceLinux : public CIrrDeviceStub, public video::IImagePresenter
|
class CIrrDeviceLinux : public CIrrDeviceStub
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -68,9 +67,6 @@ namespace irr
|
|||||||
//! returns color format of the window.
|
//! returns color format of the window.
|
||||||
video::ECOLOR_FORMAT getColorFormat() const override;
|
video::ECOLOR_FORMAT getColorFormat() const override;
|
||||||
|
|
||||||
//! presents a surface in the client area
|
|
||||||
bool present(video::IImage* surface, void* windowId=0, core::rect<s32>* src=0 ) override;
|
|
||||||
|
|
||||||
//! notifies the device that it should close itself
|
//! notifies the device that it should close itself
|
||||||
void closeDevice() override;
|
void closeDevice() override;
|
||||||
|
|
||||||
@ -410,7 +406,6 @@ namespace irr
|
|||||||
Window XWindow;
|
Window XWindow;
|
||||||
XSetWindowAttributes WndAttributes;
|
XSetWindowAttributes WndAttributes;
|
||||||
XSizeHints* StdHints;
|
XSizeHints* StdHints;
|
||||||
XImage* SoftwareImage;
|
|
||||||
XIM XInputMethod;
|
XIM XInputMethod;
|
||||||
XIC XInputContext;
|
XIC XInputContext;
|
||||||
bool HasNetWM;
|
bool HasNetWM;
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
#include "CIrrDeviceStub.h"
|
#include "CIrrDeviceStub.h"
|
||||||
#include "IrrlichtDevice.h"
|
#include "IrrlichtDevice.h"
|
||||||
#include "IImagePresenter.h"
|
|
||||||
#include "IGUIEnvironment.h"
|
#include "IGUIEnvironment.h"
|
||||||
#include "ICursorControl.h"
|
#include "ICursorControl.h"
|
||||||
|
|
||||||
@ -36,7 +35,7 @@ namespace irr
|
|||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
class CIrrDeviceMacOSX : public CIrrDeviceStub, video::IImagePresenter
|
class CIrrDeviceMacOSX : public CIrrDeviceStub
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -68,9 +67,6 @@ namespace irr
|
|||||||
//! Checks if the Irrlicht window is minimized
|
//! Checks if the Irrlicht window is minimized
|
||||||
bool isWindowMinimized() const override;
|
bool isWindowMinimized() const override;
|
||||||
|
|
||||||
//! presents a surface in the client area
|
|
||||||
bool present(video::IImage* surface, void* windowId=0, core::rect<s32>* src=0 ) override;
|
|
||||||
|
|
||||||
//! notifies the device that it should close itself
|
//! notifies the device that it should close itself
|
||||||
void closeDevice() override;
|
void closeDevice() override;
|
||||||
|
|
||||||
@ -237,14 +233,12 @@ namespace irr
|
|||||||
|
|
||||||
NSWindow* Window;
|
NSWindow* Window;
|
||||||
CGDirectDisplayID Display;
|
CGDirectDisplayID Display;
|
||||||
NSBitmapImageRep* SoftwareDriverTarget;
|
|
||||||
std::map<int,int> KeyCodes;
|
std::map<int,int> KeyCodes;
|
||||||
int DeviceWidth;
|
int DeviceWidth;
|
||||||
int DeviceHeight;
|
int DeviceHeight;
|
||||||
int ScreenWidth;
|
int ScreenWidth;
|
||||||
int ScreenHeight;
|
int ScreenHeight;
|
||||||
u32 MouseButtonStates;
|
u32 MouseButtonStates;
|
||||||
u32 SoftwareRendererType;
|
|
||||||
bool IsFullscreen;
|
bool IsFullscreen;
|
||||||
bool IsActive;
|
bool IsActive;
|
||||||
bool IsShiftDown;
|
bool IsShiftDown;
|
||||||
|
@ -547,8 +547,8 @@ namespace irr
|
|||||||
//! constructor
|
//! constructor
|
||||||
CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param)
|
CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param)
|
||||||
: CIrrDeviceStub(param), Window(NULL), Display(NULL),
|
: CIrrDeviceStub(param), Window(NULL), Display(NULL),
|
||||||
SoftwareDriverTarget(0), DeviceWidth(0), DeviceHeight(0),
|
DeviceWidth(0), DeviceHeight(0),
|
||||||
ScreenWidth(0), ScreenHeight(0), MouseButtonStates(0), SoftwareRendererType(0),
|
ScreenWidth(0), ScreenHeight(0), MouseButtonStates(0),
|
||||||
IsActive(true), IsFullscreen(false), IsShiftDown(false), IsControlDown(false), IsResizable(false)
|
IsActive(true), IsFullscreen(false), IsShiftDown(false), IsControlDown(false), IsResizable(false)
|
||||||
{
|
{
|
||||||
struct utsname name;
|
struct utsname name;
|
||||||
@ -617,7 +617,6 @@ CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param)
|
|||||||
|
|
||||||
CIrrDeviceMacOSX::~CIrrDeviceMacOSX()
|
CIrrDeviceMacOSX::~CIrrDeviceMacOSX()
|
||||||
{
|
{
|
||||||
[SoftwareDriverTarget release];
|
|
||||||
[NSApp setPresentationOptions:(NSApplicationPresentationDefault)];
|
[NSApp setPresentationOptions:(NSApplicationPresentationDefault)];
|
||||||
closeDevice();
|
closeDevice();
|
||||||
#if defined(_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)
|
#if defined(_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)
|
||||||
@ -731,24 +730,6 @@ void CIrrDeviceMacOSX::createDriver()
|
|||||||
{
|
{
|
||||||
switch (CreationParams.DriverType)
|
switch (CreationParams.DriverType)
|
||||||
{
|
{
|
||||||
case video::EDT_SOFTWARE:
|
|
||||||
#ifdef _IRR_COMPILE_WITH_SOFTWARE_
|
|
||||||
VideoDriver = video::createSoftwareDriver(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this);
|
|
||||||
SoftwareRendererType = 2;
|
|
||||||
#else
|
|
||||||
os::Printer::log("No Software driver support compiled in.", ELL_ERROR);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case video::EDT_BURNINGSVIDEO:
|
|
||||||
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
|
|
||||||
VideoDriver = video::createBurningVideoDriver(CreationParams, FileSystem, this);
|
|
||||||
SoftwareRendererType = 1;
|
|
||||||
#else
|
|
||||||
os::Printer::log("Burning's video driver was not compiled in.", ELL_ERROR);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case video::EDT_OPENGL:
|
case video::EDT_OPENGL:
|
||||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||||
{
|
{
|
||||||
@ -1358,87 +1339,6 @@ core::position2di CIrrDeviceMacOSX::getWindowPosition()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool CIrrDeviceMacOSX::present(video::IImage* surface, void* windowId, core::rect<s32>* src )
|
|
||||||
{
|
|
||||||
// todo: implement window ID and src rectangle
|
|
||||||
|
|
||||||
if (!surface)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (SoftwareRendererType > 0)
|
|
||||||
{
|
|
||||||
const u32 colorSamples=3;
|
|
||||||
// do we need to change the size?
|
|
||||||
const bool updateSize = !SoftwareDriverTarget ||
|
|
||||||
s32([SoftwareDriverTarget size].width) != surface->getDimension().Width ||
|
|
||||||
s32([SoftwareDriverTarget size].height) != surface->getDimension().Height;
|
|
||||||
|
|
||||||
NSRect areaRect = NSMakeRect(0.0, 0.0, surface->getDimension().Width, surface->getDimension().Height);
|
|
||||||
const u32 destPitch = (colorSamples * areaRect.size.width);
|
|
||||||
|
|
||||||
// create / update the target
|
|
||||||
if (updateSize)
|
|
||||||
{
|
|
||||||
[SoftwareDriverTarget release];
|
|
||||||
// allocate target for IImage
|
|
||||||
SoftwareDriverTarget = [[NSBitmapImageRep alloc]
|
|
||||||
initWithBitmapDataPlanes: nil
|
|
||||||
pixelsWide: areaRect.size.width
|
|
||||||
pixelsHigh: areaRect.size.height
|
|
||||||
bitsPerSample: 8
|
|
||||||
samplesPerPixel: colorSamples
|
|
||||||
hasAlpha: NO
|
|
||||||
isPlanar: NO
|
|
||||||
colorSpaceName: NSCalibratedRGBColorSpace
|
|
||||||
bytesPerRow: destPitch
|
|
||||||
bitsPerPixel: 8*colorSamples];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SoftwareDriverTarget==nil)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// get pointer to image data
|
|
||||||
unsigned char* imgData = (unsigned char*)surface->getData();
|
|
||||||
|
|
||||||
u8* srcdata = reinterpret_cast<u8*>(imgData);
|
|
||||||
u8* destData = reinterpret_cast<u8*>([SoftwareDriverTarget bitmapData]);
|
|
||||||
const u32 srcheight = core::min_(surface->getDimension().Height, (u32)areaRect.size.height);
|
|
||||||
const u32 srcPitch = surface->getPitch();
|
|
||||||
const u32 minWidth = core::min_(surface->getDimension().Width, (u32)areaRect.size.width);
|
|
||||||
for (u32 y=0; y!=srcheight; ++y)
|
|
||||||
{
|
|
||||||
if(SoftwareRendererType == 2)
|
|
||||||
{
|
|
||||||
if (surface->getColorFormat() == video::ECF_A8R8G8B8)
|
|
||||||
video::CColorConverter::convert_A8R8G8B8toB8G8R8(srcdata, minWidth, destData);
|
|
||||||
else if (surface->getColorFormat() == video::ECF_A1R5G5B5)
|
|
||||||
video::CColorConverter::convert_A1R5G5B5toB8G8R8(srcdata, minWidth, destData);
|
|
||||||
else
|
|
||||||
video::CColorConverter::convert_viaFormat(srcdata, surface->getColorFormat(), minWidth, destData, video::ECF_R8G8B8);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (surface->getColorFormat() == video::ECF_A8R8G8B8)
|
|
||||||
video::CColorConverter::convert_A8R8G8B8toR8G8B8(srcdata, minWidth, destData);
|
|
||||||
else if (surface->getColorFormat() == video::ECF_A1R5G5B5)
|
|
||||||
video::CColorConverter::convert_A1R5G5B5toR8G8B8(srcdata, minWidth, destData);
|
|
||||||
else
|
|
||||||
video::CColorConverter::convert_viaFormat(srcdata, surface->getColorFormat(), minWidth, destData, video::ECF_R8G8B8);
|
|
||||||
}
|
|
||||||
|
|
||||||
srcdata += srcPitch;
|
|
||||||
destData += destPitch;
|
|
||||||
}
|
|
||||||
|
|
||||||
// todo: draw properly into a sub-view
|
|
||||||
[SoftwareDriverTarget draw];
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#if defined (_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)
|
#if defined (_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)
|
||||||
static void joystickRemovalCallback(void * target,
|
static void joystickRemovalCallback(void * target,
|
||||||
IOReturn result, void * refcon, void * sender)
|
IOReturn result, void * refcon, void * sender)
|
||||||
|
@ -372,22 +372,6 @@ void CIrrDeviceSDL::createDriver()
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case video::EDT_SOFTWARE:
|
|
||||||
#ifdef _IRR_COMPILE_WITH_SOFTWARE_
|
|
||||||
VideoDriver = video::createSoftwareDriver(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this);
|
|
||||||
#else
|
|
||||||
os::Printer::log("No Software driver support compiled in.", ELL_ERROR);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case video::EDT_BURNINGSVIDEO:
|
|
||||||
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
|
|
||||||
VideoDriver = video::createBurningVideoDriver(CreationParams, FileSystem, this);
|
|
||||||
#else
|
|
||||||
os::Printer::log("Burning's video driver was not compiled in.", ELL_ERROR);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case video::EDT_OPENGL:
|
case video::EDT_OPENGL:
|
||||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||||
ContextManager = new video::CSDLManager(this);
|
ContextManager = new video::CSDLManager(this);
|
||||||
@ -846,90 +830,6 @@ void CIrrDeviceSDL::setWindowCaption(const wchar_t* text)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! presents a surface in the client area
|
|
||||||
bool CIrrDeviceSDL::present(video::IImage* surface, void* windowId, core::rect<s32>* srcClip)
|
|
||||||
{
|
|
||||||
#ifdef _IRR_EMSCRIPTEN_PLATFORM_
|
|
||||||
return true;
|
|
||||||
#else // !_IRR_EMSCRIPTEN_PLATFORM_
|
|
||||||
SDL_Surface *sdlSurface = SDL_CreateRGBSurfaceFrom(
|
|
||||||
surface->getData(), surface->getDimension().Width, surface->getDimension().Height,
|
|
||||||
surface->getBitsPerPixel(), surface->getPitch(),
|
|
||||||
surface->getRedMask(), surface->getGreenMask(), surface->getBlueMask(), surface->getAlphaMask());
|
|
||||||
if (!sdlSurface)
|
|
||||||
return false;
|
|
||||||
SDL_SetSurfaceAlphaMod(sdlSurface, 0);
|
|
||||||
SDL_SetColorKey(sdlSurface, 0, 0);
|
|
||||||
sdlSurface->format->BitsPerPixel=surface->getBitsPerPixel();
|
|
||||||
sdlSurface->format->BytesPerPixel=surface->getBytesPerPixel();
|
|
||||||
if ((surface->getColorFormat()==video::ECF_R8G8B8) ||
|
|
||||||
(surface->getColorFormat()==video::ECF_A8R8G8B8))
|
|
||||||
{
|
|
||||||
sdlSurface->format->Rloss=0;
|
|
||||||
sdlSurface->format->Gloss=0;
|
|
||||||
sdlSurface->format->Bloss=0;
|
|
||||||
sdlSurface->format->Rshift=16;
|
|
||||||
sdlSurface->format->Gshift=8;
|
|
||||||
sdlSurface->format->Bshift=0;
|
|
||||||
if (surface->getColorFormat()==video::ECF_R8G8B8)
|
|
||||||
{
|
|
||||||
sdlSurface->format->Aloss=8;
|
|
||||||
sdlSurface->format->Ashift=32;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sdlSurface->format->Aloss=0;
|
|
||||||
sdlSurface->format->Ashift=24;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (surface->getColorFormat()==video::ECF_R5G6B5)
|
|
||||||
{
|
|
||||||
sdlSurface->format->Rloss=3;
|
|
||||||
sdlSurface->format->Gloss=2;
|
|
||||||
sdlSurface->format->Bloss=3;
|
|
||||||
sdlSurface->format->Aloss=8;
|
|
||||||
sdlSurface->format->Rshift=11;
|
|
||||||
sdlSurface->format->Gshift=5;
|
|
||||||
sdlSurface->format->Bshift=0;
|
|
||||||
sdlSurface->format->Ashift=16;
|
|
||||||
}
|
|
||||||
else if (surface->getColorFormat()==video::ECF_A1R5G5B5)
|
|
||||||
{
|
|
||||||
sdlSurface->format->Rloss=3;
|
|
||||||
sdlSurface->format->Gloss=3;
|
|
||||||
sdlSurface->format->Bloss=3;
|
|
||||||
sdlSurface->format->Aloss=7;
|
|
||||||
sdlSurface->format->Rshift=10;
|
|
||||||
sdlSurface->format->Gshift=5;
|
|
||||||
sdlSurface->format->Bshift=0;
|
|
||||||
sdlSurface->format->Ashift=15;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Surface* scr = (SDL_Surface* )windowId;
|
|
||||||
if (!scr)
|
|
||||||
scr = SDL_GetWindowSurface(Window);
|
|
||||||
if (scr)
|
|
||||||
{
|
|
||||||
if (srcClip)
|
|
||||||
{
|
|
||||||
SDL_Rect sdlsrcClip;
|
|
||||||
sdlsrcClip.x = srcClip->UpperLeftCorner.X;
|
|
||||||
sdlsrcClip.y = srcClip->UpperLeftCorner.Y;
|
|
||||||
sdlsrcClip.w = srcClip->getWidth();
|
|
||||||
sdlsrcClip.h = srcClip->getHeight();
|
|
||||||
SDL_BlitSurface(sdlSurface, &sdlsrcClip, scr, NULL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
SDL_BlitSurface(sdlSurface, NULL, scr, NULL);
|
|
||||||
SDL_RenderPresent(SDL_GetRenderer(Window));
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_FreeSurface(sdlSurface);
|
|
||||||
return (scr != 0);
|
|
||||||
#endif // !_IRR_EMSCRIPTEN_PLATFORM_
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! notifies the device that it should close itself
|
//! notifies the device that it should close itself
|
||||||
void CIrrDeviceSDL::closeDevice()
|
void CIrrDeviceSDL::closeDevice()
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
#include "IrrlichtDevice.h"
|
#include "IrrlichtDevice.h"
|
||||||
#include "CIrrDeviceStub.h"
|
#include "CIrrDeviceStub.h"
|
||||||
#include "IImagePresenter.h"
|
|
||||||
#include "ICursorControl.h"
|
#include "ICursorControl.h"
|
||||||
|
|
||||||
#ifdef _IRR_EMSCRIPTEN_PLATFORM_
|
#ifdef _IRR_EMSCRIPTEN_PLATFORM_
|
||||||
@ -28,7 +27,7 @@
|
|||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
|
|
||||||
class CIrrDeviceSDL : public CIrrDeviceStub, video::IImagePresenter
|
class CIrrDeviceSDL : public CIrrDeviceStub
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -62,9 +61,6 @@ namespace irr
|
|||||||
//! returns color format of the window.
|
//! returns color format of the window.
|
||||||
video::ECOLOR_FORMAT getColorFormat() const override;
|
video::ECOLOR_FORMAT getColorFormat() const override;
|
||||||
|
|
||||||
//! presents a surface in the client area
|
|
||||||
bool present(video::IImage* surface, void* windowId=0, core::rect<s32>* src=0) override;
|
|
||||||
|
|
||||||
//! notifies the device that it should close itself
|
//! notifies the device that it should close itself
|
||||||
void closeDevice() override;
|
void closeDevice() override;
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#define __C_IRR_DEVICE_STUB_H_INCLUDED__
|
#define __C_IRR_DEVICE_STUB_H_INCLUDED__
|
||||||
|
|
||||||
#include "IrrlichtDevice.h"
|
#include "IrrlichtDevice.h"
|
||||||
#include "IImagePresenter.h"
|
|
||||||
#include "SIrrCreationParameters.h"
|
#include "SIrrCreationParameters.h"
|
||||||
#include "IContextManager.h"
|
#include "IContextManager.h"
|
||||||
|
|
||||||
@ -36,11 +35,6 @@ namespace irr
|
|||||||
|
|
||||||
namespace video
|
namespace video
|
||||||
{
|
{
|
||||||
IVideoDriver* createSoftwareDriver(const core::dimension2d<u32>& windowSize,
|
|
||||||
bool fullscreen, io::IFileSystem* io,
|
|
||||||
video::IImagePresenter* presenter);
|
|
||||||
IVideoDriver* createBurningVideoDriver(const irr::SIrrlichtCreationParameters& params,
|
|
||||||
io::IFileSystem* io, video::IImagePresenter* presenter);
|
|
||||||
IVideoDriver* createNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& screenSize);
|
IVideoDriver* createNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& screenSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1009,24 +1009,6 @@ void CIrrDeviceWin32::createDriver()
|
|||||||
case video::EDT_WEBGL1:
|
case video::EDT_WEBGL1:
|
||||||
os::Printer::log("WebGL1 driver not supported on Win32 device.", ELL_ERROR);
|
os::Printer::log("WebGL1 driver not supported on Win32 device.", ELL_ERROR);
|
||||||
break;
|
break;
|
||||||
case video::EDT_SOFTWARE:
|
|
||||||
#ifdef _IRR_COMPILE_WITH_SOFTWARE_
|
|
||||||
switchToFullScreen();
|
|
||||||
|
|
||||||
VideoDriver = video::createSoftwareDriver(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this);
|
|
||||||
#else
|
|
||||||
os::Printer::log("Software driver was not compiled in.", ELL_ERROR);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
case video::EDT_BURNINGSVIDEO:
|
|
||||||
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
|
|
||||||
switchToFullScreen();
|
|
||||||
|
|
||||||
VideoDriver = video::createBurningVideoDriver(CreationParams, FileSystem, this);
|
|
||||||
#else
|
|
||||||
os::Printer::log("Burning's Video driver was not compiled in.", ELL_ERROR);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
case video::EDT_NULL:
|
case video::EDT_NULL:
|
||||||
VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize);
|
VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize);
|
||||||
break;
|
break;
|
||||||
@ -1127,54 +1109,6 @@ void CIrrDeviceWin32::setWindowCaption(const wchar_t* text)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! presents a surface in the client area
|
|
||||||
bool CIrrDeviceWin32::present(video::IImage* image, void* windowId, core::rect<s32>* src)
|
|
||||||
{
|
|
||||||
HWND hwnd = HWnd;
|
|
||||||
if ( windowId )
|
|
||||||
hwnd = static_cast<HWND>(windowId);
|
|
||||||
|
|
||||||
HDC dc = GetDC(hwnd);
|
|
||||||
|
|
||||||
if ( dc )
|
|
||||||
{
|
|
||||||
RECT rect;
|
|
||||||
GetClientRect(hwnd, &rect);
|
|
||||||
const void* memory = (const void *)image->getData();
|
|
||||||
|
|
||||||
BITMAPV4HEADER bi;
|
|
||||||
ZeroMemory (&bi, sizeof(bi));
|
|
||||||
bi.bV4Size = sizeof(BITMAPINFOHEADER);
|
|
||||||
bi.bV4BitCount = (WORD)image->getBitsPerPixel();
|
|
||||||
bi.bV4Planes = 1;
|
|
||||||
bi.bV4Width = image->getDimension().Width;
|
|
||||||
bi.bV4Height = -((s32)image->getDimension().Height);
|
|
||||||
bi.bV4V4Compression = BI_BITFIELDS;
|
|
||||||
bi.bV4AlphaMask = image->getAlphaMask();
|
|
||||||
bi.bV4RedMask = image->getRedMask();
|
|
||||||
bi.bV4GreenMask = image->getGreenMask();
|
|
||||||
bi.bV4BlueMask = image->getBlueMask();
|
|
||||||
|
|
||||||
if ( src )
|
|
||||||
{
|
|
||||||
StretchDIBits(dc, 0,0, rect.right, rect.bottom,
|
|
||||||
src->UpperLeftCorner.X, src->UpperLeftCorner.Y,
|
|
||||||
src->getWidth(), src->getHeight(),
|
|
||||||
memory, (const BITMAPINFO*)(&bi), DIB_RGB_COLORS, SRCCOPY);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
StretchDIBits(dc, 0,0, rect.right, rect.bottom,
|
|
||||||
0, 0, image->getDimension().Width, image->getDimension().Height,
|
|
||||||
memory, (const BITMAPINFO*)(&bi), DIB_RGB_COLORS, SRCCOPY);
|
|
||||||
}
|
|
||||||
|
|
||||||
ReleaseDC(hwnd, dc);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! notifies the device that it should close itself
|
//! notifies the device that it should close itself
|
||||||
void CIrrDeviceWin32::closeDevice()
|
void CIrrDeviceWin32::closeDevice()
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include "CIrrDeviceStub.h"
|
#include "CIrrDeviceStub.h"
|
||||||
#include "IrrlichtDevice.h"
|
#include "IrrlichtDevice.h"
|
||||||
#include "IImagePresenter.h"
|
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -25,7 +24,7 @@ namespace irr
|
|||||||
{
|
{
|
||||||
struct SJoystickWin32Control;
|
struct SJoystickWin32Control;
|
||||||
|
|
||||||
class CIrrDeviceWin32 : public CIrrDeviceStub, video::IImagePresenter
|
class CIrrDeviceWin32 : public CIrrDeviceStub
|
||||||
{
|
{
|
||||||
friend struct SJoystickWin32Control;
|
friend struct SJoystickWin32Control;
|
||||||
public:
|
public:
|
||||||
@ -58,9 +57,6 @@ namespace irr
|
|||||||
//! returns if window is minimized
|
//! returns if window is minimized
|
||||||
bool isWindowMinimized() const override;
|
bool isWindowMinimized() const override;
|
||||||
|
|
||||||
//! presents a surface in the client area
|
|
||||||
bool present(video::IImage* surface, void* windowId=0, core::rect<s32>* src=0) override;
|
|
||||||
|
|
||||||
//! notifies the device that it should close itself
|
//! notifies the device that it should close itself
|
||||||
void closeDevice() override;
|
void closeDevice() override;
|
||||||
|
|
||||||
|
@ -13,12 +13,11 @@
|
|||||||
|
|
||||||
#include "CIrrDeviceStub.h"
|
#include "CIrrDeviceStub.h"
|
||||||
#include "IrrlichtDevice.h"
|
#include "IrrlichtDevice.h"
|
||||||
#include "IImagePresenter.h"
|
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
|
|
||||||
class CIrrDeviceiOS : public CIrrDeviceStub, public video::IImagePresenter
|
class CIrrDeviceiOS : public CIrrDeviceStub
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CIrrDeviceiOS(const SIrrlichtCreationParameters& params);
|
CIrrDeviceiOS(const SIrrlichtCreationParameters& params);
|
||||||
@ -34,8 +33,6 @@ namespace irr
|
|||||||
bool isWindowFocused() const override;
|
bool isWindowFocused() const override;
|
||||||
bool isWindowMinimized() const override;
|
bool isWindowMinimized() const override;
|
||||||
|
|
||||||
bool present(video::IImage* surface, void * windowId = 0, core::rect<s32>* src = 0) override;
|
|
||||||
|
|
||||||
void closeDevice() override;
|
void closeDevice() override;
|
||||||
|
|
||||||
void setResizable(bool resize = false) override;
|
void setResizable(bool resize = false) override;
|
||||||
|
@ -480,11 +480,6 @@ namespace irr
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CIrrDeviceiOS::present(video::IImage* image, void * windowId, core::rect<s32>* src)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CIrrDeviceiOS::closeDevice()
|
void CIrrDeviceiOS::closeDevice()
|
||||||
{
|
{
|
||||||
CFRunLoopStop(CFRunLoopGetMain());
|
CFRunLoopStop(CFRunLoopGetMain());
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
#include "IVideoDriver.h"
|
#include "IVideoDriver.h"
|
||||||
#include "IFileSystem.h"
|
#include "IFileSystem.h"
|
||||||
#include "IImagePresenter.h"
|
|
||||||
#include "IGPUProgrammingServices.h"
|
#include "IGPUProgrammingServices.h"
|
||||||
#include "irrArray.h"
|
#include "irrArray.h"
|
||||||
#include "irrString.h"
|
#include "irrString.h"
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
// Copyright (C) 2002-2012 Nikolaus Gebhardt
|
|
||||||
// This file is part of the "Irrlicht Engine".
|
|
||||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
||||||
|
|
||||||
#ifndef __I_IMAGE_PRESENTER_H_INCLUDED__
|
|
||||||
#define __I_IMAGE_PRESENTER_H_INCLUDED__
|
|
||||||
|
|
||||||
#include "IImage.h"
|
|
||||||
|
|
||||||
namespace irr
|
|
||||||
{
|
|
||||||
namespace video
|
|
||||||
{
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Interface for a class which is able to present an IImage
|
|
||||||
an the Screen. Usually only implemented by an IrrDevice for
|
|
||||||
presenting Software Device Rendered images.
|
|
||||||
|
|
||||||
This class should be used only internally.
|
|
||||||
*/
|
|
||||||
|
|
||||||
class IImagePresenter
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
virtual ~IImagePresenter() {};
|
|
||||||
//! presents a surface in the client area
|
|
||||||
virtual bool present(video::IImage* surface, void* windowId=0, core::rect<s32>* src=0 ) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // end namespace video
|
|
||||||
} // end namespace irr
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user