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

Side by Side Diff: components/exo/surface.cc

Issue 2449853004: Getting rid of DelegatedFrameData (Closed)
Patch Set: nit Created 4 years, 1 month 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/trees/layer_tree_host_unittest_context.cc ('k') | components/exo/surface_unittest.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/exo/surface.h" 5 #include "components/exo/surface.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 render_pass->SetAll(cc::RenderPassId(1, 1), gfx::Rect(contents_surface_size), 804 render_pass->SetAll(cc::RenderPassId(1, 1), gfx::Rect(contents_surface_size),
805 damage_rect, gfx::Transform(), true); 805 damage_rect, gfx::Transform(), true);
806 806
807 gfx::Rect quad_rect = gfx::Rect(contents_surface_size); 807 gfx::Rect quad_rect = gfx::Rect(contents_surface_size);
808 cc::SharedQuadState* quad_state = 808 cc::SharedQuadState* quad_state =
809 render_pass->CreateAndAppendSharedQuadState(); 809 render_pass->CreateAndAppendSharedQuadState();
810 quad_state->quad_layer_bounds = contents_surface_size; 810 quad_state->quad_layer_bounds = contents_surface_size;
811 quad_state->visible_quad_layer_rect = quad_rect; 811 quad_state->visible_quad_layer_rect = quad_rect;
812 quad_state->opacity = state_.alpha; 812 quad_state->opacity = state_.alpha;
813 813
814 std::unique_ptr<cc::DelegatedFrameData> delegated_frame( 814 cc::CompositorFrame frame;
815 new cc::DelegatedFrameData);
816 if (current_resource_.id) { 815 if (current_resource_.id) {
817 // Texture quad is only needed if buffer is not fully transparent. 816 // Texture quad is only needed if buffer is not fully transparent.
818 if (state_.alpha) { 817 if (state_.alpha) {
819 cc::TextureDrawQuad* texture_quad = 818 cc::TextureDrawQuad* texture_quad =
820 render_pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>(); 819 render_pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>();
821 float vertex_opacity[4] = {1.0, 1.0, 1.0, 1.0}; 820 float vertex_opacity[4] = {1.0, 1.0, 1.0, 1.0};
822 gfx::Rect opaque_rect; 821 gfx::Rect opaque_rect;
823 if (state_.blend_mode == SkXfermode::kSrc_Mode || 822 if (state_.blend_mode == SkXfermode::kSrc_Mode ||
824 state_.opaque_region.contains(gfx::RectToSkIRect(quad_rect))) { 823 state_.opaque_region.contains(gfx::RectToSkIRect(quad_rect))) {
825 opaque_rect = quad_rect; 824 opaque_rect = quad_rect;
826 } else if (state_.opaque_region.isRect()) { 825 } else if (state_.opaque_region.isRect()) {
827 opaque_rect = gfx::SkIRectToRect(state_.opaque_region.getBounds()); 826 opaque_rect = gfx::SkIRectToRect(state_.opaque_region.getBounds());
828 } 827 }
829 828
830 texture_quad->SetNew(quad_state, quad_rect, opaque_rect, quad_rect, 829 texture_quad->SetNew(quad_state, quad_rect, opaque_rect, quad_rect,
831 current_resource_.id, true, uv_top_left, 830 current_resource_.id, true, uv_top_left,
832 uv_bottom_right, SK_ColorTRANSPARENT, vertex_opacity, 831 uv_bottom_right, SK_ColorTRANSPARENT, vertex_opacity,
833 false, false, state_.only_visible_on_secure_output); 832 false, false, state_.only_visible_on_secure_output);
834 if (current_resource_.is_overlay_candidate) 833 if (current_resource_.is_overlay_candidate)
835 texture_quad->set_resource_size_in_pixels(current_resource_.size); 834 texture_quad->set_resource_size_in_pixels(current_resource_.size);
836 delegated_frame->resource_list.push_back(current_resource_); 835 frame.resource_list.push_back(current_resource_);
837 } 836 }
838 } else { 837 } else {
839 cc::SolidColorDrawQuad* solid_quad = 838 cc::SolidColorDrawQuad* solid_quad =
840 render_pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>(); 839 render_pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>();
841 solid_quad->SetNew(quad_state, quad_rect, quad_rect, SK_ColorBLACK, false); 840 solid_quad->SetNew(quad_state, quad_rect, quad_rect, SK_ColorBLACK, false);
842 } 841 }
843 842
844 delegated_frame->render_pass_list.push_back(std::move(render_pass)); 843 frame.render_pass_list.push_back(std::move(render_pass));
845 cc::CompositorFrame frame;
846 frame.delegated_frame_data = std::move(delegated_frame);
847 844
848 factory_owner_->surface_factory_->SubmitCompositorFrame( 845 factory_owner_->surface_factory_->SubmitCompositorFrame(
849 local_frame_id_, std::move(frame), cc::SurfaceFactory::DrawCallback()); 846 local_frame_id_, std::move(frame), cc::SurfaceFactory::DrawCallback());
850 } 847 }
851 848
852 void Surface::UpdateNeedsBeginFrame() { 849 void Surface::UpdateNeedsBeginFrame() {
853 if (!begin_frame_source_) 850 if (!begin_frame_source_)
854 return; 851 return;
855 852
856 bool needs_begin_frame = !active_frame_callbacks_.empty(); 853 bool needs_begin_frame = !active_frame_callbacks_.empty();
(...skipping 27 matching lines...) Expand all
884 881
885 int64_t Surface::GetPropertyInternal(const void* key, 882 int64_t Surface::GetPropertyInternal(const void* key,
886 int64_t default_value) const { 883 int64_t default_value) const {
887 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); 884 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key);
888 if (iter == prop_map_.end()) 885 if (iter == prop_map_.end())
889 return default_value; 886 return default_value;
890 return iter->second.value; 887 return iter->second.value;
891 } 888 }
892 889
893 } // namespace exo 890 } // namespace exo
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_context.cc ('k') | components/exo/surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698