Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Unified Diff: Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp

Issue 10690121: Merge 121076 - [chromium] LayerRendererChromium is not getting visibility messages in single thread… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp
===================================================================
--- Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp (revision 122257)
+++ Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp (working copy)
@@ -31,7 +31,7 @@
#include "Extensions3DChromium.h"
#include "GraphicsContext3D.h"
-#include "LayerRendererChromium.h"
+#include "LayerRendererChromium.h" // For GLC macro
#include "LayerTextureSubImage.h"
#include "NotImplemented.h"
#include "ProgramBinding.h"
@@ -75,7 +75,7 @@
m_provider->setVideoFrameProviderClient(0);
m_provider = 0;
}
- freePlaneData(layerTreeHostImpl()->layerRenderer());
+ freePlaneData(layerTreeHostImpl()->context());
#if !ASSERT_DISABLED
for (unsigned i = 0; i < WebKit::WebVideoFrame::maxPlanes; ++i)
@@ -125,7 +125,7 @@
m_providerMutex.lock();
willDrawInternal(layerRenderer, context);
- freeUnusedPlaneData(layerRenderer);
+ freeUnusedPlaneData(context);
if (!m_frame)
m_providerMutex.unlock();
@@ -159,7 +159,7 @@
return;
}
- if (!allocatePlaneData(layerRenderer)) {
+ if (!allocatePlaneData(layerRenderer, context)) {
m_provider->putCurrentFrame(m_frame);
m_frame = 0;
return;
@@ -282,25 +282,43 @@
return IntSize(visibleWidth, visibleHeight);
}
-bool CCVideoLayerImpl::FramePlane::allocateData(CCRenderer* layerRenderer)
+bool CCVideoLayerImpl::FramePlane::allocateData(CCGraphicsContext* context)
{
if (textureId)
return true;
- textureId = layerRenderer->contentsTextureAllocator()->createTexture(size, format);
+ GraphicsContext3D* context3D = context->context3D();
+ if (!context3D)
+ return false;
+
+ GLC(context3D, textureId = context3D->createTexture());
+ GLC(context3D, context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId));
+ // Do basic linear filtering on resize.
+ GLC(context3D, context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR));
+ GLC(context3D, context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR));
+ // NPOT textures in GL ES only work when the wrap mode is set to GraphicsContext3D::CLAMP_TO_EDGE.
+ GLC(context3D, context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE));
+ GLC(context3D, context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
+
+ GLC(context3D, context3D->texImage2DResourceSafe(GraphicsContext3D::TEXTURE_2D, 0, format, size.width(), size.height(), 0, format, GraphicsContext3D::UNSIGNED_BYTE));
+
return textureId;
}
-void CCVideoLayerImpl::FramePlane::freeData(CCRenderer* layerRenderer)
+void CCVideoLayerImpl::FramePlane::freeData(CCGraphicsContext* context)
{
if (!textureId)
return;
- layerRenderer->contentsTextureAllocator()->deleteTexture(textureId, size, format);
+ GraphicsContext3D* context3D = context->context3D();
+ if (!context3D)
+ return;
+
+ GLC(context3D, context3D->deleteTexture(textureId));
textureId = 0;
}
-bool CCVideoLayerImpl::allocatePlaneData(CCRenderer* layerRenderer)
+bool CCVideoLayerImpl::allocatePlaneData(CCRenderer* layerRenderer, CCGraphicsContext* context)
{
int maxTextureSize = layerRenderer->capabilities().maxTextureSize;
for (unsigned planeIndex = 0; planeIndex < m_frame->planes(); ++planeIndex) {
@@ -312,13 +330,13 @@
return false;
if (plane.size != requiredTextureSize || plane.format != m_format) {
- plane.freeData(layerRenderer);
+ plane.freeData(context);
plane.size = requiredTextureSize;
plane.format = m_format;
}
if (!plane.textureId) {
- if (!plane.allocateData(layerRenderer))
+ if (!plane.allocateData(context))
return false;
plane.visibleSize = computeVisibleSize(*m_frame, planeIndex);
}
@@ -351,17 +369,17 @@
return true;
}
-void CCVideoLayerImpl::freePlaneData(CCRenderer* layerRenderer)
+void CCVideoLayerImpl::freePlaneData(CCGraphicsContext* context)
{
for (unsigned i = 0; i < WebKit::WebVideoFrame::maxPlanes; ++i)
- m_framePlanes[i].freeData(layerRenderer);
+ m_framePlanes[i].freeData(context);
}
-void CCVideoLayerImpl::freeUnusedPlaneData(CCRenderer* layerRenderer)
+void CCVideoLayerImpl::freeUnusedPlaneData(CCGraphicsContext* context)
{
unsigned firstUnusedPlane = m_frame ? m_frame->planes() : 0;
for (unsigned i = firstUnusedPlane; i < WebKit::WebVideoFrame::maxPlanes; ++i)
- m_framePlanes[i].freeData(layerRenderer);
+ m_framePlanes[i].freeData(context);
}
void CCVideoLayerImpl::didReceiveFrame()
@@ -381,7 +399,7 @@
void CCVideoLayerImpl::didLoseContext()
{
- freePlaneData(layerTreeHostImpl()->layerRenderer());
+ freePlaneData(layerTreeHostImpl()->context());
}
void CCVideoLayerImpl::setNeedsRedraw()

Powered by Google App Engine
This is Rietveld 408576698