Chromium Code Reviews| Index: src/gpu/gl/GrGLGpu.cpp |
| diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp |
| index 626a72f9362a32ad9887f3eb6bbd26c0b19aefa6..ab514f4cc6ff634b5854487e5a5abd709a76bbe2 100644 |
| --- a/src/gpu/gl/GrGLGpu.cpp |
| +++ b/src/gpu/gl/GrGLGpu.cpp |
| @@ -2379,7 +2379,7 @@ bool GrGLGpu::configToGLFormats(GrPixelConfig config, |
| bool getSizedInternalFormat, |
| GrGLenum* internalFormat, |
| GrGLenum* externalFormat, |
| - GrGLenum* externalType) { |
| + GrGLenum* externalType) const { |
| GrGLenum dontCare; |
| if (NULL == internalFormat) { |
| internalFormat = &dontCare; |
| @@ -3067,6 +3067,41 @@ void GrGLGpu::didRemoveGpuTraceMarker() { |
| } |
| } |
| +GrBackendObject GrGLGpu::createBackendTexture(void* pixels, int w, int h, |
|
robertphillips
2015/07/10 18:45:18
tab over ?
jvanverth1
2015/07/10 19:59:44
Done.
|
| + GrPixelConfig config) const { |
| + GrGLuint texID; |
| + GL_CALL(GenTextures(1, &texID)); |
| + GL_CALL(ActiveTexture(GR_GL_TEXTURE0)); |
| + GL_CALL(PixelStorei(GR_GL_UNPACK_ALIGNMENT, 1)); |
| + GL_CALL(BindTexture(GR_GL_TEXTURE_2D, texID)); |
| + GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MAG_FILTER, GR_GL_NEAREST)); |
| + GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MIN_FILTER, GR_GL_NEAREST)); |
| + GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_WRAP_S, GR_GL_CLAMP_TO_EDGE)); |
| + GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_WRAP_T, GR_GL_CLAMP_TO_EDGE)); |
| + |
| + GrGLenum internalFormat, externalFormat, externalType; |
| + this->configToGLFormats(config, false, &internalFormat, &externalFormat, &externalType); |
| + |
| + GL_CALL(TexImage2D(GR_GL_TEXTURE_2D, 0, internalFormat, w, h, 0, externalFormat, |
| + externalType, pixels)); |
| + |
| + return texID; |
| +} |
| + |
| +bool GrGLGpu::isBackendTexture(GrBackendObject id) const { |
| + GrGLuint texID = (GrGLuint)id; |
| + |
| + GrGLboolean result; |
| + GL_CALL_RET(result, IsTexture(texID)); |
| + |
| + return (GR_GL_TRUE == result); |
| +} |
| + |
| +void GrGLGpu::deleteBackendTexture(GrBackendObject id) const { |
| + GrGLuint texID = (GrGLuint)id; |
| + GL_CALL(DeleteTextures(1, &texID)); |
| +} |
| + |
| /////////////////////////////////////////////////////////////////////////////// |
| GrGLAttribArrayState* GrGLGpu::HWGeometryState::bindArrayAndBuffersToDraw( |
| GrGLGpu* gpu, |