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

Side by Side Diff: cc/layers/video_layer_impl.cc

Issue 207233002: cc: Support texcoord offsets in YUVVideoDrawQuad (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 5baa37b0 Initial. Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/output/gl_renderer.h » ('j') | cc/output/renderer_pixeltest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/video_layer_impl.h" 5 #include "cc/layers/video_layer_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "cc/layers/quad_sink.h" 9 #include "cc/layers/quad_sink.h"
10 #include "cc/layers/video_frame_provider_client_impl.h" 10 #include "cc/layers/video_frame_provider_client_impl.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 quad_sink->UseSharedQuadState(CreateSharedQuadState()); 132 quad_sink->UseSharedQuadState(CreateSharedQuadState());
133 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data); 133 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data);
134 134
135 gfx::Rect quad_rect(content_bounds()); 135 gfx::Rect quad_rect(content_bounds());
136 gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect()); 136 gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect());
137 gfx::Rect visible_quad_rect(quad_rect); 137 gfx::Rect visible_quad_rect(quad_rect);
138 gfx::Rect visible_rect = frame_->visible_rect(); 138 gfx::Rect visible_rect = frame_->visible_rect();
139 gfx::Size coded_size = frame_->coded_size(); 139 gfx::Size coded_size = frame_->coded_size();
140 140
141 // Pixels for macroblocked formats. 141 // Pixels for macroblocked formats.
142 float tex_width_scale = 142 const float tex_width_scale =
143 static_cast<float>(visible_rect.width()) / coded_size.width(); 143 static_cast<float>(visible_rect.width()) / coded_size.width();
144 float tex_height_scale = 144 const float tex_height_scale =
145 static_cast<float>(visible_rect.height()) / coded_size.height(); 145 static_cast<float>(visible_rect.height()) / coded_size.height();
146 const float tex_x_offset =
147 static_cast<float>(visible_rect.x()) / coded_size.width();
148 const float tex_y_offset =
149 static_cast<float>(visible_rect.y()) / coded_size.height();
146 150
147 switch (frame_resource_type_) { 151 switch (frame_resource_type_) {
148 // TODO(danakj): Remove this, hide it in the hardware path. 152 // TODO(danakj): Remove this, hide it in the hardware path.
149 case VideoFrameExternalResources::SOFTWARE_RESOURCE: { 153 case VideoFrameExternalResources::SOFTWARE_RESOURCE: {
150 DCHECK_EQ(frame_resources_.size(), 0u); 154 DCHECK_EQ(frame_resources_.size(), 0u);
151 DCHECK_EQ(software_resources_.size(), 1u); 155 DCHECK_EQ(software_resources_.size(), 1u);
152 if (software_resources_.size() < 1u) 156 if (software_resources_.size() < 1u)
153 break; 157 break;
154 bool premultiplied_alpha = true; 158 bool premultiplied_alpha = true;
155 gfx::PointF uv_top_left(0.f, 0.f); 159 gfx::PointF uv_top_left(0.f, 0.f);
(...skipping 12 matching lines...) Expand all
168 SK_ColorTRANSPARENT, 172 SK_ColorTRANSPARENT,
169 opacity, 173 opacity,
170 flipped); 174 flipped);
171 quad_sink->MaybeAppend(texture_quad.PassAs<DrawQuad>()); 175 quad_sink->MaybeAppend(texture_quad.PassAs<DrawQuad>());
172 break; 176 break;
173 } 177 }
174 case VideoFrameExternalResources::YUV_RESOURCE: { 178 case VideoFrameExternalResources::YUV_RESOURCE: {
175 DCHECK_GE(frame_resources_.size(), 3u); 179 DCHECK_GE(frame_resources_.size(), 3u);
176 if (frame_resources_.size() < 3u) 180 if (frame_resources_.size() < 3u)
177 break; 181 break;
178 gfx::SizeF tex_scale(tex_width_scale, tex_height_scale); 182 gfx::RectF tex_coord_rect(
183 tex_x_offset, tex_y_offset, tex_width_scale, tex_height_scale);
179 scoped_ptr<YUVVideoDrawQuad> yuv_video_quad = YUVVideoDrawQuad::Create(); 184 scoped_ptr<YUVVideoDrawQuad> yuv_video_quad = YUVVideoDrawQuad::Create();
180 yuv_video_quad->SetNew( 185 yuv_video_quad->SetNew(
181 shared_quad_state, 186 shared_quad_state,
182 quad_rect, 187 quad_rect,
183 opaque_rect, 188 opaque_rect,
184 visible_quad_rect, 189 visible_quad_rect,
185 tex_scale, 190 tex_coord_rect,
186 frame_resources_[0], 191 frame_resources_[0],
187 frame_resources_[1], 192 frame_resources_[1],
188 frame_resources_[2], 193 frame_resources_[2],
189 frame_resources_.size() > 3 ? frame_resources_[3] : 0); 194 frame_resources_.size() > 3 ? frame_resources_[3] : 0);
190 quad_sink->MaybeAppend(yuv_video_quad.PassAs<DrawQuad>()); 195 quad_sink->MaybeAppend(yuv_video_quad.PassAs<DrawQuad>());
191 break; 196 break;
192 } 197 }
193 case VideoFrameExternalResources::RGB_RESOURCE: { 198 case VideoFrameExternalResources::RGB_RESOURCE: {
194 DCHECK_EQ(frame_resources_.size(), 1u); 199 DCHECK_EQ(frame_resources_.size(), 1u);
195 if (frame_resources_.size() < 1u) 200 if (frame_resources_.size() < 1u)
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 void VideoLayerImpl::SetProviderClientImpl( 317 void VideoLayerImpl::SetProviderClientImpl(
313 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { 318 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) {
314 provider_client_impl_ = provider_client_impl; 319 provider_client_impl_ = provider_client_impl;
315 } 320 }
316 321
317 const char* VideoLayerImpl::LayerTypeAsString() const { 322 const char* VideoLayerImpl::LayerTypeAsString() const {
318 return "cc::VideoLayerImpl"; 323 return "cc::VideoLayerImpl";
319 } 324 }
320 325
321 } // namespace cc 326 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/output/gl_renderer.h » ('j') | cc/output/renderer_pixeltest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698