summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/GLUtils.cpp
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2011-08-03 15:31:41 -0700
committerTeng-Hui Zhu <ztenghui@google.com>2011-08-03 17:01:59 -0700
commit51c84083c0059a8e849bf0031704b0ec402059f0 (patch)
treeba4b61a3237a34d0ab642c10f530effeb147c830 /Source/WebCore/platform/graphics/android/GLUtils.cpp
parent03137dd16df459ef3bee925373347982cb98124d (diff)
downloadexternal_webkit-51c84083c0059a8e849bf0031704b0ec402059f0.zip
external_webkit-51c84083c0059a8e849bf0031704b0ec402059f0.tar.gz
external_webkit-51c84083c0059a8e849bf0031704b0ec402059f0.tar.bz2
Finalize the sync part.
Improve the sync part for the Shared Surface Texture. Clean up the interface as much as possible. bug:5044597 Change-Id: I123cc520fb447aeb6e72e90149d1658a657740f7
Diffstat (limited to 'Source/WebCore/platform/graphics/android/GLUtils.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/GLUtils.cpp63
1 files changed, 1 insertions, 62 deletions
diff --git a/Source/WebCore/platform/graphics/android/GLUtils.cpp b/Source/WebCore/platform/graphics/android/GLUtils.cpp
index 5a6a158..d1fe51a 100644
--- a/Source/WebCore/platform/graphics/android/GLUtils.cpp
+++ b/Source/WebCore/platform/graphics/android/GLUtils.cpp
@@ -488,69 +488,8 @@ void GLUtils::updateSharedSurfaceTextureWithBitmap(const TileRenderInfo* renderI
|| !renderInfo->textureInfo
|| !renderInfo->baseTile)
return;
- TransferQueue* tileQueue = TilesManager::instance()->transferQueue();
- // Only changed in the Tex Gen thread.
- const int index = tileQueue->getNextTransferQueueIndex();
- bool ready = tileQueue->lockForUpdate(index, renderInfo);
- if (!ready)
- return;
-
- // Dequeue the Surface Texture.
- sp<ANativeWindow> ANW = tileQueue->m_ANW;
- if (!ANW.get()) {
- XLOG("ERROR: ANW is null");
- return;
- }
- ANativeWindowBuffer* anb;
-
- // We bound the Surface Texture update and transfer queue update together.
- tileQueue->m_transferQueueLock.lock();
-
- int status = ANW->dequeueBuffer(ANW.get(), &anb);
- checkSurfaceTextureError("dequeueBuffer", status);
- // a) Update surface texture
- sp<android::GraphicBuffer> buf(new android::GraphicBuffer(anb, false));
- status |= ANW->lockBuffer(ANW.get(), buf->getNativeBuffer()); // Mutex Lock
- checkSurfaceTextureError("lockBuffer", status);
-
- // Fill the buffer with the content of the bitmap
- uint8_t* img = 0;
- status |= buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img));
- checkSurfaceTextureError("lock", status);
-
- if (status == NO_ERROR) {
- int row, col;
- int bpp = 4; // Now we only deal with RGBA8888 format.
- int width = TilesManager::instance()->tileWidth();
- int height = TilesManager::instance()->tileHeight();
- if (x == 0 && y == 0 && bitmap.width() == width && bitmap.height() == height) {
- bitmap.lockPixels();
- uint8_t* bitmapOrigin = static_cast<uint8_t*>(bitmap.getPixels());
- // Copied line by line since we need to handle the offsets and stride.
- for (row = 0 ; row < bitmap.height(); row ++) {
- uint8_t* dst = &(img[(buf->getStride() * (row + x) + y) * bpp]);
- uint8_t* src = &(bitmapOrigin[bitmap.width() * row * bpp]);
- memcpy(dst, src, bpp * bitmap.width());
- }
- bitmap.unlockPixels();
- }
- else{
- // TODO: implement the partial invalidate here!
- XLOG("ERROR: don't expect to get here yet before we support partial inval");
- }
- }
- buf->unlock();
-
- status = ANW->queueBuffer(ANW.get(), buf->getNativeBuffer());
- checkSurfaceTextureError("queueBuffer", status);
-
- // b) After update the Surface Texture, now udpate the transfer queue info.
- tileQueue->addItemInTransferQueue(renderInfo, index);
- XLOG("Bitmap updated x, y %d %d, baseTile %p",
- renderInfo->x, renderInfo->y, renderInfo->baseTile);
-
- tileQueue->m_transferQueueLock.unlock();
+ TilesManager::instance()->transferQueue()->updateQueueWithBitmap(renderInfo, x, y, bitmap);
}
void GLUtils::createTextureWithBitmap(GLuint texture, const SkBitmap& bitmap, GLint filter)