summaryrefslogtreecommitdiff
path: root/opengl/libagl/texture.cpp
diff options
context:
space:
mode:
author Dan Stoza <stoza@google.com> 2016-01-08 10:52:16 -0800
committer Dan Stoza <stoza@google.com> 2016-01-11 16:29:39 -0800
commitc044ae5dfc62031924c2f4c0ecc87b0da72a6b3f (patch)
tree094e146f6bf769aae8c142aa5b846b346015a141 /opengl/libagl/texture.cpp
parent35f475653c2ca922acc358c607b204c8fafd6ad5 (diff)
libagl: Switch from gralloc to GraphicBufferMapper
Removes all direct references to the gralloc module from libagl and uses the GraphicBufferMapper class instead when locking and unlocking buffers. Also a couple of minor code cleanups to eliminate warnings. Change-Id: Ie982d375b3152d5f677ab54c2067179b8d34c06d
Diffstat (limited to 'opengl/libagl/texture.cpp')
-rw-r--r--opengl/libagl/texture.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/opengl/libagl/texture.cpp b/opengl/libagl/texture.cpp
index 9aa1c4f867..3fe5ed0630 100644
--- a/opengl/libagl/texture.cpp
+++ b/opengl/libagl/texture.cpp
@@ -25,6 +25,9 @@
#include <ETC1/etc1.h>
+#include <ui/GraphicBufferMapper.h>
+#include <ui/Rect.h>
+
namespace android {
// ----------------------------------------------------------------------------
@@ -128,17 +131,11 @@ void ogles_lock_textures(ogles_context_t* c)
ANativeWindowBuffer* native_buffer = u.texture->buffer;
if (native_buffer) {
c->rasterizer.procs.activeTexture(c, i);
- hw_module_t const* pModule;
- if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &pModule))
- continue;
-
- gralloc_module_t const* module =
- reinterpret_cast<gralloc_module_t const*>(pModule);
+ auto& mapper = GraphicBufferMapper::get();
void* vaddr;
- int err = module->lock(module, native_buffer->handle,
- GRALLOC_USAGE_SW_READ_OFTEN,
- 0, 0, native_buffer->width, native_buffer->height,
+ mapper.lock(native_buffer->handle, GRALLOC_USAGE_SW_READ_OFTEN,
+ Rect(native_buffer->width, native_buffer->height),
&vaddr);
u.texture->setImageBits(vaddr);
@@ -156,14 +153,10 @@ void ogles_unlock_textures(ogles_context_t* c)
ANativeWindowBuffer* native_buffer = u.texture->buffer;
if (native_buffer) {
c->rasterizer.procs.activeTexture(c, i);
- hw_module_t const* pModule;
- if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &pModule))
- continue;
- gralloc_module_t const* module =
- reinterpret_cast<gralloc_module_t const*>(pModule);
+ auto& mapper = GraphicBufferMapper::get();
+ mapper.unlock(native_buffer->handle);
- module->unlock(module, native_buffer->handle);
u.texture->setImageBits(NULL);
c->rasterizer.procs.bindTexture(c, &(u.texture->surface));
}
@@ -405,7 +398,7 @@ int createTextureSurface(ogles_context_t* c,
return 0;
}
-static size_t dataSizePalette4(int numLevels, int width, int height, int format)
+static GLsizei dataSizePalette4(int numLevels, int width, int height, int format)
{
int indexBits = 8;
int entrySize = 0;