summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/GLUtils.cpp4
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/GLUtils.h4
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/GaneshRenderer.cpp3
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/RasterRenderer.cpp1
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/TransferQueue.cpp21
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/TransferQueue.h6
6 files changed, 22 insertions, 17 deletions
diff --git a/Source/WebCore/platform/graphics/android/rendering/GLUtils.cpp b/Source/WebCore/platform/graphics/android/rendering/GLUtils.cpp
index a68c01a..d5a701b 100644
--- a/Source/WebCore/platform/graphics/android/rendering/GLUtils.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/GLUtils.cpp
@@ -446,7 +446,7 @@ bool GLUtils::skipTransferForPureColor(const TileRenderInfo* renderInfo,
}
void GLUtils::paintTextureWithBitmap(const TileRenderInfo* renderInfo,
- const SkBitmap& bitmap)
+ SkBitmap& bitmap)
{
if (!renderInfo)
return;
@@ -472,7 +472,7 @@ void GLUtils::paintTextureWithBitmap(const TileRenderInfo* renderInfo,
}
}
-void GLUtils::updateQueueWithBitmap(const TileRenderInfo* renderInfo, const SkBitmap& bitmap)
+void GLUtils::updateQueueWithBitmap(const TileRenderInfo* renderInfo, SkBitmap& bitmap)
{
if (!renderInfo
|| !renderInfo->textureInfo
diff --git a/Source/WebCore/platform/graphics/android/rendering/GLUtils.h b/Source/WebCore/platform/graphics/android/rendering/GLUtils.h
index c2dec7d..3b093d1 100644
--- a/Source/WebCore/platform/graphics/android/rendering/GLUtils.h
+++ b/Source/WebCore/platform/graphics/android/rendering/GLUtils.h
@@ -80,8 +80,8 @@ public:
static void createEGLImageFromTexture(GLuint texture, EGLImageKHR* image);
static void createTextureFromEGLImage(GLuint texture, EGLImageKHR image, GLint filter = GL_LINEAR);
- static void paintTextureWithBitmap(const TileRenderInfo* renderInfo, const SkBitmap& bitmap);
- static void updateQueueWithBitmap(const TileRenderInfo* , const SkBitmap& bitmap);
+ static void paintTextureWithBitmap(const TileRenderInfo* renderInfo, SkBitmap& bitmap);
+ static void updateQueueWithBitmap(const TileRenderInfo* , SkBitmap& bitmap);
static bool updateSharedSurfaceTextureWithBitmap(ANativeWindow* anw, const SkBitmap& bitmap);
static void convertToTransformationMatrix(const float* matrix, TransformationMatrix& transformMatrix);
diff --git a/Source/WebCore/platform/graphics/android/rendering/GaneshRenderer.cpp b/Source/WebCore/platform/graphics/android/rendering/GaneshRenderer.cpp
index d779af4..8b5e30a 100644
--- a/Source/WebCore/platform/graphics/android/rendering/GaneshRenderer.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/GaneshRenderer.cpp
@@ -94,7 +94,8 @@ void GaneshRenderer::renderingComplete(const TileRenderInfo& renderInfo, SkCanva
// tile's ANativeWindow (i.e. SurfaceTexture) buffer
TransferQueue* tileQueue = TilesManager::instance()->transferQueue();
eglSwapBuffers(eglGetCurrentDisplay(), tileQueue->m_eglSurface);
- tileQueue->addItemInTransferQueue(&renderInfo, GpuUpload, 0);
+ SkBitmap dummyBitmap;
+ tileQueue->addItemInTransferQueue(&renderInfo, GpuUpload, dummyBitmap);
tileQueue->unlockQueue();
}
diff --git a/Source/WebCore/platform/graphics/android/rendering/RasterRenderer.cpp b/Source/WebCore/platform/graphics/android/rendering/RasterRenderer.cpp
index a67a890..5c78ad9 100644
--- a/Source/WebCore/platform/graphics/android/rendering/RasterRenderer.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/RasterRenderer.cpp
@@ -97,6 +97,7 @@ void RasterRenderer::setupCanvas(const TileRenderInfo& renderInfo, SkCanvas* can
void RasterRenderer::renderingComplete(const TileRenderInfo& renderInfo, SkCanvas* canvas)
{
+ // We may swap the content of m_bitmap with the bitmap in the transfer queue.
GLUtils::paintTextureWithBitmap(&renderInfo, m_bitmap);
}
diff --git a/Source/WebCore/platform/graphics/android/rendering/TransferQueue.cpp b/Source/WebCore/platform/graphics/android/rendering/TransferQueue.cpp
index e329191..b15fa6d 100644
--- a/Source/WebCore/platform/graphics/android/rendering/TransferQueue.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/TransferQueue.cpp
@@ -390,7 +390,7 @@ void TransferQueue::updateDirtyTiles()
}
void TransferQueue::updateQueueWithBitmap(const TileRenderInfo* renderInfo,
- const SkBitmap& bitmap)
+ SkBitmap& bitmap)
{
TRACE_METHOD();
if (!tryUpdateQueueWithBitmap(renderInfo, bitmap)) {
@@ -403,7 +403,7 @@ void TransferQueue::updateQueueWithBitmap(const TileRenderInfo* renderInfo,
}
bool TransferQueue::tryUpdateQueueWithBitmap(const TileRenderInfo* renderInfo,
- const SkBitmap& bitmap)
+ SkBitmap& bitmap)
{
// This lock need to cover the full update since it is possible that queue
// will be cleaned up in the middle of this update without the lock.
@@ -429,7 +429,7 @@ bool TransferQueue::tryUpdateQueueWithBitmap(const TileRenderInfo* renderInfo,
}
// b) After update the Surface Texture, now udpate the transfer queue info.
- addItemInTransferQueue(renderInfo, currentUploadType, &bitmap);
+ addItemInTransferQueue(renderInfo, currentUploadType, bitmap);
ALOGV("Bitmap updated x, y %d %d, baseTile %p",
renderInfo->x, renderInfo->y, renderInfo->baseTile);
@@ -475,7 +475,7 @@ void TransferQueue::addItemCommon(const TileRenderInfo* renderInfo,
// Currently only called by GLUtils::updateSharedSurfaceTextureWithBitmap.
void TransferQueue::addItemInTransferQueue(const TileRenderInfo* renderInfo,
TextureUploadType type,
- const SkBitmap* bitmap)
+ SkBitmap& bitmap)
{
m_transferQueueIndex = (m_transferQueueIndex + 1) % m_transferQueueSize;
@@ -487,15 +487,18 @@ void TransferQueue::addItemInTransferQueue(const TileRenderInfo* renderInfo,
TileTransferData* data = &m_transferQueue[index];
addItemCommon(renderInfo, type, data);
- if (type == CpuUpload && bitmap) {
+ if (type == CpuUpload) {
// Lazily create the bitmap
if (!m_transferQueue[index].bitmap) {
m_transferQueue[index].bitmap = new SkBitmap();
- int w = bitmap->width();
- int h = bitmap->height();
- m_transferQueue[index].bitmap->setConfig(bitmap->config(), w, h);
+ int w = bitmap.width();
+ int h = bitmap.height();
+ m_transferQueue[index].bitmap->setConfig(bitmap.config(), w, h);
+ m_transferQueue[index].bitmap->allocPixels();
}
- bitmap->copyTo(m_transferQueue[index].bitmap, bitmap->config());
+ SkBitmap temp = (*m_transferQueue[index].bitmap);
+ (*m_transferQueue[index].bitmap) = bitmap;
+ bitmap = temp;
}
m_emptyItemCount--;
diff --git a/Source/WebCore/platform/graphics/android/rendering/TransferQueue.h b/Source/WebCore/platform/graphics/android/rendering/TransferQueue.h
index c0835d7..55011b0 100644
--- a/Source/WebCore/platform/graphics/android/rendering/TransferQueue.h
+++ b/Source/WebCore/platform/graphics/android/rendering/TransferQueue.h
@@ -115,11 +115,11 @@ public:
// insert the bitmap into the queue, mark the tile dirty if failing
void updateQueueWithBitmap(const TileRenderInfo* renderInfo,
- const SkBitmap& bitmap);
+ SkBitmap& bitmap);
void addItemInTransferQueue(const TileRenderInfo* info,
TextureUploadType type,
- const SkBitmap* bitmap);
+ SkBitmap& bitmap);
// Check if the item @ index is ready for update.
// The lock will be done when returning true.
bool readyForUpdate();
@@ -145,7 +145,7 @@ public:
private:
// return true if successfully inserted into queue
bool tryUpdateQueueWithBitmap(const TileRenderInfo* renderInfo,
- const SkBitmap& bitmap);
+ SkBitmap& bitmap);
bool getHasGLContext();
void setHasGLContext(bool hasContext);
void emptyAndAbandonQueue();