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

Side by Side Diff: cc/output/overlay_strategy_underlay_cast.cc

Issue 2693023002: Use SwapBuffersWithBounds on Chromecast (Closed)
Patch Set: Address danakj comments on PS1 Created 3 years, 10 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "cc/output/overlay_strategy_underlay_cast.h"
6
7 #include "base/containers/adapters.h"
8 #include "cc/quads/draw_quad.h"
9 #include "cc/quads/solid_color_draw_quad.h"
10 #include "ui/gfx/geometry/rect_conversions.h"
11
12 namespace cc {
13
14 OverlayStrategyUnderlayCast::OverlayStrategyUnderlayCast(
15 OverlayCandidateValidator* capability_checker)
16 : OverlayStrategyUnderlay(capability_checker) {}
17
18 OverlayStrategyUnderlayCast::~OverlayStrategyUnderlayCast() {}
19
20 bool OverlayStrategyUnderlayCast::Attempt(
21 ResourceProvider* resource_provider,
22 RenderPass* render_pass,
23 OverlayCandidateList* candidate_list,
24 std::vector<gfx::Rect>* content_bounds) {
25 const QuadList& const_quad_list = render_pass->quad_list;
26 bool found_underlay = false;
27 gfx::Rect content_rect;
28 for (const auto* quad : base::Reversed(const_quad_list)) {
29 if (OverlayCandidate::IsInvisibleQuad(quad))
30 continue;
31
32 const auto& transform = quad->shared_quad_state->quad_to_target_transform;
33 gfx::RectF quad_rect = gfx::RectF(quad->rect);
34 transform.TransformRect(&quad_rect);
35
36 bool is_underlay = false;
37 if (!found_underlay) {
38 OverlayCandidate candidate;
39 is_underlay =
40 OverlayCandidate::FromDrawQuad(resource_provider, quad, &candidate);
danakj 2017/02/16 18:54:19 How robust is it that you're redoing a subset of t
halliwell 2017/02/23 18:01:46 Strictly speaking, it is ok (we always return true
danakj 2017/02/24 22:05:18 If you reproduce the tests for it then that seems
halliwell 2017/02/27 22:57:13 Yep, good point. I added a basic DCHECK that the
41 found_underlay |= is_underlay;
danakj 2017/02/16 18:54:19 you can just use = here if you want. you know foun
halliwell 2017/02/23 18:01:46 Done.
42 }
43
44 if (!found_underlay && quad->material == DrawQuad::SOLID_COLOR) {
45 const SolidColorDrawQuad* solid = SolidColorDrawQuad::MaterialCast(quad);
46 if (solid->color == SK_ColorBLACK)
47 continue;
48 }
49
50 if (is_underlay) {
51 content_rect.Subtract(ToEnclosedRect(quad_rect));
danakj 2017/02/16 18:54:19 Do you have a test verifying the use of Enclosed/E
halliwell 2017/02/23 18:01:46 Test added.
52 } else {
53 content_rect.Union(ToEnclosingRect(quad_rect));
54 }
55 }
56
57 const bool result = OverlayStrategyUnderlay::Attempt(
58 resource_provider, render_pass, candidate_list, content_bounds);
59 DCHECK(content_bounds);
60 content_bounds->clear();
danakj 2017/02/16 18:54:19 I suggest DCHECK its empty instead, if you want. I
halliwell 2017/02/23 18:01:46 Done.
61 if (found_underlay) {
62 content_bounds->push_back(content_rect);
63 }
64 return result;
65 }
66
67 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698