forked from wchristian/OpenGL.pm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EL-ELI.c
37 lines (32 loc) · 848 Bytes
/
EL-ELI.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
GLvoid * EL(SV * sv, int needlen)
{
STRLEN skip = 0;
SV * svref;
if (SvREADONLY(sv))
croak("Readonly value for buffer");
if(SvROK(sv)) {
svref = SvRV(sv);
sv = svref;
}
else
{
#ifdef USE_STRICT_UNGLOB
if (SvFAKE(sv) && SvTYPE(sv) == SVt_PVGV)
sv_unglob(sv);
#endif
SvUPGRADE(sv, SVt_PV);
SvGROW(sv, (unsigned int)(needlen + 1));
SvPOK_on(sv);
SvCUR_set(sv, needlen);
*SvEND(sv) = '\0'; /* Why is this here? -chm */
}
return SvPV_force(sv, skip);
}
GLvoid * ELI(SV * sv, GLsizei width, GLsizei height,
GLenum format, GLenum type, int mode)
{
int needlen = 0;
if (!SvROK(sv)) /* don't calc length if arg is a perl ref */
needlen = gl_pixelbuffer_size(format, width, height, type, mode);
return EL(sv, needlen);
}