Fixed mingw build.
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
|
||||
/****************** Capturing video from camera via CMU lib *******************/
|
||||
|
||||
#if HAVE_CMU1394
|
||||
#ifdef HAVE_CMU1394
|
||||
|
||||
// This firewire capability added by Philip Gruebele (pgruebele@cox.net).
|
||||
// For this to work you need to install the CMU firewire DCAM drivers,
|
||||
|
@@ -89,7 +89,7 @@ Thanks to:
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
#if _MSC_VER >= 100
|
||||
#if defined _MSC_VER && _MSC_VER >= 100
|
||||
#pragma warning(disable: 4995)
|
||||
#endif
|
||||
|
||||
@@ -103,17 +103,18 @@ Thanks to:
|
||||
#include <vector>
|
||||
|
||||
//Include Directshow stuff here so we don't worry about needing all the h files.
|
||||
#if _MSC_VER >= 1500
|
||||
#include "DShow.h"
|
||||
#include "strmif.h"
|
||||
#include "Aviriff.h"
|
||||
#include "dvdmedia.h"
|
||||
#include "bdaiface.h"
|
||||
#if defined _MSC_VER && _MSC_VER >= 1500
|
||||
# include "DShow.h"
|
||||
# include "strmif.h"
|
||||
# include "Aviriff.h"
|
||||
# include "dvdmedia.h"
|
||||
# include "bdaiface.h"
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#define __extension__
|
||||
typedef BOOL WINBOOL;
|
||||
# ifdef _MSC_VER
|
||||
# define __extension__
|
||||
typedef BOOL WINBOOL;
|
||||
#endif
|
||||
|
||||
#include "dshow/dshow.h"
|
||||
#include "dshow/dvdmedia.h"
|
||||
#include "dshow/bdatypes.h"
|
||||
@@ -133,6 +134,8 @@ public:
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE Clone(
|
||||
/* [out] */ IEnumPIDMap **ppIEnumPIDMap) = 0;
|
||||
|
||||
virtual ~IEnumPIDMap() {}
|
||||
};
|
||||
|
||||
interface IMPEG2PIDMap : public IUnknown
|
||||
@@ -148,6 +151,8 @@ interface IMPEG2PIDMap : public IUnknown
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE EnumPIDMap(
|
||||
/* [out] */ IEnumPIDMap **pIEnumPIDMap) = 0;
|
||||
|
||||
virtual ~IMPEG2PIDMap() {}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -234,6 +239,7 @@ interface ISampleGrabberCB : public IUnknown
|
||||
BYTE *pBuffer,
|
||||
LONG BufferLen) = 0;
|
||||
|
||||
virtual ~ISampleGrabberCB() {}
|
||||
};
|
||||
|
||||
interface ISampleGrabber : public IUnknown
|
||||
@@ -261,6 +267,7 @@ interface ISampleGrabber : public IUnknown
|
||||
ISampleGrabberCB *pCallback,
|
||||
LONG WhichMethodToCallback) = 0;
|
||||
|
||||
virtual ~ISampleGrabber() {}
|
||||
};
|
||||
|
||||
#ifndef HEADER
|
||||
@@ -519,12 +526,12 @@ class videoInput{
|
||||
|
||||
//Manual control over settings thanks.....
|
||||
//These are experimental for now.
|
||||
bool setVideoSettingFilter(int deviceID, long Property, long lValue, long Flags = NULL, bool useDefaultValue = false);
|
||||
bool setVideoSettingFilterPct(int deviceID, long Property, float pctValue, long Flags = NULL);
|
||||
bool setVideoSettingFilter(int deviceID, long Property, long lValue, long Flags = 0, bool useDefaultValue = false);
|
||||
bool setVideoSettingFilterPct(int deviceID, long Property, float pctValue, long Flags = 0);
|
||||
bool getVideoSettingFilter(int deviceID, long Property, long &min, long &max, long &SteppingDelta, long ¤tValue, long &flags, long &defaultValue);
|
||||
|
||||
bool setVideoSettingCamera(int deviceID, long Property, long lValue, long Flags = NULL, bool useDefaultValue = false);
|
||||
bool setVideoSettingCameraPct(int deviceID, long Property, float pctValue, long Flags = NULL);
|
||||
bool setVideoSettingCamera(int deviceID, long Property, long lValue, long Flags = 0, bool useDefaultValue = false);
|
||||
bool setVideoSettingCameraPct(int deviceID, long Property, float pctValue, long Flags = 0);
|
||||
bool getVideoSettingCamera(int deviceID, long Property, long &min, long &max, long &SteppingDelta, long ¤tValue, long &flags, long &defaultValue);
|
||||
|
||||
//bool setVideoSettingCam(int deviceID, long Property, long lValue, long Flags = NULL, bool useDefaultValue = false);
|
||||
@@ -597,7 +604,7 @@ class videoInput{
|
||||
|
||||
/////////////////////////// HANDY FUNCTIONS /////////////////////////////
|
||||
|
||||
void MyFreeMediaType(AM_MEDIA_TYPE& mt){
|
||||
static void MyFreeMediaType(AM_MEDIA_TYPE& mt){
|
||||
if (mt.cbFormat != 0)
|
||||
{
|
||||
CoTaskMemFree((PVOID)mt.pbFormat);
|
||||
@@ -612,7 +619,7 @@ void MyFreeMediaType(AM_MEDIA_TYPE& mt){
|
||||
}
|
||||
}
|
||||
|
||||
void MyDeleteMediaType(AM_MEDIA_TYPE *pmt)
|
||||
static void MyDeleteMediaType(AM_MEDIA_TYPE *pmt)
|
||||
{
|
||||
if (pmt != NULL)
|
||||
{
|
||||
@@ -642,7 +649,7 @@ public:
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
~SampleGrabberCallback(){
|
||||
virtual ~SampleGrabberCallback(){
|
||||
ptrBuffer = NULL;
|
||||
DeleteCriticalSection(&critSection);
|
||||
CloseHandle(hEvent);
|
||||
@@ -849,7 +856,7 @@ void videoDevice::NukeDownstream(IBaseFilter *pBF){
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void videoDevice::destroyGraph(){
|
||||
HRESULT hr = NULL;
|
||||
HRESULT hr = 0;
|
||||
//int FuncRetval=0;
|
||||
//int NumFilters=0;
|
||||
|
||||
@@ -867,7 +874,7 @@ void videoDevice::destroyGraph(){
|
||||
IBaseFilter * pFilter = NULL;
|
||||
if (pEnum->Next(1, &pFilter, &cFetched) == S_OK)
|
||||
{
|
||||
FILTER_INFO FilterInfo={0};
|
||||
FILTER_INFO FilterInfo;
|
||||
memset(&FilterInfo, 0, sizeof(FilterInfo));
|
||||
hr = pFilter->QueryFilterInfo(&FilterInfo);
|
||||
FilterInfo.pGraph->Release();
|
||||
@@ -1620,14 +1627,15 @@ void __cdecl videoInput::basicThread(void * objPtr){
|
||||
void videoInput::showSettingsWindow(int id){
|
||||
|
||||
if(isDeviceSetup(id)){
|
||||
HANDLE myTempThread;
|
||||
//HANDLE myTempThread;
|
||||
|
||||
//we reconnect to the device as we have freed our reference to it
|
||||
//why have we freed our reference? because there seemed to be an issue
|
||||
//with some mpeg devices if we didn't
|
||||
HRESULT hr = getDevice(&VDList[id]->pVideoInputFilter, id, VDList[id]->wDeviceName, VDList[id]->nDeviceName);
|
||||
if(hr == S_OK){
|
||||
myTempThread = (HANDLE)_beginthread(basicThread, 0, (void *)&VDList[id]);
|
||||
//myTempThread = (HANDLE)
|
||||
_beginthread(basicThread, 0, (void *)&VDList[id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1705,7 +1713,7 @@ bool videoInput::setVideoSettingFilterPct(int deviceID, long Property, float pct
|
||||
float halfStep = (float)stepAmnt * 0.5f;
|
||||
if( mod < halfStep ) rasterValue -= mod;
|
||||
else rasterValue += stepAmnt - mod;
|
||||
printf("RASTER - pctValue is %f - value is %i - step is %i - mod is %i - rasterValue is %i\n", pctValue, value, stepAmnt, mod, rasterValue);
|
||||
printf("RASTER - pctValue is %f - value is %li - step is %li - mod is %li - rasterValue is %li\n", pctValue, value, stepAmnt, mod, rasterValue);
|
||||
}
|
||||
|
||||
return setVideoSettingFilter(deviceID, Property, rasterValue, Flags, false);
|
||||
@@ -1795,7 +1803,7 @@ bool videoInput::setVideoSettingCameraPct(int deviceID, long Property, float pct
|
||||
float halfStep = (float)stepAmnt * 0.5f;
|
||||
if( mod < halfStep ) rasterValue -= mod;
|
||||
else rasterValue += stepAmnt - mod;
|
||||
printf("RASTER - pctValue is %f - value is %i - step is %i - mod is %i - rasterValue is %i\n", pctValue, value, stepAmnt, mod, rasterValue);
|
||||
printf("RASTER - pctValue is %f - value is %li - step is %li - mod is %li - rasterValue is %li\n", pctValue, value, stepAmnt, mod, rasterValue);
|
||||
}
|
||||
|
||||
return setVideoSettingCamera(deviceID, Property, rasterValue, Flags, false);
|
||||
@@ -1920,7 +1928,7 @@ bool videoInput::restartDevice(int id){
|
||||
stopDevice(id);
|
||||
|
||||
//set our fps if needed
|
||||
if( avgFrameTime != -1){
|
||||
if( avgFrameTime != (unsigned long)-1){
|
||||
VDList[id]->requestedFrameTime = avgFrameTime;
|
||||
}
|
||||
|
||||
@@ -2300,7 +2308,7 @@ static void findClosestSizeAndSubtype(videoDevice * VD, int widthIn, int heightI
|
||||
//find perfect match or closest size
|
||||
int nearW = 9999999;
|
||||
int nearH = 9999999;
|
||||
bool foundClosestMatch = true;
|
||||
//bool foundClosestMatch = true;
|
||||
|
||||
int iCount = 0;
|
||||
int iSize = 0;
|
||||
@@ -2360,7 +2368,7 @@ static void findClosestSizeAndSubtype(videoDevice * VD, int widthIn, int heightI
|
||||
|
||||
//see if we have an exact match!
|
||||
if(exactMatchX && exactMatchY){
|
||||
foundClosestMatch = false;
|
||||
//foundClosestMatch = false;
|
||||
exactMatch = true;
|
||||
|
||||
widthOut = widthIn;
|
||||
|
@@ -43,7 +43,7 @@
|
||||
|
||||
#include <vfw.h>
|
||||
|
||||
#if _MSC_VER >= 1200
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning( disable: 4711 )
|
||||
#endif
|
||||
|
||||
|
@@ -43,7 +43,7 @@
|
||||
|
||||
#if defined WIN32 || defined _WIN32
|
||||
|
||||
#if _MSC_VER >= 1200
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning( disable: 4710 )
|
||||
#endif
|
||||
|
||||
@@ -61,6 +61,10 @@
|
||||
#ifndef __inout
|
||||
# define __inout
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic ignored "-Wmissing-declarations"
|
||||
#endif
|
||||
#include <MultiMon.h>
|
||||
|
||||
#include <commctrl.h>
|
||||
@@ -166,7 +170,7 @@ typedef struct CvWindow
|
||||
HGDIOBJ image;
|
||||
int last_key;
|
||||
int flags;
|
||||
int status;//0 normal, 1 fullscreen (YV)
|
||||
int status;//0 normal, 1 fullscreen (YV)
|
||||
|
||||
CvMouseCallback on_mouse;
|
||||
void* on_mouse_param;
|
||||
@@ -360,7 +364,7 @@ icvSaveWindowPos( const char* name, CvRect rect )
|
||||
char rootKey[1024];
|
||||
strcpy( szKey, icvWindowPosRootKey );
|
||||
strcat( szKey, name );
|
||||
|
||||
|
||||
if( RegOpenKeyEx( HKEY_CURRENT_USER,szKey,0,KEY_READ,&hkey) != ERROR_SUCCESS )
|
||||
{
|
||||
HKEY hroot;
|
||||
@@ -405,7 +409,7 @@ icvSaveWindowPos( const char* name, CvRect rect )
|
||||
if( RegOpenKeyEx( HKEY_CURRENT_USER,szKey,0,KEY_WRITE,&hkey) != ERROR_SUCCESS )
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
RegSetValueEx(hkey, "Left", 0, REG_DWORD, (BYTE*)&rect.x, sizeof(rect.x));
|
||||
RegSetValueEx(hkey, "Top", 0, REG_DWORD, (BYTE*)&rect.y, sizeof(rect.y));
|
||||
RegSetValueEx(hkey, "Width", 0, REG_DWORD, (BYTE*)&rect.width, sizeof(rect.width));
|
||||
@@ -415,9 +419,9 @@ icvSaveWindowPos( const char* name, CvRect rect )
|
||||
|
||||
double cvGetModeWindow_W32(const char* name)//YV
|
||||
{
|
||||
double result = -1;
|
||||
|
||||
CV_FUNCNAME( "cvGetModeWindow_W32" );
|
||||
double result = -1;
|
||||
|
||||
CV_FUNCNAME( "cvGetModeWindow_W32" );
|
||||
|
||||
__BEGIN__;
|
||||
|
||||
@@ -429,75 +433,75 @@ double cvGetModeWindow_W32(const char* name)//YV
|
||||
window = icvFindWindowByName( name );
|
||||
if (!window)
|
||||
EXIT; // keep silence here
|
||||
|
||||
|
||||
result = window->status;
|
||||
|
||||
|
||||
__END__;
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
void cvSetModeWindow_W32( const char* name, double prop_value)//Yannick Verdie
|
||||
{
|
||||
CV_FUNCNAME( "cvSetModeWindow_W32" );
|
||||
CV_FUNCNAME( "cvSetModeWindow_W32" );
|
||||
|
||||
__BEGIN__;
|
||||
__BEGIN__;
|
||||
|
||||
CvWindow* window;
|
||||
CvWindow* window;
|
||||
|
||||
if(!name)
|
||||
CV_ERROR( CV_StsNullPtr, "NULL name string" );
|
||||
if(!name)
|
||||
CV_ERROR( CV_StsNullPtr, "NULL name string" );
|
||||
|
||||
window = icvFindWindowByName( name );
|
||||
if( !window )
|
||||
CV_ERROR( CV_StsNullPtr, "NULL window" );
|
||||
window = icvFindWindowByName( name );
|
||||
if( !window )
|
||||
CV_ERROR( CV_StsNullPtr, "NULL window" );
|
||||
|
||||
if(window->flags & CV_WINDOW_AUTOSIZE)//if the flag CV_WINDOW_AUTOSIZE is set
|
||||
EXIT;
|
||||
if(window->flags & CV_WINDOW_AUTOSIZE)//if the flag CV_WINDOW_AUTOSIZE is set
|
||||
EXIT;
|
||||
|
||||
{
|
||||
DWORD dwStyle = (DWORD)GetWindowLongPtr(window->frame, GWL_STYLE);
|
||||
CvRect position;
|
||||
{
|
||||
DWORD dwStyle = (DWORD)GetWindowLongPtr(window->frame, GWL_STYLE);
|
||||
CvRect position;
|
||||
|
||||
if (window->status==CV_WINDOW_FULLSCREEN && prop_value==CV_WINDOW_NORMAL)
|
||||
{
|
||||
icvLoadWindowPos(window->name,position );
|
||||
SetWindowLongPtr(window->frame, GWL_STYLE, dwStyle | WS_CAPTION | WS_THICKFRAME);
|
||||
if (window->status==CV_WINDOW_FULLSCREEN && prop_value==CV_WINDOW_NORMAL)
|
||||
{
|
||||
icvLoadWindowPos(window->name,position );
|
||||
SetWindowLongPtr(window->frame, GWL_STYLE, dwStyle | WS_CAPTION | WS_THICKFRAME);
|
||||
|
||||
SetWindowPos(window->frame, HWND_TOP, position.x, position.y , position.width,position.height, SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||
window->status=CV_WINDOW_NORMAL;
|
||||
SetWindowPos(window->frame, HWND_TOP, position.x, position.y , position.width,position.height, SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||
window->status=CV_WINDOW_NORMAL;
|
||||
|
||||
EXIT;
|
||||
}
|
||||
EXIT;
|
||||
}
|
||||
|
||||
if (window->status==CV_WINDOW_NORMAL && prop_value==CV_WINDOW_FULLSCREEN)
|
||||
{
|
||||
//save dimension
|
||||
RECT rect;
|
||||
GetWindowRect(window->frame, &rect);
|
||||
CvRect RectCV = cvRect(rect.left, rect.top,rect.right - rect.left, rect.bottom - rect.top);
|
||||
icvSaveWindowPos(window->name,RectCV );
|
||||
if (window->status==CV_WINDOW_NORMAL && prop_value==CV_WINDOW_FULLSCREEN)
|
||||
{
|
||||
//save dimension
|
||||
RECT rect;
|
||||
GetWindowRect(window->frame, &rect);
|
||||
CvRect RectCV = cvRect(rect.left, rect.top,rect.right - rect.left, rect.bottom - rect.top);
|
||||
icvSaveWindowPos(window->name,RectCV );
|
||||
|
||||
//Look at coordinate for fullscreen
|
||||
HMONITOR hMonitor;
|
||||
MONITORINFO mi;
|
||||
hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST);
|
||||
//Look at coordinate for fullscreen
|
||||
HMONITOR hMonitor;
|
||||
MONITORINFO mi;
|
||||
hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST);
|
||||
|
||||
mi.cbSize = sizeof(mi);
|
||||
GetMonitorInfo(hMonitor, &mi);
|
||||
mi.cbSize = sizeof(mi);
|
||||
GetMonitorInfo(hMonitor, &mi);
|
||||
|
||||
//fullscreen
|
||||
position.x=mi.rcMonitor.left;position.y=mi.rcMonitor.top;
|
||||
position.width=mi.rcMonitor.right - mi.rcMonitor.left;position.height=mi.rcMonitor.bottom - mi.rcMonitor.top;
|
||||
SetWindowLongPtr(window->frame, GWL_STYLE, dwStyle & ~WS_CAPTION & ~WS_THICKFRAME);
|
||||
//fullscreen
|
||||
position.x=mi.rcMonitor.left;position.y=mi.rcMonitor.top;
|
||||
position.width=mi.rcMonitor.right - mi.rcMonitor.left;position.height=mi.rcMonitor.bottom - mi.rcMonitor.top;
|
||||
SetWindowLongPtr(window->frame, GWL_STYLE, dwStyle & ~WS_CAPTION & ~WS_THICKFRAME);
|
||||
|
||||
SetWindowPos(window->frame, HWND_TOP, position.x, position.y , position.width,position.height, SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||
window->status=CV_WINDOW_FULLSCREEN;
|
||||
SetWindowPos(window->frame, HWND_TOP, position.x, position.y , position.width,position.height, SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||
window->status=CV_WINDOW_FULLSCREEN;
|
||||
|
||||
EXIT;
|
||||
}
|
||||
}
|
||||
EXIT;
|
||||
}
|
||||
}
|
||||
|
||||
__END__;
|
||||
__END__;
|
||||
}
|
||||
|
||||
double cvGetPropWindowAutoSize_W32(const char* name)
|
||||
@@ -526,9 +530,9 @@ double cvGetPropWindowAutoSize_W32(const char* name)
|
||||
|
||||
double cvGetRatioWindow_W32(const char* name)
|
||||
{
|
||||
double result = -1;
|
||||
|
||||
CV_FUNCNAME( "cvGetRatioWindow_W32" );
|
||||
double result = -1;
|
||||
|
||||
CV_FUNCNAME( "cvGetRatioWindow_W32" );
|
||||
|
||||
__BEGIN__;
|
||||
|
||||
@@ -540,20 +544,20 @@ double cvGetRatioWindow_W32(const char* name)
|
||||
window = icvFindWindowByName( name );
|
||||
if (!window)
|
||||
EXIT; // keep silence here
|
||||
|
||||
|
||||
result = static_cast<double>(window->width) / window->height;
|
||||
|
||||
|
||||
__END__;
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
double cvGetOpenGlProp_W32(const char* name)
|
||||
{
|
||||
double result = -1;
|
||||
double result = -1;
|
||||
|
||||
#ifdef HAVE_OPENGL
|
||||
CV_FUNCNAME( "cvGetOpenGlProp_W32" );
|
||||
#ifdef HAVE_OPENGL
|
||||
CV_FUNCNAME( "cvGetOpenGlProp_W32" );
|
||||
|
||||
__BEGIN__;
|
||||
|
||||
@@ -565,14 +569,14 @@ double cvGetOpenGlProp_W32(const char* name)
|
||||
window = icvFindWindowByName( name );
|
||||
if (!window)
|
||||
EXIT; // keep silence here
|
||||
|
||||
|
||||
result = window->useGl;
|
||||
|
||||
|
||||
__END__;
|
||||
#endif
|
||||
(void)name;
|
||||
(void)name;
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -626,7 +630,7 @@ namespace
|
||||
void generateBitmapFont(const std::string& family, int height, int weight, bool italic, bool underline, int start, int count, int base) const;
|
||||
|
||||
bool isGlContextInitialized() const;
|
||||
|
||||
|
||||
PFNGLGENBUFFERSPROC glGenBuffersExt;
|
||||
PFNGLDELETEBUFFERSPROC glDeleteBuffersExt;
|
||||
|
||||
@@ -787,8 +791,8 @@ namespace
|
||||
weight, // font weight
|
||||
italic ? TRUE : FALSE, // Italic
|
||||
underline ? TRUE : FALSE, // Underline
|
||||
FALSE, // StrikeOut
|
||||
ANSI_CHARSET, // CharSet
|
||||
FALSE, // StrikeOut
|
||||
ANSI_CHARSET, // CharSet
|
||||
OUT_TT_PRECIS, // OutPrecision
|
||||
CLIP_DEFAULT_PRECIS, // ClipPrecision
|
||||
ANTIALIASED_QUALITY, // Quality
|
||||
@@ -870,12 +874,12 @@ namespace
|
||||
0, // Shift Bit Ignored
|
||||
0, // No Accumulation Buffer
|
||||
0, 0, 0, 0, // Accumulation Bits Ignored
|
||||
32, // 32 Bit Z-Buffer (Depth Buffer)
|
||||
32, // 32 Bit Z-Buffer (Depth Buffer)
|
||||
0, // No Stencil Buffer
|
||||
0, // No Auxiliary Buffer
|
||||
PFD_MAIN_PLANE, // Main Drawing Layer
|
||||
0, // Reserved
|
||||
0, 0, 0 // Layer Masks Ignored
|
||||
0, 0, 0 // Layer Masks Ignored
|
||||
};
|
||||
|
||||
hGLDC = GetDC(hWnd);
|
||||
@@ -915,7 +919,7 @@ namespace
|
||||
window->hGLRC = NULL;
|
||||
}
|
||||
|
||||
if (window->dc)
|
||||
if (window->dc)
|
||||
{
|
||||
ReleaseDC(window->hwnd, window->dc);
|
||||
window->dc = NULL;
|
||||
@@ -935,7 +939,7 @@ namespace
|
||||
if (!wglMakeCurrent(window->dc, window->hGLRC))
|
||||
CV_ERROR( CV_OpenGlApiCallError, "Can't Activate The GL Rendering Context" );
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
if (window->glDrawCallback)
|
||||
window->glDrawCallback(window->glDrawData);
|
||||
@@ -1009,7 +1013,7 @@ CV_IMPL int cvNamedWindow( const char* name, int flags )
|
||||
|
||||
ShowWindow(mainhWnd, SW_SHOW);
|
||||
|
||||
//YV- remove one border by changing the style
|
||||
//YV- remove one border by changing the style
|
||||
hWnd = CreateWindow("HighGUI class", "", (defStyle & ~WS_SIZEBOX) | WS_CHILD, CW_USEDEFAULT, 0, rect.width, rect.height, mainhWnd, 0, hg_hinstance, 0);
|
||||
if( !hWnd )
|
||||
CV_ERROR( CV_StsError, "Frame window can not be created" );
|
||||
@@ -1400,16 +1404,16 @@ cvShowImage( const char* name, const CvArr* arr )
|
||||
CV_ERROR( CV_StsNullPtr, "NULL name" );
|
||||
|
||||
window = icvFindWindowByName(name);
|
||||
if(!window)
|
||||
{
|
||||
if(!window)
|
||||
{
|
||||
#ifndef HAVE_OPENGL
|
||||
cvNamedWindow(name, CV_WINDOW_AUTOSIZE);
|
||||
cvNamedWindow(name, CV_WINDOW_AUTOSIZE);
|
||||
#else
|
||||
cvNamedWindow(name, CV_WINDOW_AUTOSIZE | CV_WINDOW_OPENGL);
|
||||
cvNamedWindow(name, CV_WINDOW_AUTOSIZE | CV_WINDOW_OPENGL);
|
||||
#endif
|
||||
|
||||
window = icvFindWindowByName(name);
|
||||
}
|
||||
window = icvFindWindowByName(name);
|
||||
}
|
||||
|
||||
if( !window || !arr )
|
||||
EXIT; // keep silence here.
|
||||
@@ -1467,6 +1471,7 @@ cvShowImage( const char* name, const CvArr* arr )
|
||||
__END__;
|
||||
}
|
||||
|
||||
#if 0
|
||||
CV_IMPL void
|
||||
cvShowImageHWND(HWND w_hWnd, const CvArr* arr)
|
||||
{
|
||||
@@ -1494,7 +1499,7 @@ cvShowImageHWND(HWND w_hWnd, const CvArr* arr)
|
||||
if( CV_IS_IMAGE_HDR( arr ) )
|
||||
origin = ((IplImage*)arr)->origin;
|
||||
|
||||
CV_CALL( image = cvGetMat( arr, &stub ) );
|
||||
CV_CALL( image = cvGetMat( arr, &stub ) );
|
||||
|
||||
if ( hdc )
|
||||
{
|
||||
@@ -1512,7 +1517,7 @@ cvShowImageHWND(HWND w_hWnd, const CvArr* arr)
|
||||
dst_ptr = bmp.bmBits;
|
||||
}
|
||||
|
||||
if( size.cx != image->width || size.cy != image->height || channels != channels0 )
|
||||
if( size.cx != image->width || size.cy != image->height || channels != channels0 )
|
||||
{
|
||||
changed_size = true;
|
||||
|
||||
@@ -1544,6 +1549,7 @@ cvShowImageHWND(HWND w_hWnd, const CvArr* arr)
|
||||
|
||||
__END__;
|
||||
}
|
||||
#endif
|
||||
|
||||
CV_IMPL void cvResizeWindow(const char* name, int width, int height )
|
||||
{
|
||||
@@ -1666,7 +1672,7 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
// Snap window to screen edges with multi-monitor support. // Adi Shavit
|
||||
LPWINDOWPOS pos = (LPWINDOWPOS)lParam;
|
||||
|
||||
|
||||
RECT rect;
|
||||
GetWindowRect(window->frame, &rect);
|
||||
|
||||
@@ -1679,15 +1685,15 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
||||
|
||||
const int SNAP_DISTANCE = 15;
|
||||
|
||||
if (abs(pos->x - mi.rcMonitor.left) <= SNAP_DISTANCE)
|
||||
if (abs(pos->x - mi.rcMonitor.left) <= SNAP_DISTANCE)
|
||||
pos->x = mi.rcMonitor.left; // snap to left edge
|
||||
else
|
||||
else
|
||||
if (abs(pos->x + pos->cx - mi.rcMonitor.right) <= SNAP_DISTANCE)
|
||||
pos->x = mi.rcMonitor.right - pos->cx; // snap to right edge
|
||||
|
||||
if (abs(pos->y - mi.rcMonitor.top) <= SNAP_DISTANCE)
|
||||
pos->y = mi.rcMonitor.top; // snap to top edge
|
||||
else
|
||||
else
|
||||
if (abs(pos->y + pos->cy - mi.rcMonitor.bottom) <= SNAP_DISTANCE)
|
||||
pos->y = mi.rcMonitor.bottom - pos->cy; // snap to bottom edge
|
||||
}
|
||||
@@ -1848,9 +1854,9 @@ static LRESULT CALLBACK HighGUIProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
|
||||
EndPaint(hwnd, &paint);
|
||||
}
|
||||
#ifdef HAVE_OPENGL
|
||||
else if(window->useGl)
|
||||
else if(window->useGl)
|
||||
{
|
||||
drawGl(window);
|
||||
drawGl(window);
|
||||
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user