OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 } | 120 } |
121 | 121 |
122 public EGLContext getContext() { | 122 public EGLContext getContext() { |
123 return eglContext; | 123 return eglContext; |
124 } | 124 } |
125 | 125 |
126 public boolean hasSurface() { | 126 public boolean hasSurface() { |
127 return eglSurface != EGL14.EGL_NO_SURFACE; | 127 return eglSurface != EGL14.EGL_NO_SURFACE; |
128 } | 128 } |
129 | 129 |
| 130 public int surfaceWidth() { |
| 131 final int widthArray[] = new int[1]; |
| 132 EGL14.eglQuerySurface(eglDisplay, eglSurface, EGL14.EGL_WIDTH, widthArray, 0
); |
| 133 return widthArray[0]; |
| 134 } |
| 135 |
| 136 public int surfaceHeight() { |
| 137 final int heightArray[] = new int[1]; |
| 138 EGL14.eglQuerySurface(eglDisplay, eglSurface, EGL14.EGL_HEIGHT, heightArray,
0); |
| 139 return heightArray[0]; |
| 140 } |
| 141 |
130 public void releaseSurface() { | 142 public void releaseSurface() { |
131 if (eglSurface != EGL14.EGL_NO_SURFACE) { | 143 if (eglSurface != EGL14.EGL_NO_SURFACE) { |
132 EGL14.eglDestroySurface(eglDisplay, eglSurface); | 144 EGL14.eglDestroySurface(eglDisplay, eglSurface); |
133 eglSurface = EGL14.EGL_NO_SURFACE; | 145 eglSurface = EGL14.EGL_NO_SURFACE; |
134 } | 146 } |
135 } | 147 } |
136 | 148 |
137 private void checkIsNotReleased() { | 149 private void checkIsNotReleased() { |
138 if (eglDisplay == EGL14.EGL_NO_DISPLAY || eglContext == EGL14.EGL_NO_CONTEXT | 150 if (eglDisplay == EGL14.EGL_NO_DISPLAY || eglContext == EGL14.EGL_NO_CONTEXT |
139 || eglConfig == null) { | 151 || eglConfig == null) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 EGLContext sharedContext, EGLDisplay eglDisplay, EGLConfig eglConfig) { | 240 EGLContext sharedContext, EGLDisplay eglDisplay, EGLConfig eglConfig) { |
229 int[] contextAttributes = {EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NO
NE}; | 241 int[] contextAttributes = {EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NO
NE}; |
230 EGLContext eglContext = | 242 EGLContext eglContext = |
231 EGL14.eglCreateContext(eglDisplay, eglConfig, sharedContext, contextAttr
ibutes, 0); | 243 EGL14.eglCreateContext(eglDisplay, eglConfig, sharedContext, contextAttr
ibutes, 0); |
232 if (eglContext == EGL14.EGL_NO_CONTEXT) { | 244 if (eglContext == EGL14.EGL_NO_CONTEXT) { |
233 throw new RuntimeException("Failed to create EGL context"); | 245 throw new RuntimeException("Failed to create EGL context"); |
234 } | 246 } |
235 return eglContext; | 247 return eglContext; |
236 } | 248 } |
237 } | 249 } |
OLD | NEW |