~ubuntu-branches/ubuntu/trusty/psychtoolbox-3/trusty-proposed

« back to all changes in this revision

Viewing changes to PsychSourceGL/Source/Common/Screen/SCREENRect.c

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2013-11-19 23:34:50 UTC
  • mfrom: (3.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20131119233450-f7nf92vb8qavjmk8
Tags: 3.0.11.20131017.dfsg1-3
Upload to unsable since fresh glew has arrived to sid!

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include "Screen.h"
23
23
 
24
24
// If you change the useString then also change the corresponding synopsis string in ScreenSynopsis.c
25
 
static char useString[] = "rect=Screen('Rect', windowPointerOrScreenNumber);";
26
 
//                                             1
 
25
static char useString[] = "rect=Screen('Rect', windowPointerOrScreenNumber [, realFBSize=0]);";
 
26
//                                             1                              2
27
27
static char synopsisString[] = 
28
28
        "Get local rect of window or screen. This has its top-left corner always at (0,0) "
29
29
        "and encodes the useable size of the window or screen. E.g., in certain stereo "
31
31
        "stimulus drawing may be much smaller than the real area occupied by the window. "
32
32
        "Example: In interleaved stereo modes, the effective useable height of a window "
33
33
        "is only half the real height of the window. Use this function to get the actual "
34
 
        "useable drawing area for a window or screen. ";
35
 
static char seeAlsoString[] = "";       
 
34
        "useable drawing area for a window or screen.\n"
 
35
    "If the optional 'realFBSize' flag is set to 1, then the function returns the "
 
36
    "real size of the windows framebuffer. This is mostly for Psychtoolbox internal "
 
37
    "use, not for regular user-code.\n";
 
38
static char seeAlsoString[] = "";
36
39
 
37
40
PsychError SCREENRect(void)  
38
41
{
40
43
        PsychWindowRecordType *windowRecord;
41
44
        int screenNumber;
42
45
        PsychRectType rect; 
 
46
    int realFBSize = 0;
43
47
    
44
48
        //all sub functions should have these two lines
45
49
        PsychPushHelp(useString, synopsisString,seeAlsoString);
46
50
        if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);};
47
51
        
48
52
        //check for superfluous arguments
49
 
        PsychErrorExit(PsychCapNumInputArgs(1));                //The maximum number of inputs
 
53
        PsychErrorExit(PsychCapNumInputArgs(2));                //The maximum number of inputs
50
54
        PsychErrorExit(PsychRequireNumInputArgs(1));    //Insist that the argument be present.   
51
55
        PsychErrorExit(PsychCapNumOutputArgs(1));               //The maximum number of outputs
52
56
 
 
57
    // Get optional 'realFBSize' flag: Defaults to zero.
 
58
    PsychCopyInIntegerArg(2, FALSE, &realFBSize);
 
59
    
53
60
        if(PsychIsScreenNumberArg(1)){
54
61
                PsychCopyInScreenNumberArg(1, TRUE, &screenNumber);
55
62
                PsychGetScreenRect(screenNumber, rect);
57
64
        }else if(PsychIsWindowIndexArg(1)){
58
65
        PsychAllocInWindowRecordArg(1, TRUE, &windowRecord);
59
66
        PsychOSProcessEvents(windowRecord, 0);          
60
 
        PsychCopyOutRectArg(1,FALSE, windowRecord->clientrect);
 
67
        PsychCopyOutRectArg(1, FALSE, (realFBSize) ? windowRecord->rect : windowRecord->clientrect);
61
68
        }else
62
69
                PsychErrorExitMsg(PsychError_user, "Argument was recognized as neither a window index nor a screen pointer");
63
70