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

Side by Side Diff: ash/laser/laser_pointer_view.cc

Issue 2755463002: [cc] Fix CompositorFrameSinkSupport BeginFrameAck interface. (Closed)
Patch Set: Set BeginFrameAck in all relevant CompositorFrame producers. Created 3 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ash/laser/laser_pointer_view.h" 5 #include "ash/laser/laser_pointer_view.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 8 #include <GLES2/gl2ext.h>
9 #include <GLES2/gl2extchromium.h> 9 #include <GLES2/gl2extchromium.h>
10 10
11 #include <algorithm> 11 #include <algorithm>
12 #include <array> 12 #include <array>
13 #include <cmath> 13 #include <cmath>
14 #include <memory> 14 #include <memory>
15 15
16 #include "ash/laser/laser_pointer_points.h" 16 #include "ash/laser/laser_pointer_points.h"
17 #include "ash/laser/laser_segment_utils.h" 17 #include "ash/laser/laser_segment_utils.h"
18 #include "ash/public/cpp/shell_window_ids.h" 18 #include "ash/public/cpp/shell_window_ids.h"
19 #include "ash/shell.h" 19 #include "ash/shell.h"
20 #include "base/containers/adapters.h" 20 #include "base/containers/adapters.h"
21 #include "base/threading/thread_task_runner_handle.h" 21 #include "base/threading/thread_task_runner_handle.h"
22 #include "base/timer/timer.h" 22 #include "base/timer/timer.h"
23 #include "base/trace_event/trace_event.h" 23 #include "base/trace_event/trace_event.h"
24 #include "cc/output/begin_frame_args.h"
24 #include "cc/output/context_provider.h" 25 #include "cc/output/context_provider.h"
25 #include "cc/quads/texture_draw_quad.h" 26 #include "cc/quads/texture_draw_quad.h"
26 #include "cc/resources/transferable_resource.h" 27 #include "cc/resources/transferable_resource.h"
27 #include "cc/surfaces/surface.h" 28 #include "cc/surfaces/surface.h"
28 #include "cc/surfaces/surface_manager.h" 29 #include "cc/surfaces/surface_manager.h"
29 #include "gpu/command_buffer/client/context_support.h" 30 #include "gpu/command_buffer/client/context_support.h"
30 #include "gpu/command_buffer/client/gles2_interface.h" 31 #include "gpu/command_buffer/client/gles2_interface.h"
31 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" 32 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
32 #include "third_party/skia/include/core/SkColor.h" 33 #include "third_party/skia/include/core/SkColor.h"
33 #include "third_party/skia/include/core/SkTypes.h" 34 #include "third_party/skia/include/core/SkTypes.h"
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 gfx::Transform()); 672 gfx::Transform());
672 surface_damage_rect_ = gfx::Rect(); 673 surface_damage_rect_ = gfx::Rect();
673 674
674 cc::SharedQuadState* quad_state = 675 cc::SharedQuadState* quad_state =
675 render_pass->CreateAndAppendSharedQuadState(); 676 render_pass->CreateAndAppendSharedQuadState();
676 quad_state->quad_layer_bounds = quad_rect.size(); 677 quad_state->quad_layer_bounds = quad_rect.size();
677 quad_state->visible_quad_layer_rect = quad_rect; 678 quad_state->visible_quad_layer_rect = quad_rect;
678 quad_state->opacity = 1.0f; 679 quad_state->opacity = 1.0f;
679 680
680 cc::CompositorFrame frame; 681 cc::CompositorFrame frame;
682 // TODO(eseckler): LaserPointerView should use BeginFrames and set the ack
683 // accordingly.
684 frame.metadata.begin_frame_ack =
685 cc::BeginFrameAck(cc::BeginFrameArgs::kManualSourceId,
686 cc::BeginFrameArgs::kStartingFrameNumber,
687 cc::BeginFrameArgs::kStartingFrameNumber, 0, true);
681 cc::TextureDrawQuad* texture_quad = 688 cc::TextureDrawQuad* texture_quad =
682 render_pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>(); 689 render_pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>();
683 float vertex_opacity[4] = {1.0, 1.0, 1.0, 1.0}; 690 float vertex_opacity[4] = {1.0, 1.0, 1.0, 1.0};
684 gfx::PointF uv_top_left(0.f, 0.f); 691 gfx::PointF uv_top_left(0.f, 0.f);
685 gfx::PointF uv_bottom_right(1.f, 1.f); 692 gfx::PointF uv_bottom_right(1.f, 1.f);
686 texture_quad->SetNew(quad_state, quad_rect, gfx::Rect(), quad_rect, 693 texture_quad->SetNew(quad_state, quad_rect, gfx::Rect(), quad_rect,
687 transferable_resource.id, true, uv_top_left, 694 transferable_resource.id, true, uv_top_left,
688 uv_bottom_right, SK_ColorTRANSPARENT, vertex_opacity, 695 uv_bottom_right, SK_ColorTRANSPARENT, vertex_opacity,
689 false, false, false); 696 false, false, false);
690 texture_quad->set_resource_size_in_pixels(transferable_resource.size); 697 texture_quad->set_resource_size_in_pixels(transferable_resource.size);
(...skipping 21 matching lines...) Expand all
712 pending_draw_surface_ = true; 719 pending_draw_surface_ = true;
713 } 720 }
714 721
715 void LaserPointerView::OnDidDrawSurface() { 722 void LaserPointerView::OnDidDrawSurface() {
716 pending_draw_surface_ = false; 723 pending_draw_surface_ = false;
717 if (needs_update_surface_) 724 if (needs_update_surface_)
718 UpdateSurface(); 725 UpdateSurface();
719 } 726 }
720 727
721 } // namespace ash 728 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698