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

Unified Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11269017: Plumb through cropped output size for VideoFrame (Closed) Base URL: https://git.chromium.org/git/chromium/src@git-svn
Patch Set: Created 8 years, 2 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: cc/layer_tree_host_impl_unittest.cc
diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc
index 68a4b7f4738f9e1d0f955d3ef67b6c626509656a..79a226074dab2362e4642cce9e9ef8e45e5a1e29 100644
--- a/cc/layer_tree_host_impl_unittest.cc
+++ b/cc/layer_tree_host_impl_unittest.cc
@@ -2535,22 +2535,24 @@ private:
// Fake video frame that represents a 4x4 YUV video frame.
class FakeVideoFrame: public WebVideoFrame {
public:
- FakeVideoFrame() : m_textureId(0) { memset(m_data, 0x80, sizeof(m_data)); }
+ FakeVideoFrame() : m_textureId(0), m_visibleRect(0, 0, 4, 4) { memset(m_data, 0x80, sizeof(m_data)); }
jamesr 2012/10/25 22:49:47 One initialization per line. I would split this al
virtual ~FakeVideoFrame() { }
virtual Format format() const { return m_textureId ? FormatNativeTexture : FormatYV12; }
- virtual unsigned width() const { return 4; }
- virtual unsigned height() const { return 4; }
virtual unsigned planes() const { return m_textureId ? 0 : 3; }
- virtual int stride(unsigned plane) const { return 4; }
+ virtual int stride(unsigned plane) const { return 16; }
virtual const void* data(unsigned plane) const { return m_data; }
virtual unsigned textureId() const { return m_textureId; }
virtual unsigned textureTarget() const { return m_textureId ? GL_TEXTURE_2D : 0; }
+ virtual WebKit::WebRect visibleRect() const { return m_visibleRect; }
+ virtual WebKit::WebRect textureSize() const { return WebKit::WebSize(4, 4); }
+ void setVisibleRect(const WebKit::WebRect& visibleRect) { m_visibleRect = visibleRect; }
void setTextureId(unsigned id) { m_textureId = id; }
private:
- char m_data[16];
+ char m_data[64];
unsigned m_textureId;
+ WebKit::WebRect m_visibleRect;
};
// Fake video frame provider that always provides the same FakeVideoFrame.
@@ -2706,6 +2708,17 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
videoLayer->setLayerTreeHostImpl(m_hostImpl.get());
rootLayer->addChild(videoLayer.PassAs<LayerImpl>());
+ FakeVideoFrame videoFrameScaled;
+ FakeVideoFrameProvider providerScaled;
+ providerScaled.setFrame(&videoFrameScaled);
+ scoped_ptr<VideoLayerImpl> videoLayerScaled = VideoLayerImpl::create(layerId++, &providerScaled);
+ videoLayerScaled->setBounds(IntSize(10, 10));
+ videoLayerScaled->setAnchorPoint(FloatPoint(0, 0));
+ videoLayerScaled->setContentBounds(IntSize(10, 10));
+ videoLayerScaled->setDrawsContent(true);
+ videoLayerScaled->setLayerTreeHostImpl(m_hostImpl.get());
+ rootLayer->addChild(videoLayerScaled.PassAs<LayerImpl>());
+
FakeVideoFrame hwVideoFrame;
FakeVideoFrameProvider hwProvider;
hwProvider.setFrame(&hwVideoFrame);
@@ -2756,6 +2769,7 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
// Use a context that supports IOSurfaces
m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DWithIOSurface)).PassAs<GraphicsContext>());
+ videoFrameScaled.setVisibleRect(WebKit::WebRect(0, 0, 3, 2));
hwVideoFrame.setTextureId(m_hostImpl->resourceProvider()->graphicsContext3D()->createTexture());
m_hostImpl->setRootLayer(rootLayer.Pass());
« no previous file with comments | « cc/gl_renderer.cc ('k') | cc/resource_provider.cc » ('j') | cc/resource_provider.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698