diff options
author | dalecurtis@google.com <dalecurtis@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-06 16:34:35 +0000 |
---|---|---|
committer | dalecurtis@google.com <dalecurtis@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-06 16:34:35 +0000 |
commit | f35b9a53d6d8c58d4514a44e573b5463474d430f (patch) | |
tree | b3c4b01f67c8f8a5c0862d2520554c12d5243b21 | |
parent | 7abc0d6706feb5861ee853ccdc45105c340c6dfc (diff) | |
download | chromium_src-f35b9a53d6d8c58d4514a44e573b5463474d430f.zip chromium_src-f35b9a53d6d8c58d4514a44e573b5463474d430f.tar.gz chromium_src-f35b9a53d6d8c58d4514a44e573b5463474d430f.tar.bz2 |
Revert 204508 "Adding YUVA support for enabling Alpha Playback"
> Adding YUVA support for enabling Alpha Playback
>
> BUG=147355
>
> Review URL: https://chromiumcodereview.appspot.com/12157002
Failing linux_asan with SEGV and heap buffer overflow errors:
http://build.chromium.org/p/chromium.memory/builders/Linux%20ASAN%20Tests%20%283%29/builds/9750
TBR=vigneshv@chromium.org
Review URL: https://codereview.chromium.org/16564004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204518 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | cc/layers/video_layer_impl.cc | 6 | ||||
-rw-r--r-- | cc/output/delegating_renderer_unittest.cc | 2 | ||||
-rw-r--r-- | cc/output/gl_renderer.cc | 95 | ||||
-rw-r--r-- | cc/output/gl_renderer.h | 6 | ||||
-rw-r--r-- | cc/output/gl_renderer_unittest.cc | 1 | ||||
-rw-r--r-- | cc/output/renderer_pixeltest.cc | 116 | ||||
-rw-r--r-- | cc/output/shader.cc | 73 | ||||
-rw-r--r-- | cc/output/shader.h | 31 | ||||
-rw-r--r-- | cc/quads/draw_quad_unittest.cc | 23 | ||||
-rw-r--r-- | cc/quads/yuv_video_draw_quad.cc | 13 | ||||
-rw-r--r-- | cc/quads/yuv_video_draw_quad.h | 7 | ||||
-rw-r--r-- | cc/test/render_pass_test_common.cc | 7 | ||||
-rw-r--r-- | content/common/cc_messages.h | 1 | ||||
-rw-r--r-- | content/common/cc_messages_unittest.cc | 5 |
14 files changed, 40 insertions, 346 deletions
diff --git a/cc/layers/video_layer_impl.cc b/cc/layers/video_layer_impl.cc index 98f2c04..8e9fa02 100644 --- a/cc/layers/video_layer_impl.cc +++ b/cc/layers/video_layer_impl.cc @@ -173,7 +173,7 @@ void VideoLayerImpl::AppendQuads(QuadSink* quad_sink, break; } case VideoFrameExternalResources::YUV_RESOURCE: { - DCHECK_GE(frame_resources_.size(), 3u); + DCHECK_EQ(frame_resources_.size(), 3u); if (frame_resources_.size() < 3u) break; gfx::SizeF tex_scale(tex_width_scale, tex_height_scale); @@ -184,9 +184,7 @@ void VideoLayerImpl::AppendQuads(QuadSink* quad_sink, tex_scale, frame_resources_[0], frame_resources_[1], - frame_resources_[2], - frame_resources_.size() > 3 ? - frame_resources_[3] : 0); + frame_resources_[2]); quad_sink->Append(yuv_video_quad.PassAs<DrawQuad>(), append_quads_data); break; } diff --git a/cc/output/delegating_renderer_unittest.cc b/cc/output/delegating_renderer_unittest.cc index f0b6f69..94cae6a 100644 --- a/cc/output/delegating_renderer_unittest.cc +++ b/cc/output/delegating_renderer_unittest.cc @@ -132,7 +132,7 @@ class DelegatingRendererTestResources : public DelegatingRendererTest { // change if AppendOneOfEveryQuadType() is updated, and the value here // should be updated accordingly. EXPECT_EQ( - 21u, last_frame.delegated_frame_data->resource_list.size()); + 19u, last_frame.delegated_frame_data->resource_list.size()); EndTest(); } diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index e04c637..4da3aab 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -1386,7 +1386,8 @@ void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame, context_, &highp_threshold_cache_, highp_threshold_min_, quad->shared_quad_state->visible_content_rect.bottom_right()); - bool use_alpha_plane = quad->a_plane_resource_id != 0; + const VideoYUVProgram* program = GetVideoYUVProgram(tex_coord_precision); + DCHECK(program && (program->initialized() || IsContextLost())); GLC(Context(), Context()->activeTexture(GL_TEXTURE1)); ResourceProvider::ScopedSamplerGL y_plane_lock( @@ -1397,61 +1398,19 @@ void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame, GLC(Context(), Context()->activeTexture(GL_TEXTURE3)); ResourceProvider::ScopedSamplerGL v_plane_lock( resource_provider_, quad->v_plane_resource_id, GL_TEXTURE_2D, GL_LINEAR); - scoped_ptr<ResourceProvider::ScopedSamplerGL> a_plane_lock; - if (use_alpha_plane) { - GLC(Context(), Context()->activeTexture(GL_TEXTURE4)); - a_plane_lock.reset(new ResourceProvider::ScopedSamplerGL( - resource_provider_, - quad->a_plane_resource_id, - GL_TEXTURE_2D, - GL_LINEAR)); - } - int tex_scale_location = -1; - int matrix_location = -1; - int y_texture_location = -1; - int u_texture_location = -1; - int v_texture_location = -1; - int a_texture_location = -1; - int yuv_matrix_location = -1; - int yuv_adj_location = -1; - int alpha_location = -1; - if (use_alpha_plane) { - const VideoYUVAProgram* program = GetVideoYUVAProgram(tex_coord_precision); - DCHECK(program && (program->initialized() || IsContextLost())); - SetUseProgram(program->program()); - tex_scale_location = program->vertex_shader().tex_scale_location(); - matrix_location = program->vertex_shader().matrix_location(); - y_texture_location = program->fragment_shader().y_texture_location(); - u_texture_location = program->fragment_shader().u_texture_location(); - v_texture_location = program->fragment_shader().v_texture_location(); - a_texture_location = program->fragment_shader().a_texture_location(); - yuv_matrix_location = program->fragment_shader().yuv_matrix_location(); - yuv_adj_location = program->fragment_shader().yuv_adj_location(); - alpha_location = program->fragment_shader().alpha_location(); - } else { - const VideoYUVProgram* program = GetVideoYUVProgram(tex_coord_precision); - DCHECK(program && (program->initialized() || IsContextLost())); - SetUseProgram(program->program()); - tex_scale_location = program->vertex_shader().tex_scale_location(); - matrix_location = program->vertex_shader().matrix_location(); - y_texture_location = program->fragment_shader().y_texture_location(); - u_texture_location = program->fragment_shader().u_texture_location(); - v_texture_location = program->fragment_shader().v_texture_location(); - yuv_matrix_location = program->fragment_shader().yuv_matrix_location(); - yuv_adj_location = program->fragment_shader().yuv_adj_location(); - alpha_location = program->fragment_shader().alpha_location(); - } + SetUseProgram(program->program()); GLC(Context(), - Context()->uniform2f(tex_scale_location, + Context()->uniform2f(program->vertex_shader().tex_scale_location(), quad->tex_scale.width(), quad->tex_scale.height())); - GLC(Context(), Context()->uniform1i(y_texture_location, 1)); - GLC(Context(), Context()->uniform1i(u_texture_location, 2)); - GLC(Context(), Context()->uniform1i(v_texture_location, 3)); - if (use_alpha_plane) - GLC(Context(), Context()->uniform1i(a_texture_location, 4)); + GLC(Context(), + Context()->uniform1i(program->fragment_shader().y_texture_location(), 1)); + GLC(Context(), + Context()->uniform1i(program->fragment_shader().u_texture_location(), 2)); + GLC(Context(), + Context()->uniform1i(program->fragment_shader().v_texture_location(), 3)); // These values are magic numbers that are used in the transformation from YUV // to RGB color values. They are taken from the following webpage: @@ -1462,7 +1421,8 @@ void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame, 1.596f, -.813f, 0.0f, }; GLC(Context(), - Context()->uniformMatrix3fv(yuv_matrix_location, 1, 0, yuv_to_rgb)); + Context()->uniformMatrix3fv( + program->fragment_shader().yuv_matrix_location(), 1, 0, yuv_to_rgb)); // These values map to 16, 128, and 128 respectively, and are computed // as a fraction over 256 (e.g. 16 / 256 = 0.0625). @@ -1471,11 +1431,16 @@ void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame, // U - 128 : Turns unsigned U into signed U [-128,127] // V - 128 : Turns unsigned V into signed V [-128,127] float yuv_adjust[3] = { -0.0625f, -0.5f, -0.5f, }; - GLC(Context(), Context()->uniform3fv(yuv_adj_location, 1, yuv_adjust)); - + GLC(Context(), + Context()->uniform3fv( + program->fragment_shader().yuv_adj_location(), 1, yuv_adjust)); - SetShaderOpacity(quad->opacity(), alpha_location); - DrawQuadGeometry(frame, quad->quadTransform(), quad->rect, matrix_location); + SetShaderOpacity(quad->opacity(), + program->fragment_shader().alpha_location()); + DrawQuadGeometry(frame, + quad->quadTransform(), + quad->rect, + program->vertex_shader().matrix_location()); // Reset active texture back to texture 0. GLC(Context(), Context()->activeTexture(GL_TEXTURE0)); @@ -2772,20 +2737,6 @@ const GLRenderer::VideoYUVProgram* GLRenderer::GetVideoYUVProgram( return program.get(); } -const GLRenderer::VideoYUVAProgram* GLRenderer::GetVideoYUVAProgram( - TexCoordPrecision precision) { - scoped_ptr<VideoYUVAProgram>& program = - (precision == TexCoordPrecisionHigh) ? video_yuva_program_highp_ - : video_yuva_program_; - if (!program) - program = make_scoped_ptr(new VideoYUVAProgram(context_, precision)); - if (!program->initialized()) { - TRACE_EVENT0("cc", "GLRenderer::videoYUVAProgram::initialize"); - program->Initialize(context_, is_using_bind_uniform_); - } - return program.get(); -} - const GLRenderer::VideoStreamTextureProgram* GLRenderer::GetVideoStreamTextureProgram(TexCoordPrecision precision) { if (!Capabilities().using_egl_image) @@ -2886,15 +2837,11 @@ void GLRenderer::CleanupSharedObjects() { if (video_yuv_program_) video_yuv_program_->Cleanup(context_); - if (video_yuva_program_) - video_yuva_program_->Cleanup(context_); if (video_stream_texture_program_) video_stream_texture_program_->Cleanup(context_); if (video_yuv_program_highp_) video_yuv_program_highp_->Cleanup(context_); - if (video_yuva_program_highp_) - video_yuva_program_highp_->Cleanup(context_); if (video_stream_texture_program_highp_) video_stream_texture_program_highp_->Cleanup(context_); diff --git a/cc/output/gl_renderer.h b/cc/output/gl_renderer.h index a9ebe83..1c30d34 100644 --- a/cc/output/gl_renderer.h +++ b/cc/output/gl_renderer.h @@ -289,8 +289,6 @@ class CC_EXPORT GLRenderer VideoStreamTextureProgram; typedef ProgramBinding<VertexShaderPosTexYUVStretch, FragmentShaderYUVVideo> VideoYUVProgram; - typedef ProgramBinding<VertexShaderPosTexYUVStretch, FragmentShaderYUVAVideo> - VideoYUVAProgram; // Special purpose / effects shaders. typedef ProgramBinding<VertexShaderPos, FragmentShaderColor> @@ -336,8 +334,6 @@ class CC_EXPORT GLRenderer const VideoYUVProgram* GetVideoYUVProgram( TexCoordPrecision precision); - const VideoYUVAProgram* GetVideoYUVAProgram( - TexCoordPrecision precision); const VideoStreamTextureProgram* GetVideoStreamTextureProgram( TexCoordPrecision precision); @@ -394,11 +390,9 @@ class CC_EXPORT GLRenderer render_pass_mask_color_matrix_program_aa_highp_; scoped_ptr<VideoYUVProgram> video_yuv_program_; - scoped_ptr<VideoYUVAProgram> video_yuva_program_; scoped_ptr<VideoStreamTextureProgram> video_stream_texture_program_; scoped_ptr<VideoYUVProgram> video_yuv_program_highp_; - scoped_ptr<VideoYUVAProgram> video_yuva_program_highp_; scoped_ptr<VideoStreamTextureProgram> video_stream_texture_program_highp_; scoped_ptr<DebugBorderProgram> debug_border_program_; diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc index de40ff0..48a5951 100644 --- a/cc/output/gl_renderer_unittest.cc +++ b/cc/output/gl_renderer_unittest.cc @@ -96,7 +96,6 @@ class GLRendererShaderPixelTest : public GLRendererPixelTest { EXPECT_PROGRAM_VALID(renderer()->GetTextureProgramFlip(precision)); EXPECT_PROGRAM_VALID(renderer()->GetTextureIOSurfaceProgram(precision)); EXPECT_PROGRAM_VALID(renderer()->GetVideoYUVProgram(precision)); - EXPECT_PROGRAM_VALID(renderer()->GetVideoYUVAProgram(precision)); // This is unlikely to be ever true in tests due to usage of osmesa. if (renderer()->Capabilities().using_egl_image) EXPECT_PROGRAM_VALID(renderer()->GetVideoStreamTextureProgram(precision)); diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc index 32b7d63..d479e5f 100644 --- a/cc/output/renderer_pixeltest.cc +++ b/cc/output/renderer_pixeltest.cc @@ -207,122 +207,6 @@ TYPED_TEST(RendererPixelTest, SimpleGreenRect_NonRootRenderPass) { ExactPixelComparator(true))); } -class VideoGLRendererPixelTest : public GLRendererPixelTest { - protected: - scoped_ptr<YUVVideoDrawQuad> CreateTestYUVVideoDrawQuad( - SharedQuadState* shared_state, bool with_alpha) { - gfx::Rect rect(this->device_viewport_size_); - gfx::Rect opaque_rect(0, 0, 0, 0); - - ResourceProvider::ResourceId y_resource = - resource_provider_->CreateResource( - this->device_viewport_size_, - GL_RGBA, - ResourceProvider::TextureUsageAny); - ResourceProvider::ResourceId u_resource = - resource_provider_->CreateResource( - this->device_viewport_size_, - GL_RGBA, - ResourceProvider::TextureUsageAny); - ResourceProvider::ResourceId v_resource = - resource_provider_->CreateResource( - this->device_viewport_size_, - GL_RGBA, - ResourceProvider::TextureUsageAny); - ResourceProvider::ResourceId a_resource = 0; - if (with_alpha) { - a_resource = resource_provider_->CreateResource( - this->device_viewport_size_, - GL_RGBA, - ResourceProvider::TextureUsageAny); - } - - int w = this->device_viewport_size_.width(); - int h = this->device_viewport_size_.height(); - const int y_plane_size = w * h; - const int uv_plane_size = ((w + 1) / 2) * ((h + 1) / 2); - scoped_ptr<uint8_t[]> y_plane(new uint8_t[y_plane_size]); - scoped_ptr<uint8_t[]> u_plane(new uint8_t[uv_plane_size]); - scoped_ptr<uint8_t[]> v_plane(new uint8_t[uv_plane_size]); - scoped_ptr<uint8_t[]> a_plane; - if (with_alpha) - a_plane.reset(new uint8_t[y_plane_size]); - // YUV values representing Green. - memset(y_plane.get(), 149, y_plane_size); - memset(u_plane.get(), 43, uv_plane_size); - memset(v_plane.get(), 21, uv_plane_size); - if (with_alpha) - memset(a_plane.get(), 128, y_plane_size); - - resource_provider_->SetPixels(y_resource, y_plane.get(), rect, rect, - gfx::Vector2d()); - resource_provider_->SetPixels(u_resource, u_plane.get(), rect, rect, - gfx::Vector2d()); - resource_provider_->SetPixels(v_resource, v_plane.get(), rect, rect, - gfx::Vector2d()); - if (with_alpha) { - resource_provider_->SetPixels(a_resource, a_plane.get(), rect, rect, - gfx::Vector2d()); - } - - scoped_ptr<YUVVideoDrawQuad> yuv_quad = cc::YUVVideoDrawQuad::Create(); - yuv_quad->SetNew(shared_state, rect, opaque_rect, gfx::Size(), - y_resource, u_resource, v_resource, a_resource); - return yuv_quad.Pass(); - } -}; - -TEST_F(VideoGLRendererPixelTest, SimpleYUVRect) { - gfx::Rect rect(this->device_viewport_size_); - - RenderPass::Id id(1, 1); - scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect); - - scoped_ptr<SharedQuadState> shared_state = - CreateTestSharedQuadState(gfx::Transform(), rect); - - scoped_ptr<YUVVideoDrawQuad> yuv_quad = - CreateTestYUVVideoDrawQuad(shared_state.get(), false); - - pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>()); - - RenderPassList pass_list; - pass_list.push_back(pass.Pass()); - - EXPECT_TRUE(this->RunPixelTest( - &pass_list, - base::FilePath(FILE_PATH_LITERAL("green.png")), - ExactPixelComparator(true))); -} - -TEST_F(VideoGLRendererPixelTest, SimpleYUVARect) { - gfx::Rect rect(this->device_viewport_size_); - - RenderPass::Id id(1, 1); - scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect); - - scoped_ptr<SharedQuadState> shared_state = - CreateTestSharedQuadState(gfx::Transform(), rect); - - scoped_ptr<YUVVideoDrawQuad> yuv_quad = - CreateTestYUVVideoDrawQuad(shared_state.get(), true); - - pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>()); - - scoped_ptr<SolidColorDrawQuad> color_quad = SolidColorDrawQuad::Create(); - color_quad->SetNew(shared_state.get(), rect, SK_ColorWHITE, false); - - pass->quad_list.push_back(color_quad.PassAs<DrawQuad>()); - - RenderPassList pass_list; - pass_list.push_back(pass.Pass()); - - EXPECT_TRUE(this->RunPixelTest( - &pass_list, - base::FilePath(FILE_PATH_LITERAL("green_alpha.png")), - ExactPixelComparator(true))); -} - TYPED_TEST(RendererPixelTest, FastPassColorFilterAlpha) { gfx::Rect viewport_rect(this->device_viewport_size_); diff --git a/cc/output/shader.cc b/cc/output/shader.cc index 3181a37..4a97a8e 100644 --- a/cc/output/shader.cc +++ b/cc/output/shader.cc @@ -1355,79 +1355,6 @@ std::string FragmentShaderYUVVideo::GetShaderString( ); // NOLINT(whitespace/parens) } -FragmentShaderYUVAVideo::FragmentShaderYUVAVideo() - : y_texture_location_(-1), - u_texture_location_(-1), - v_texture_location_(-1), - a_texture_location_(-1), - alpha_location_(-1), - yuv_matrix_location_(-1), - yuv_adj_location_(-1) { -} - -void FragmentShaderYUVAVideo::Init(WebGraphicsContext3D* context, - unsigned program, - bool using_bind_uniform, - int* base_uniform_index) { - static const char* shader_uniforms[] = { - "y_texture", - "u_texture", - "v_texture", - "a_texture", - "alpha", - "cc_matrix", - "yuv_adj", - }; - int locations[7]; - - GetProgramUniformLocations(context, - program, - shader_uniforms, - arraysize(shader_uniforms), - arraysize(locations), - locations, - using_bind_uniform, - base_uniform_index); - - y_texture_location_ = locations[0]; - u_texture_location_ = locations[1]; - v_texture_location_ = locations[2]; - a_texture_location_ = locations[3]; - alpha_location_ = locations[4]; - yuv_matrix_location_ = locations[5]; - yuv_adj_location_ = locations[6]; - - DCHECK(y_texture_location_ != -1 && u_texture_location_ != -1 && - v_texture_location_ != -1 && a_texture_location_ != -1 && - alpha_location_ != -1 && yuv_matrix_location_ != -1 && - yuv_adj_location_ != -1); -} - -std::string FragmentShaderYUVAVideo::GetShaderString( - TexCoordPrecision precision) const { - return FRAGMENT_SHADER( - precision mediump float; - precision mediump int; - varying TexCoordPrecision vec2 v_texCoord; - uniform sampler2D y_texture; - uniform sampler2D u_texture; - uniform sampler2D v_texture; - uniform sampler2D a_texture; - uniform float alpha; - uniform vec3 yuv_adj; - uniform mat3 yuv_matrix; - void main() { - float y_raw = texture2D(y_texture, v_texCoord).x; - float u_unsigned = texture2D(u_texture, v_texCoord).x; - float v_unsigned = texture2D(v_texture, v_texCoord).x; - float a_raw = texture2D(a_texture, v_texCoord).x; - vec3 yuv = vec3(y_raw, u_unsigned, v_unsigned) + yuv_adj; - vec3 rgb = yuv_matrix * yuv; - gl_FragColor = vec4(rgb, a_raw) * alpha; - } - ); // NOLINT(whitespace/parens) -} - FragmentShaderColor::FragmentShaderColor() : color_location_(-1) {} diff --git a/cc/output/shader.h b/cc/output/shader.h index 7200f35..9b76ca2c 100644 --- a/cc/output/shader.h +++ b/cc/output/shader.h @@ -575,37 +575,6 @@ class FragmentShaderYUVVideo { DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVVideo); }; - -class FragmentShaderYUVAVideo { - public: - FragmentShaderYUVAVideo(); - std::string GetShaderString(TexCoordPrecision precision) const; - - void Init(WebKit::WebGraphicsContext3D* context, - unsigned program, - bool using_bind_uniform, - int* base_uniform_index); - - int y_texture_location() const { return y_texture_location_; } - int u_texture_location() const { return u_texture_location_; } - int v_texture_location() const { return v_texture_location_; } - int a_texture_location() const { return a_texture_location_; } - int alpha_location() const { return alpha_location_; } - int yuv_matrix_location() const { return yuv_matrix_location_; } - int yuv_adj_location() const { return yuv_adj_location_; } - - private: - int y_texture_location_; - int u_texture_location_; - int v_texture_location_; - int a_texture_location_; - int alpha_location_; - int yuv_matrix_location_; - int yuv_adj_location_; - - DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVAVideo); -}; - class FragmentShaderColor { public: FragmentShaderColor(); diff --git a/cc/quads/draw_quad_unittest.cc b/cc/quads/draw_quad_unittest.cc index 0c17413..3eca8e4 100644 --- a/cc/quads/draw_quad_unittest.cc +++ b/cc/quads/draw_quad_unittest.cc @@ -623,36 +623,31 @@ TEST(DrawQuadTest, CopyYUVVideoDrawQuad) { ResourceProvider::ResourceId y_plane_resource_id = 45; ResourceProvider::ResourceId u_plane_resource_id = 532; ResourceProvider::ResourceId v_plane_resource_id = 4; - ResourceProvider::ResourceId a_plane_resource_id = 63; CREATE_SHARED_STATE(); - CREATE_QUAD_6_NEW(YUVVideoDrawQuad, + CREATE_QUAD_5_NEW(YUVVideoDrawQuad, opaque_rect, tex_scale, y_plane_resource_id, u_plane_resource_id, - v_plane_resource_id, - a_plane_resource_id); + v_plane_resource_id); EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); EXPECT_EQ(tex_scale, copy_quad->tex_scale); EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id); EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); - EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id); - CREATE_QUAD_5_ALL(YUVVideoDrawQuad, + CREATE_QUAD_4_ALL(YUVVideoDrawQuad, tex_scale, y_plane_resource_id, u_plane_resource_id, - v_plane_resource_id, - a_plane_resource_id); + v_plane_resource_id); EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); EXPECT_EQ(tex_scale, copy_quad->tex_scale); EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id); EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); - EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id); } TEST(DrawQuadTest, CopyPictureDrawQuad) { @@ -859,26 +854,22 @@ TEST_F(DrawQuadIteratorTest, YUVVideoDrawQuad) { ResourceProvider::ResourceId y_plane_resource_id = 45; ResourceProvider::ResourceId u_plane_resource_id = 532; ResourceProvider::ResourceId v_plane_resource_id = 4; - ResourceProvider::ResourceId a_plane_resource_id = 63; CREATE_SHARED_STATE(); - CREATE_QUAD_6_NEW(YUVVideoDrawQuad, + CREATE_QUAD_5_NEW(YUVVideoDrawQuad, opaque_rect, tex_scale, y_plane_resource_id, u_plane_resource_id, - v_plane_resource_id, - a_plane_resource_id); + v_plane_resource_id); EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); EXPECT_EQ(y_plane_resource_id, quad_new->y_plane_resource_id); EXPECT_EQ(u_plane_resource_id, quad_new->u_plane_resource_id); EXPECT_EQ(v_plane_resource_id, quad_new->v_plane_resource_id); - EXPECT_EQ(a_plane_resource_id, quad_new->a_plane_resource_id); - EXPECT_EQ(4, IterateAndCount(quad_new.get())); + EXPECT_EQ(3, IterateAndCount(quad_new.get())); EXPECT_EQ(y_plane_resource_id + 1, quad_new->y_plane_resource_id); EXPECT_EQ(u_plane_resource_id + 1, quad_new->u_plane_resource_id); EXPECT_EQ(v_plane_resource_id + 1, quad_new->v_plane_resource_id); - EXPECT_EQ(a_plane_resource_id + 1, quad_new->a_plane_resource_id); } // Disabled until picture draw quad is supported for ubercomp: crbug.com/231715 diff --git a/cc/quads/yuv_video_draw_quad.cc b/cc/quads/yuv_video_draw_quad.cc index 2ac75dc..f63c612 100644 --- a/cc/quads/yuv_video_draw_quad.cc +++ b/cc/quads/yuv_video_draw_quad.cc @@ -11,8 +11,7 @@ namespace cc { YUVVideoDrawQuad::YUVVideoDrawQuad() : y_plane_resource_id(0), u_plane_resource_id(0), - v_plane_resource_id(0), - a_plane_resource_id(0) {} + v_plane_resource_id(0) {} YUVVideoDrawQuad::~YUVVideoDrawQuad() {} scoped_ptr<YUVVideoDrawQuad> YUVVideoDrawQuad::Create() { @@ -25,8 +24,7 @@ void YUVVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, gfx::SizeF tex_scale, unsigned y_plane_resource_id, unsigned u_plane_resource_id, - unsigned v_plane_resource_id, - unsigned a_plane_resource_id) { + unsigned v_plane_resource_id) { gfx::Rect visible_rect = rect; bool needs_blending = false; DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, @@ -35,7 +33,6 @@ void YUVVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state, this->y_plane_resource_id = y_plane_resource_id; this->u_plane_resource_id = u_plane_resource_id; this->v_plane_resource_id = v_plane_resource_id; - this->a_plane_resource_id = a_plane_resource_id; } void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, @@ -46,15 +43,13 @@ void YUVVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state, gfx::SizeF tex_scale, unsigned y_plane_resource_id, unsigned u_plane_resource_id, - unsigned v_plane_resource_id, - unsigned a_plane_resource_id) { + unsigned v_plane_resource_id) { DrawQuad::SetAll(shared_quad_state, DrawQuad::YUV_VIDEO_CONTENT, rect, opaque_rect, visible_rect, needs_blending); this->tex_scale = tex_scale; this->y_plane_resource_id = y_plane_resource_id; this->u_plane_resource_id = u_plane_resource_id; this->v_plane_resource_id = v_plane_resource_id; - this->a_plane_resource_id = a_plane_resource_id; } void YUVVideoDrawQuad::IterateResources( @@ -62,8 +57,6 @@ void YUVVideoDrawQuad::IterateResources( y_plane_resource_id = callback.Run(y_plane_resource_id); u_plane_resource_id = callback.Run(u_plane_resource_id); v_plane_resource_id = callback.Run(v_plane_resource_id); - if (a_plane_resource_id) - a_plane_resource_id = callback.Run(a_plane_resource_id); } const YUVVideoDrawQuad* YUVVideoDrawQuad::MaterialCast( diff --git a/cc/quads/yuv_video_draw_quad.h b/cc/quads/yuv_video_draw_quad.h index 34a0612..9d54227 100644 --- a/cc/quads/yuv_video_draw_quad.h +++ b/cc/quads/yuv_video_draw_quad.h @@ -25,8 +25,7 @@ class CC_EXPORT YUVVideoDrawQuad : public DrawQuad { gfx::SizeF tex_scale, unsigned y_plane_resource_id, unsigned u_plane_resource_id, - unsigned v_plane_resource_id, - unsigned a_plane_resource_id); + unsigned v_plane_resource_id); void SetAll(const SharedQuadState* shared_quad_state, gfx::Rect rect, @@ -36,14 +35,12 @@ class CC_EXPORT YUVVideoDrawQuad : public DrawQuad { gfx::SizeF tex_scale, unsigned y_plane_resource_id, unsigned u_plane_resource_id, - unsigned v_plane_resource_id, - unsigned a_plane_resource_id); + unsigned v_plane_resource_id); gfx::SizeF tex_scale; unsigned y_plane_resource_id; unsigned u_plane_resource_id; unsigned v_plane_resource_id; - unsigned a_plane_resource_id; virtual void IterateResources(const ResourceIteratorCallback& callback) OVERRIDE; diff --git a/cc/test/render_pass_test_common.cc b/cc/test/render_pass_test_common.cc index fc98001..9818603 100644 --- a/cc/test/render_pass_test_common.cc +++ b/cc/test/render_pass_test_common.cc @@ -207,8 +207,8 @@ void TestRenderPass::AppendOneOfEveryQuadType( false); AppendQuad(tile_quad.PassAs<DrawQuad>()); - ResourceProvider::ResourceId plane_resources[4]; - for (int i = 0; i < 4; ++i) { + ResourceProvider::ResourceId plane_resources[3]; + for (int i = 0; i < 3; ++i) { plane_resources[i] = resource_provider->CreateResource( gfx::Size(20, 12), @@ -224,8 +224,7 @@ void TestRenderPass::AppendOneOfEveryQuadType( gfx::Size(100, 100), plane_resources[0], plane_resources[1], - plane_resources[2], - plane_resources[3]); + plane_resources[2]); AppendQuad(yuv_quad.PassAs<DrawQuad>()); AppendSharedQuadState(transformed_state.Pass()); diff --git a/content/common/cc_messages.h b/content/common/cc_messages.h index f09c9f2..fcc1db8 100644 --- a/content/common/cc_messages.h +++ b/content/common/cc_messages.h @@ -191,7 +191,6 @@ IPC_STRUCT_TRAITS_BEGIN(cc::YUVVideoDrawQuad) IPC_STRUCT_TRAITS_MEMBER(y_plane_resource_id) IPC_STRUCT_TRAITS_MEMBER(u_plane_resource_id) IPC_STRUCT_TRAITS_MEMBER(v_plane_resource_id) - IPC_STRUCT_TRAITS_MEMBER(a_plane_resource_id) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(cc::SharedQuadState) diff --git a/content/common/cc_messages_unittest.cc b/content/common/cc_messages_unittest.cc index 9921323..7d20b8c 100644 --- a/content/common/cc_messages_unittest.cc +++ b/content/common/cc_messages_unittest.cc @@ -172,7 +172,6 @@ class CCMessagesTest : public testing::Test { EXPECT_EQ(a->y_plane_resource_id, b->y_plane_resource_id); EXPECT_EQ(a->u_plane_resource_id, b->u_plane_resource_id); EXPECT_EQ(a->v_plane_resource_id, b->v_plane_resource_id); - EXPECT_EQ(a->a_plane_resource_id, b->a_plane_resource_id); } void Compare(const TransferableResource& a, const TransferableResource& b) { @@ -218,7 +217,6 @@ TEST_F(CCMessagesTest, AllQuads) { ResourceProvider::ResourceId arbitrary_resourceid1 = 55; ResourceProvider::ResourceId arbitrary_resourceid2 = 47; ResourceProvider::ResourceId arbitrary_resourceid3 = 23; - ResourceProvider::ResourceId arbitrary_resourceid4 = 16; WebFilterOperations arbitrary_filters1; arbitrary_filters1.append(WebFilterOperation::createGrayscaleFilter( @@ -374,8 +372,7 @@ TEST_F(CCMessagesTest, AllQuads) { arbitrary_sizef1, arbitrary_resourceid1, arbitrary_resourceid2, - arbitrary_resourceid3, - arbitrary_resourceid4); + arbitrary_resourceid3); scoped_ptr<DrawQuad> yuvvideo_cmp = yuvvideo_in->Copy( yuvvideo_in->shared_quad_state); |