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

Side by Side Diff: cc/blink/blink_layer_debug_info.cc

Issue 474783002: HUD: Show first paint invalidation in red (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compilefix Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « cc/blink/blink_layer_debug_info.h ('k') | cc/blink/cc_blink.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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/blink/blink_layer_debug_info.h"
6
7 #include "cc/base/math_util.h"
8 #include "cc/debug/debug_rect_history.h"
9 #include "cc/layers/layer.h"
10 #include "third_party/WebKit/public/platform/WebGraphicsLayerDebugInfo.h"
11 #include "third_party/WebKit/public/platform/WebInvalidationDebugAnnotations.h"
12 #include "third_party/WebKit/public/platform/WebVector.h"
13 #include "ui/gfx/geometry/rect_conversions.h"
14
15 namespace cc_blink {
16
17 BlinkLayerDebugInfo::BlinkLayerDebugInfo(
18 blink::WebGraphicsLayerDebugInfo* debug_info)
19 : debug_info_(debug_info) {
20 }
21
22 BlinkLayerDebugInfo::~BlinkLayerDebugInfo() {
23 }
24
25 void BlinkLayerDebugInfo::AppendAsTraceFormat(std::string* out) const {
26 DCHECK(thread_checker_.CalledOnValidThread());
27 blink::WebString web_string;
28 debug_info_->appendAsTraceFormat(&web_string);
29 out->append(web_string.utf8());
30 }
31
32 namespace {
33
34 cc::DebugRectType WebInvalidationDebugAnnotationsToDebugRectType(
35 blink::WebInvalidationDebugAnnotations annotations) {
36 if (annotations == blink::WebInvalidationDebugAnnotationsFirstPaint) {
37 return cc::FIRST_PAINT_RECT_TYPE;
38 }
39
40 return cc::PAINT_RECT_TYPE;
41 }
42
43 } // namespace
44
45 std::vector<cc::DebugRect> BlinkLayerDebugInfo::GetInvalidationRects(
46 cc::Layer* layer) const {
47 std::vector<cc::DebugRect> rects;
48
49 blink::WebVector<blink::WebAnnotatedInvalidationRect> web_rects;
50 debug_info_->getAnnotatedInvalidationRects(web_rects);
51
52 float width_scale = layer->content_bounds().width() /
53 static_cast<float>(layer->bounds().width());
54 float height_scale = layer->content_bounds().height() /
55 static_cast<float>(layer->bounds().height());
56
57 rects.reserve(web_rects.size());
58 for (size_t i = 0; i < web_rects.size(); ++i) {
59 const blink::WebAnnotatedInvalidationRect& web_rect = web_rects[i];
60 cc::DebugRectType type =
61 WebInvalidationDebugAnnotationsToDebugRectType(web_rect.annotations);
62
63 gfx::Rect update_content_rect = gfx::ScaleToEnclosingRect(
64 gfx::ToEnclosingRect(web_rect.rect), width_scale, height_scale);
65 gfx::Rect screen_space_rect = cc::MathUtil::MapEnclosingClippedRect(
66 layer->screen_space_transform(), update_content_rect);
67 rects.push_back(cc::DebugRect(type, screen_space_rect));
68 }
69
70 return rects;
71 }
72
73 } // namespace cc_blink
OLDNEW
« no previous file with comments | « cc/blink/blink_layer_debug_info.h ('k') | cc/blink/cc_blink.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698