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

Side by Side Diff: services/ui/demo/bitmap_uploader.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
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 "services/ui/demo/bitmap_uploader.h" 5 #include "services/ui/demo/bitmap_uploader.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 void BitmapUploader::Upload() { 73 void BitmapUploader::Upload() {
74 if (!compositor_frame_sink_ || !compositor_frame_sink_->context_provider()) 74 if (!compositor_frame_sink_ || !compositor_frame_sink_->context_provider())
75 return; 75 return;
76 76
77 const gfx::Rect bounds(window_->bounds().size()); 77 const gfx::Rect bounds(window_->bounds().size());
78 78
79 cc::CompositorFrame frame; 79 cc::CompositorFrame frame;
80 // TODO(rjkroege): Support device scale factors other than 1. 80 // TODO(rjkroege): Support device scale factors other than 1.
81 frame.metadata.device_scale_factor = 1.0f; 81 frame.metadata.device_scale_factor = 1.0f;
82 frame.resource_list.resize(0u); 82 frame.delegated_frame_data.reset(new cc::DelegatedFrameData());
83 frame.delegated_frame_data->resource_list.resize(0u);
83 84
84 const cc::RenderPassId render_pass_id(1, 1); 85 const cc::RenderPassId render_pass_id(1, 1);
85 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); 86 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create();
86 pass->SetAll(render_pass_id, bounds, bounds, gfx::Transform(), 87 pass->SetAll(render_pass_id, bounds, bounds, gfx::Transform(),
87 true /* has_transparent_background */); 88 true /* has_transparent_background */);
88 89
89 // The SharedQuadState is owned by the SharedQuadStateList 90 // The SharedQuadState is owned by the SharedQuadStateList
90 // shared_quad_state_list. 91 // shared_quad_state_list.
91 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); 92 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState();
92 sqs->SetAll(gfx::Transform(), bounds.size(), bounds, bounds, 93 sqs->SetAll(gfx::Transform(), bounds.size(), bounds, bounds,
(...skipping 23 matching lines...) Expand all
116 resource.id = next_resource_id_++; 117 resource.id = next_resource_id_++;
117 resource_to_texture_id_map_[resource.id] = texture_id; 118 resource_to_texture_id_map_[resource.id] = texture_id;
118 resource.format = cc::ResourceFormat::RGBA_8888; 119 resource.format = cc::ResourceFormat::RGBA_8888;
119 resource.filter = GL_LINEAR; 120 resource.filter = GL_LINEAR;
120 resource.size = bitmap_size; 121 resource.size = bitmap_size;
121 resource.mailbox_holder = 122 resource.mailbox_holder =
122 gpu::MailboxHolder(mailbox, sync_token, GL_TEXTURE_2D); 123 gpu::MailboxHolder(mailbox, sync_token, GL_TEXTURE_2D);
123 resource.read_lock_fences_enabled = false; 124 resource.read_lock_fences_enabled = false;
124 resource.is_software = false; 125 resource.is_software = false;
125 resource.is_overlay_candidate = false; 126 resource.is_overlay_candidate = false;
126 frame.resource_list.push_back(std::move(resource)); 127 frame.delegated_frame_data->resource_list.push_back(std::move(resource));
127 128
128 cc::TextureDrawQuad* quad = 129 cc::TextureDrawQuad* quad =
129 pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>(); 130 pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>();
130 131
131 gfx::Size rect_size; 132 gfx::Size rect_size;
132 if (width_ <= bounds.width() && height_ <= bounds.height()) { 133 if (width_ <= bounds.width() && height_ <= bounds.height()) {
133 rect_size.SetSize(width_, height_); 134 rect_size.SetSize(width_, height_);
134 } else { 135 } else {
135 // The source bitmap is larger than the viewport. Resize it while 136 // The source bitmap is larger than the viewport. Resize it while
136 // maintaining the aspect ratio. 137 // maintaining the aspect ratio.
(...skipping 22 matching lines...) Expand all
159 if (color_ != g_transparent_color) { 160 if (color_ != g_transparent_color) {
160 cc::SolidColorDrawQuad* quad = 161 cc::SolidColorDrawQuad* quad =
161 pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>(); 162 pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>();
162 const bool force_antialiasing_off = false; 163 const bool force_antialiasing_off = false;
163 const gfx::Rect opaque_rect(0, 0, 0, 0); 164 const gfx::Rect opaque_rect(0, 0, 0, 0);
164 const bool needs_blending = true; 165 const bool needs_blending = true;
165 quad->SetAll(sqs, bounds, opaque_rect, bounds, needs_blending, color_, 166 quad->SetAll(sqs, bounds, opaque_rect, bounds, needs_blending, color_,
166 force_antialiasing_off); 167 force_antialiasing_off);
167 } 168 }
168 169
169 frame.render_pass_list.push_back(std::move(pass)); 170 frame.delegated_frame_data->render_pass_list.push_back(std::move(pass));
170 171
171 // TODO(rjkroege, fsamuel): We should throttle frames. 172 // TODO(rjkroege, fsamuel): We should throttle frames.
172 compositor_frame_sink_->SubmitCompositorFrame(std::move(frame)); 173 compositor_frame_sink_->SubmitCompositorFrame(std::move(frame));
173 } 174 }
174 175
175 void BitmapUploader::OnGpuChannelEstablished( 176 void BitmapUploader::OnGpuChannelEstablished(
176 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 177 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
177 scoped_refptr<gpu::GpuChannelHost> gpu_channel) { 178 scoped_refptr<gpu::GpuChannelHost> gpu_channel) {
178 compositor_frame_sink_ = window_->RequestCompositorFrameSink( 179 compositor_frame_sink_ = window_->RequestCompositorFrameSink(
179 mojom::CompositorFrameSinkType::DEFAULT, 180 mojom::CompositorFrameSinkType::DEFAULT,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // TODO(fsamuel): Implement this. 235 // TODO(fsamuel): Implement this.
235 } 236 }
236 237
237 void BitmapUploader::SetExternalTilePriorityConstraints( 238 void BitmapUploader::SetExternalTilePriorityConstraints(
238 const gfx::Rect& viewport_rect, 239 const gfx::Rect& viewport_rect,
239 const gfx::Transform& transform) { 240 const gfx::Transform& transform) {
240 // TODO(fsamuel): Implement this. 241 // TODO(fsamuel): Implement this.
241 } 242 }
242 243
243 } // namespace ui 244 } // namespace ui
OLDNEW
« no previous file with comments | « content/renderer/android/synchronous_compositor_frame_sink.cc ('k') | services/ui/surfaces/display_compositor_frame_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698