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

Side by Side Diff: pdf/paint_aggregator.cc

Issue 2828413005: Clang format pdf/ (Closed)
Patch Set: Manual tweaks Created 3 years, 8 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
« no previous file with comments | « pdf/out_of_process_instance.cc ('k') | pdf/paint_manager.h » ('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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "pdf/paint_aggregator.h" 5 #include "pdf/paint_aggregator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 22 matching lines...) Expand all
33 // We only support scrolling along one axis at a time. A diagonal scroll will 33 // We only support scrolling along one axis at a time. A diagonal scroll will
34 // therefore be treated as an invalidation. 34 // therefore be treated as an invalidation.
35 // ---------------------------------------------------------------------------- 35 // ----------------------------------------------------------------------------
36 36
37 PaintAggregator::PaintUpdate::PaintUpdate() = default; 37 PaintAggregator::PaintUpdate::PaintUpdate() = default;
38 38
39 PaintAggregator::PaintUpdate::PaintUpdate(const PaintUpdate& that) = default; 39 PaintAggregator::PaintUpdate::PaintUpdate(const PaintUpdate& that) = default;
40 40
41 PaintAggregator::PaintUpdate::~PaintUpdate() = default; 41 PaintAggregator::PaintUpdate::~PaintUpdate() = default;
42 42
43 PaintAggregator::InternalPaintUpdate::InternalPaintUpdate() : 43 PaintAggregator::InternalPaintUpdate::InternalPaintUpdate()
44 synthesized_scroll_damage_rect_(false) { 44 : synthesized_scroll_damage_rect_(false) {}
45 }
46 45
47 PaintAggregator::InternalPaintUpdate::~InternalPaintUpdate() { 46 PaintAggregator::InternalPaintUpdate::~InternalPaintUpdate() {}
48 }
49 47
50 pp::Rect PaintAggregator::InternalPaintUpdate::GetScrollDamage() const { 48 pp::Rect PaintAggregator::InternalPaintUpdate::GetScrollDamage() const {
51 // Should only be scrolling in one direction at a time. 49 // Should only be scrolling in one direction at a time.
52 DCHECK(!(scroll_delta.x() && scroll_delta.y())); 50 DCHECK(!(scroll_delta.x() && scroll_delta.y()));
53 51
54 pp::Rect damaged_rect; 52 pp::Rect damaged_rect;
55 53
56 // Compute the region we will expose by scrolling, and paint that into a 54 // Compute the region we will expose by scrolling, and paint that into a
57 // shared memory section. 55 // shared memory section.
58 if (scroll_delta.x()) { 56 if (scroll_delta.x()) {
(...skipping 17 matching lines...) Expand all
76 } else { 74 } else {
77 damaged_rect.set_y(scroll_rect.bottom() + dy); 75 damaged_rect.set_y(scroll_rect.bottom() + dy);
78 damaged_rect.set_height(-dy); 76 damaged_rect.set_height(-dy);
79 } 77 }
80 } 78 }
81 79
82 // In case the scroll offset exceeds the width/height of the scroll rect 80 // In case the scroll offset exceeds the width/height of the scroll rect
83 return scroll_rect.Intersect(damaged_rect); 81 return scroll_rect.Intersect(damaged_rect);
84 } 82 }
85 83
86 PaintAggregator::PaintAggregator() { 84 PaintAggregator::PaintAggregator() {}
87 }
88 85
89 bool PaintAggregator::HasPendingUpdate() const { 86 bool PaintAggregator::HasPendingUpdate() const {
90 return !update_.scroll_rect.IsEmpty() || !update_.paint_rects.empty(); 87 return !update_.scroll_rect.IsEmpty() || !update_.paint_rects.empty();
91 } 88 }
92 89
93 void PaintAggregator::ClearPendingUpdate() { 90 void PaintAggregator::ClearPendingUpdate() {
94 update_ = InternalPaintUpdate(); 91 update_ = InternalPaintUpdate();
95 } 92 }
96 93
97 PaintAggregator::PaintUpdate PaintAggregator::GetPendingUpdate() { 94 PaintAggregator::PaintUpdate PaintAggregator::GetPendingUpdate() {
(...skipping 16 matching lines...) Expand all
114 ret.paint_rects.reserve(update_.paint_rects.size() + 1); 111 ret.paint_rects.reserve(update_.paint_rects.size() + 1);
115 ret.paint_rects.insert(ret.paint_rects.end(), update_.paint_rects.begin(), 112 ret.paint_rects.insert(ret.paint_rects.end(), update_.paint_rects.begin(),
116 update_.paint_rects.end()); 113 update_.paint_rects.end());
117 114
118 return ret; 115 return ret;
119 } 116 }
120 117
121 void PaintAggregator::SetIntermediateResults( 118 void PaintAggregator::SetIntermediateResults(
122 const std::vector<ReadyRect>& ready, 119 const std::vector<ReadyRect>& ready,
123 const std::vector<pp::Rect>& pending) { 120 const std::vector<pp::Rect>& pending) {
124 update_.ready_rects.insert( 121 update_.ready_rects.insert(update_.ready_rects.end(), ready.begin(),
125 update_.ready_rects.end(), ready.begin(), ready.end()); 122 ready.end());
126 update_.paint_rects = pending; 123 update_.paint_rects = pending;
127 } 124 }
128 125
129 std::vector<PaintAggregator::ReadyRect> PaintAggregator::GetReadyRects() const { 126 std::vector<PaintAggregator::ReadyRect> PaintAggregator::GetReadyRects() const {
130 return update_.ready_rects; 127 return update_.ready_rects;
131 } 128 }
132 129
133 void PaintAggregator::InvalidateRect(const pp::Rect& rect) { 130 void PaintAggregator::InvalidateRect(const pp::Rect& rect) {
134 InvalidateRectInternal(rect, true); 131 InvalidateRectInternal(rect, true);
135 } 132 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 273 }
277 } 274 }
278 275
279 if (add_paint) { 276 if (add_paint) {
280 // Add a non-overlapping paint. 277 // Add a non-overlapping paint.
281 update_.paint_rects.push_back(rect); 278 update_.paint_rects.push_back(rect);
282 } 279 }
283 280
284 // If the new paint overlaps with a scroll, then also invalidate the rect in 281 // If the new paint overlaps with a scroll, then also invalidate the rect in
285 // its new position. 282 // its new position.
286 if (check_scroll && 283 if (check_scroll && !update_.scroll_rect.IsEmpty() &&
287 !update_.scroll_rect.IsEmpty() &&
288 update_.scroll_rect.Intersects(rect)) { 284 update_.scroll_rect.Intersects(rect)) {
289 InvalidateRectInternal(ScrollPaintRect(rect, update_.scroll_delta), false); 285 InvalidateRectInternal(ScrollPaintRect(rect, update_.scroll_delta), false);
290 } 286 }
291 } 287 }
OLDNEW
« no previous file with comments | « pdf/out_of_process_instance.cc ('k') | pdf/paint_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698