]> rtime.felk.cvut.cz Git - opencv.git/commitdiff
on Mac make use of libjpeg, libpng etc. by default, as Quicktime jpeg codec gives...
authorvp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Thu, 23 Jul 2009 22:12:11 +0000 (22:12 +0000)
committervp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Thu, 23 Jul 2009 22:12:11 +0000 (22:12 +0000)
git-svn-id: https://code.ros.org/svn/opencv/trunk@1974 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08

opencv/CMakeLists.txt
opencv/samples/c/drawing.c
opencv/src/highgui/window_carbon.cpp

index bd5950a1192696b094134cdc62b2cfd71b5e023b..9b445817b2255c52845ee2cf52a333b9b510b59a 100644 (file)
@@ -145,7 +145,7 @@ set(BUILD_TESTS ON CACHE BOOL "Build tests")
 
 # Build 3rdparty libraries under unix
 # ===================================================
-if(WIN32)
+if(WIN32 OR APPLE)
        set(OPENCV_BUILD_3RDPARTY_LIBS TRUE  CACHE BOOL "Build 3rd party libraries")
 else()
        set(OPENCV_BUILD_3RDPARTY_LIBS FALSE CACHE BOOL "Build 3rd party libraries")
index 81f68faa772552a97180ad88876fd003498ee597..6ce20665357a6f62df7a5f995af06e2973d431b5 100644 (file)
@@ -45,6 +45,7 @@ int main( int argc, char** argv )
     cvNamedWindow(wndname, 1 );
     cvZero( image );
     cvShowImage(wndname,image);
+    cvWaitKey(DELAY);
 
     rng = cvRNG((unsigned)-1);
     pt[0] = &(ptt[0]);
@@ -62,7 +63,7 @@ int main( int argc, char** argv )
 
         cvLine( image, pt1, pt2, random_color(&rng), cvRandInt(&rng)%10, line_type, 0 );
         cvShowImage(wndname,image);
-        cvWaitKey(DELAY);
+        if(cvWaitKey(DELAY) >= 0) return 0;
     }
 
     for (i = 0; i< NUMBER; i++)
@@ -74,7 +75,7 @@ int main( int argc, char** argv )
 
         cvRectangle( image,pt1, pt2, random_color(&rng), cvRandInt(&rng)%10-1, line_type, 0 );
         cvShowImage(wndname,image);
-        cvWaitKey(DELAY);
+        if(cvWaitKey(DELAY) >= 0) return 0;
     }
 
     for (i = 0; i< NUMBER; i++)
@@ -88,7 +89,7 @@ int main( int argc, char** argv )
         cvEllipse( image, pt1, sz, angle, angle - 100, angle + 200,
                    random_color(&rng), cvRandInt(&rng)%10-1, line_type, 0 );
         cvShowImage(wndname,image);
-        cvWaitKey(DELAY);
+        if(cvWaitKey(DELAY) >= 0) return 0;
     }
 
     for (i = 0; i< NUMBER; i++)
@@ -108,7 +109,7 @@ int main( int argc, char** argv )
 
         cvPolyLine( image, pt, arr, 2, 1, random_color(&rng), cvRandInt(&rng)%10, line_type, 0 );
         cvShowImage(wndname,image);
-        cvWaitKey(DELAY);
+        if(cvWaitKey(DELAY) >= 0) return 0;
     }
 
     for (i = 0; i< NUMBER; i++)
@@ -128,7 +129,7 @@ int main( int argc, char** argv )
 
         cvFillPoly( image, pt, arr, 2, random_color(&rng), line_type, 0 );
         cvShowImage(wndname,image);
-        cvWaitKey(DELAY);
+        if(cvWaitKey(DELAY) >= 0) return 0;
     }
 
     for (i = 0; i< NUMBER; i++)
@@ -139,7 +140,7 @@ int main( int argc, char** argv )
         cvCircle( image, pt1, cvRandInt(&rng)%300, random_color(&rng),
                   cvRandInt(&rng)%10-1, line_type, 0 );
         cvShowImage(wndname,image);
-        cvWaitKey(DELAY);
+        if(cvWaitKey(DELAY) >= 0) return 0;
     }
 
     for (i = 1; i< NUMBER; i++)
@@ -153,7 +154,7 @@ int main( int argc, char** argv )
 
         cvPutText( image, "Testing text rendering!", pt1, &font, random_color(&rng));
         cvShowImage(wndname,image);
-        cvWaitKey(DELAY);
+        if(cvWaitKey(DELAY) >= 0) return 0;
     }
 
     cvInitFont( &font, CV_FONT_HERSHEY_COMPLEX, 3, 3, 0.0, 5, line_type );
@@ -169,7 +170,7 @@ int main( int argc, char** argv )
         cvSubS( image2, cvScalarAll(i), image, 0 );
         cvPutText( image, "OpenCV forever!", pt1, &font, CV_RGB(255,i,i));
         cvShowImage(wndname,image);
-        cvWaitKey(DELAY);
+        if(cvWaitKey(DELAY) >= 0) return 0;
     }
 
     // Wait for a key stroke; the same function arranges events processing
index 46124b879ba958d6705da7336a368189ae20c3b0..9285211124df86e8dd65db2a15ad0bb18c84c6c1 100644 (file)
@@ -276,7 +276,7 @@ static void icvPutImage( CvWindow* window )
 
 static void icvUpdateWindowSize( const CvWindow* window )
 {
-    int width = 0, height = 240; /* init \88 al taille de base de l'image*/
+    int width = 0, height = 240; /* init à al taille de base de l'image*/
     Rect globalBounds;
     
     GetWindowBounds(window->window, kWindowContentRgn, &globalBounds);
@@ -883,7 +883,7 @@ static pascal OSStatus windowEventHandler(EventHandlerCallRef nextHandler, Event
                     ly = ly * window->imageHeight / (content.bottom - content.top - window->trackbarheight);
                 }
 
-                if (lx>0 && ly >0){ /* a remettre dans les coordonn\8ees locale */
+                if (lx>0 && ly >0){ /* a remettre dans les coordonnées locale */
                     window->on_mouse (event, lx, ly, flags, window->on_mouse_param);
                     return noErr;
                 }
@@ -938,13 +938,18 @@ CV_IMPL int cvWaitKey (int maxWait)
        
        // wait at least for one event (to allow mouse, etc. processing), exit if maxWait milliseconds passed (nullEvent)
        UInt32 start = TickCount();
+    int iters=0;
        do
        {
                // remaining time until maxWait is over
                UInt32 wait = EventTimeToTicks (maxWait / 1000.0) - (TickCount() - start);
-               if (wait < 0)
-                       wait = 0;
-               
+               if ((int)wait <= 0)
+        {
+            if( maxWait > 0 && iters > 0 )
+                break;
+            wait = 1;
+        }
+        iters++;
         WaitNextEvent (everyEvent, &theEvent, maxWait > 0 ? wait : kDurationForever, NULL);
        }
        while (lastKey == NO_KEY  &&  theEvent.what != nullEvent);