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

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

Issue 2503203002: Revert "Getting rid of DelegatedFrameData" (Closed)
Patch Set: 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 cc::CompositorFrame frame; 814 std::unique_ptr<cc::DelegatedFrameData> delegated_frame(
815 new cc::DelegatedFrameData);
815 if (current_resource_.id) { 816 if (current_resource_.id) {
816 // Texture quad is only needed if buffer is not fully transparent. 817 // Texture quad is only needed if buffer is not fully transparent.
817 if (state_.alpha) { 818 if (state_.alpha) {
818 cc::TextureDrawQuad* texture_quad = 819 cc::TextureDrawQuad* texture_quad =
819 render_pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>(); 820 render_pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>();
820 float vertex_opacity[4] = {1.0, 1.0, 1.0, 1.0}; 821 float vertex_opacity[4] = {1.0, 1.0, 1.0, 1.0};
821 gfx::Rect opaque_rect; 822 gfx::Rect opaque_rect;
822 if (state_.blend_mode == SkXfermode::kSrc_Mode || 823 if (state_.blend_mode == SkXfermode::kSrc_Mode ||
823 state_.opaque_region.contains(gfx::RectToSkIRect(quad_rect))) { 824 state_.opaque_region.contains(gfx::RectToSkIRect(quad_rect))) {
824 opaque_rect = quad_rect; 825 opaque_rect = quad_rect;
825 } else if (state_.opaque_region.isRect()) { 826 } else if (state_.opaque_region.isRect()) {
826 opaque_rect = gfx::SkIRectToRect(state_.opaque_region.getBounds()); 827 opaque_rect = gfx::SkIRectToRect(state_.opaque_region.getBounds());
827 } 828 }
828 829
829 texture_quad->SetNew(quad_state, quad_rect, opaque_rect, quad_rect, 830 texture_quad->SetNew(quad_state, quad_rect, opaque_rect, quad_rect,
830 current_resource_.id, true, uv_top_left, 831 current_resource_.id, true, uv_top_left,
831 uv_bottom_right, SK_ColorTRANSPARENT, vertex_opacity, 832 uv_bottom_right, SK_ColorTRANSPARENT, vertex_opacity,
832 false, false, state_.only_visible_on_secure_output); 833 false, false, state_.only_visible_on_secure_output);
833 if (current_resource_.is_overlay_candidate) 834 if (current_resource_.is_overlay_candidate)
834 texture_quad->set_resource_size_in_pixels(current_resource_.size); 835 texture_quad->set_resource_size_in_pixels(current_resource_.size);
835 frame.resource_list.push_back(current_resource_); 836 delegated_frame->resource_list.push_back(current_resource_);
836 } 837 }
837 } else { 838 } else {
838 cc::SolidColorDrawQuad* solid_quad = 839 cc::SolidColorDrawQuad* solid_quad =
839 render_pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>(); 840 render_pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>();
840 solid_quad->SetNew(quad_state, quad_rect, quad_rect, SK_ColorBLACK, false); 841 solid_quad->SetNew(quad_state, quad_rect, quad_rect, SK_ColorBLACK, false);
841 } 842 }
842 843
843 frame.render_pass_list.push_back(std::move(render_pass)); 844 delegated_frame->render_pass_list.push_back(std::move(render_pass));
845 cc::CompositorFrame frame;
846 frame.delegated_frame_data = std::move(delegated_frame);
844 847
845 factory_owner_->surface_factory_->SubmitCompositorFrame( 848 factory_owner_->surface_factory_->SubmitCompositorFrame(
846 local_frame_id_, std::move(frame), cc::SurfaceFactory::DrawCallback()); 849 local_frame_id_, std::move(frame), cc::SurfaceFactory::DrawCallback());
847 } 850 }
848 851
849 void Surface::UpdateNeedsBeginFrame() { 852 void Surface::UpdateNeedsBeginFrame() {
850 if (!begin_frame_source_) 853 if (!begin_frame_source_)
851 return; 854 return;
852 855
853 bool needs_begin_frame = !active_frame_callbacks_.empty(); 856 bool needs_begin_frame = !active_frame_callbacks_.empty();
(...skipping 27 matching lines...) Expand all
881 884
882 int64_t Surface::GetPropertyInternal(const void* key, 885 int64_t Surface::GetPropertyInternal(const void* key,
883 int64_t default_value) const { 886 int64_t default_value) const {
884 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); 887 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key);
885 if (iter == prop_map_.end()) 888 if (iter == prop_map_.end())
886 return default_value; 889 return default_value;
887 return iter->second.value; 890 return iter->second.value;
888 } 891 }
889 892
890 } // namespace exo 893 } // 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