@@ -41,7 +41,7 @@ GrBackendFormat GetGLBackendFormat(GrDirectContext *dContext,
41
41
bool requireKnownFormat) {
42
42
GrBackendApi backend = dContext->backend ();
43
43
if (backend != GrBackendApi::kOpenGL ) {
44
- return GrBackendFormat () ;
44
+ return {} ;
45
45
}
46
46
switch (bufferFormat) {
47
47
// TODO: find out if we can detect, which graphic buffers support
@@ -63,7 +63,7 @@ GrBackendFormat GetGLBackendFormat(GrDirectContext *dContext,
63
63
#endif
64
64
default :
65
65
if (requireKnownFormat) {
66
- return GrBackendFormat () ;
66
+ return {} ;
67
67
} else {
68
68
return GrBackendFormats::MakeGL (GR_GL_RGBA8, GR_GL_TEXTURE_EXTERNAL);
69
69
}
@@ -110,12 +110,12 @@ void GLTextureHelper::rebind(GrDirectContext *dContext) {
110
110
}
111
111
112
112
void delete_gl_texture (void *context) {
113
- GLTextureHelper * cleanupHelper = static_cast <GLTextureHelper *>(context);
113
+ auto cleanupHelper = static_cast <GLTextureHelper *>(context);
114
114
delete cleanupHelper;
115
115
}
116
116
117
117
void update_gl_texture (void *context, GrDirectContext *dContext) {
118
- GLTextureHelper * cleanupHelper = static_cast <GLTextureHelper *>(context);
118
+ auto cleanupHelper = static_cast <GLTextureHelper *>(context);
119
119
cleanupHelper->rebind (dContext);
120
120
}
121
121
@@ -127,13 +127,13 @@ static GrBackendTexture make_gl_backend_texture(
127
127
while (GL_NO_ERROR != glGetError ()) {
128
128
} // clear GL errors
129
129
130
- EGLGetNativeClientBufferANDROIDProc eglGetNativeClientBufferANDROID =
130
+ auto eglGetNativeClientBufferANDROID =
131
131
(EGLGetNativeClientBufferANDROIDProc)eglGetProcAddress (
132
132
" eglGetNativeClientBufferANDROID" );
133
133
if (!eglGetNativeClientBufferANDROID) {
134
134
RNSkLogger::logToConsole (
135
135
" Failed to get the eglGetNativeClientBufferAndroid proc" );
136
- return GrBackendTexture () ;
136
+ return {} ;
137
137
}
138
138
139
139
EGLClientBuffer clientBuffer =
@@ -149,14 +149,14 @@ static GrBackendTexture make_gl_backend_texture(
149
149
if (EGL_NO_IMAGE_KHR == image) {
150
150
SkDebugf (" Could not create EGL image, err = (%#x)" ,
151
151
static_cast <int >(eglGetError ()));
152
- return GrBackendTexture () ;
152
+ return {} ;
153
153
}
154
154
155
155
GrGLuint texID;
156
156
glGenTextures (1 , &texID);
157
157
if (!texID) {
158
158
eglDestroyImageKHR (display, image);
159
- return GrBackendTexture () ;
159
+ return {} ;
160
160
}
161
161
162
162
GrGLuint target = isRenderable ? GR_GL_TEXTURE_2D : GR_GL_TEXTURE_EXTERNAL;
@@ -167,15 +167,15 @@ static GrBackendTexture make_gl_backend_texture(
167
167
SkDebugf (" glBindTexture failed (%#x)" , static_cast <int >(status));
168
168
glDeleteTextures (1 , &texID);
169
169
eglDestroyImageKHR (display, image);
170
- return GrBackendTexture () ;
170
+ return {} ;
171
171
}
172
172
glEGLImageTargetTexture2DOES (target, image);
173
173
if ((status = glGetError ()) != GL_NO_ERROR) {
174
174
SkDebugf (" glEGLImageTargetTexture2DOES failed (%#x)" ,
175
175
static_cast <int >(status));
176
176
glDeleteTextures (1 , &texID);
177
177
eglDestroyImageKHR (display, image);
178
- return GrBackendTexture () ;
178
+ return {} ;
179
179
}
180
180
dContext->resetContext (kTextureBinding_GrGLBackendState );
181
181
@@ -223,16 +223,16 @@ MakeGLBackendTexture(GrDirectContext *dContext, AHardwareBuffer *hardwareBuffer,
223
223
bool isProtectedContent,
224
224
const GrBackendFormat &backendFormat, bool isRenderable) {
225
225
SkASSERT (dContext);
226
- if (!dContext || dContext->abandoned ()) {
227
- return GrBackendTexture () ;
226
+ if (dContext->abandoned ()) {
227
+ return {} ;
228
228
}
229
229
230
230
if (GrBackendApi::kOpenGL != dContext->backend ()) {
231
- return GrBackendTexture () ;
231
+ return {} ;
232
232
}
233
233
234
234
if (isProtectedContent && !can_import_protected_content (dContext)) {
235
- return GrBackendTexture () ;
235
+ return {} ;
236
236
}
237
237
238
238
return make_gl_backend_texture (
0 commit comments