81
82
/*
83
* Create our main surface
84
*/
85
86
surface
=
eglCreateWindowSurface
(
display
,
config
,
mNativeWindow
.
get
(),
NULL
);
87
88
if
(
mFlags
&
PARTIAL_UPDATES
)
89
{
90
// if we have partial updates, we definitely don't need to
91
// preserve the backbuffer, which my be costly.
92
eglSurfaceAttrib
(
display
,
surface
,
EGL_SWAP_BEHAVIOR
,
EGL_BUFFER_DESTROYED
);
93
}
94
95
if
(
eglQuerySurface
(
display
,
surface
,
EGL_SWAP_BEHAVIOR
,
&
dummy
)
==
EGL_TRUE
)
96
{
97
if
(
dummy
==
EGL_BUFFER_PRESERVED
)
98
{
99
mFlags
|=
BUFFER_PRESERVED
;
100
}
101
}
102
103
eglQuerySurface
(
display
,
surface
,
EGL_WIDTH
,
&
mWidth
);
104
eglQuerySurface
(
display
,
surface
,
EGL_HEIGHT
,
&
mHeight
);
105
106
#
ifdef
EGL_ANDROID_swap_rectangle
107
if
(
strstr
(
egl_extensions
,
"EGL_ANDROID_swap_rectangle"
))
108
{
109
if
(
eglSetSwapRectangleANDROID
(
display
,
surface
,
0
,
0
,
mWidth
,
mHeight
)
==
EGL_TRUE
)
110
{
111
// This could fail if this extension is not supported by this
112
// specific surface (of config)
113
mFlags
|=
SWAP_RECTANGLE
;
114
}
115
}
116
// choose PARTIAL_UPDATES, which should be more efficient
117
if
(
mFlags
&
PARTIAL_UPDATES
)
118
mFlags
&=
~
SWAP_RECTANGLE
;