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

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

Issue 633773004: cc: Pass Occlusion instead of OcclusionTracker to LayerImpls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 6 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 unified diff | Download patch
« no previous file with comments | « cc/layers/video_layer_impl.h ('k') | cc/test/fake_picture_layer_impl.h » ('j') | no next file with comments »
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/video_frame_provider_client_impl.h" 9 #include "cc/layers/video_frame_provider_client_impl.h"
10 #include "cc/quads/io_surface_draw_quad.h" 10 #include "cc/quads/io_surface_draw_quad.h"
11 #include "cc/quads/stream_video_draw_quad.h" 11 #include "cc/quads/stream_video_draw_quad.h"
12 #include "cc/quads/texture_draw_quad.h" 12 #include "cc/quads/texture_draw_quad.h"
13 #include "cc/quads/yuv_video_draw_quad.h" 13 #include "cc/quads/yuv_video_draw_quad.h"
14 #include "cc/resources/resource_provider.h" 14 #include "cc/resources/resource_provider.h"
15 #include "cc/resources/single_release_callback_impl.h" 15 #include "cc/resources/single_release_callback_impl.h"
16 #include "cc/trees/layer_tree_impl.h" 16 #include "cc/trees/layer_tree_impl.h"
17 #include "cc/trees/occlusion_tracker.h" 17 #include "cc/trees/occlusion.h"
18 #include "cc/trees/proxy.h" 18 #include "cc/trees/proxy.h"
19 #include "media/base/video_frame.h" 19 #include "media/base/video_frame.h"
20 20
21 #if defined(VIDEO_HOLE) 21 #if defined(VIDEO_HOLE)
22 #include "cc/quads/solid_color_draw_quad.h" 22 #include "cc/quads/solid_color_draw_quad.h"
23 #endif // defined(VIDEO_HOLE) 23 #endif // defined(VIDEO_HOLE)
24 24
25 namespace cc { 25 namespace cc {
26 26
27 // static 27 // static
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 unsigned resource_id = resource_provider->CreateResourceFromTextureMailbox( 122 unsigned resource_id = resource_provider->CreateResourceFromTextureMailbox(
123 external_resources.mailboxes[i], 123 external_resources.mailboxes[i],
124 SingleReleaseCallbackImpl::Create( 124 SingleReleaseCallbackImpl::Create(
125 external_resources.release_callbacks[i])); 125 external_resources.release_callbacks[i]));
126 frame_resources_.push_back(resource_id); 126 frame_resources_.push_back(resource_id);
127 } 127 }
128 128
129 return true; 129 return true;
130 } 130 }
131 131
132 void VideoLayerImpl::AppendQuads( 132 void VideoLayerImpl::AppendQuads(RenderPass* render_pass,
133 RenderPass* render_pass, 133 const Occlusion& occlusion_in_content_space,
134 const OcclusionTracker<LayerImpl>& occlusion_tracker, 134 AppendQuadsData* append_quads_data) {
135 AppendQuadsData* append_quads_data) {
136 DCHECK(frame_.get()); 135 DCHECK(frame_.get());
137 136
138 gfx::Transform transform = draw_transform(); 137 gfx::Transform transform = draw_transform();
139 gfx::Size rotated_size = content_bounds(); 138 gfx::Size rotated_size = content_bounds();
140 139
141 switch (video_rotation_) { 140 switch (video_rotation_) {
142 case media::VIDEO_ROTATION_90: 141 case media::VIDEO_ROTATION_90:
143 rotated_size = gfx::Size(rotated_size.height(), rotated_size.width()); 142 rotated_size = gfx::Size(rotated_size.height(), rotated_size.width());
144 transform.Rotate(90.0); 143 transform.Rotate(90.0);
145 transform.Translate(0.0, -rotated_size.height()); 144 transform.Translate(0.0, -rotated_size.height());
(...skipping 22 matching lines...) Expand all
168 sorting_context_id()); 167 sorting_context_id());
169 168
170 AppendDebugBorderQuad( 169 AppendDebugBorderQuad(
171 render_pass, rotated_size, shared_quad_state, append_quads_data); 170 render_pass, rotated_size, shared_quad_state, append_quads_data);
172 171
173 gfx::Rect quad_rect(rotated_size); 172 gfx::Rect quad_rect(rotated_size);
174 gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect()); 173 gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect());
175 gfx::Rect visible_rect = frame_->visible_rect(); 174 gfx::Rect visible_rect = frame_->visible_rect();
176 gfx::Size coded_size = frame_->coded_size(); 175 gfx::Size coded_size = frame_->coded_size();
177 176
177 Occlusion occlusion_in_video_space =
178 occlusion_in_content_space.GetOcclusionWithGivenDrawTransform(transform);
178 gfx::Rect visible_quad_rect = 179 gfx::Rect visible_quad_rect =
179 occlusion_tracker.GetCurrentOcclusionForLayer(transform) 180 occlusion_in_video_space.GetUnoccludedContentRect(quad_rect);
180 .GetUnoccludedContentRect(quad_rect);
181 if (visible_quad_rect.IsEmpty()) 181 if (visible_quad_rect.IsEmpty())
182 return; 182 return;
183 183
184 // Pixels for macroblocked formats. 184 // Pixels for macroblocked formats.
185 const float tex_width_scale = 185 const float tex_width_scale =
186 static_cast<float>(visible_rect.width()) / coded_size.width(); 186 static_cast<float>(visible_rect.width()) / coded_size.width();
187 const float tex_height_scale = 187 const float tex_height_scale =
188 static_cast<float>(visible_rect.height()) / coded_size.height(); 188 static_cast<float>(visible_rect.height()) / coded_size.height();
189 const float tex_x_offset = 189 const float tex_x_offset =
190 static_cast<float>(visible_rect.x()) / coded_size.width(); 190 static_cast<float>(visible_rect.x()) / coded_size.width();
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 void VideoLayerImpl::SetProviderClientImpl( 368 void VideoLayerImpl::SetProviderClientImpl(
369 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { 369 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) {
370 provider_client_impl_ = provider_client_impl; 370 provider_client_impl_ = provider_client_impl;
371 } 371 }
372 372
373 const char* VideoLayerImpl::LayerTypeAsString() const { 373 const char* VideoLayerImpl::LayerTypeAsString() const {
374 return "cc::VideoLayerImpl"; 374 return "cc::VideoLayerImpl";
375 } 375 }
376 376
377 } // namespace cc 377 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/video_layer_impl.h ('k') | cc/test/fake_picture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698