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

Side by Side Diff: ui/compositor/paint_context.h

Issue 2877483003: Implements core logic for Pixel Canvas (Closed)
Patch Set: Update tests Created 3 years, 5 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 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 #ifndef UI_COMPOSITOR_PAINT_CONTEXT_H_ 5 #ifndef UI_COMPOSITOR_PAINT_CONTEXT_H_
6 #define UI_COMPOSITOR_PAINT_CONTEXT_H_ 6 #define UI_COMPOSITOR_PAINT_CONTEXT_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 28 matching lines...) Expand all
39 CLONE_WITHOUT_INVALIDATION, 39 CLONE_WITHOUT_INVALIDATION,
40 }; 40 };
41 PaintContext(const PaintContext& other, CloneWithoutInvalidation c); 41 PaintContext(const PaintContext& other, CloneWithoutInvalidation c);
42 42
43 ~PaintContext(); 43 ~PaintContext();
44 44
45 // When true, IsRectInvalid() can be called, otherwise its result would be 45 // When true, IsRectInvalid() can be called, otherwise its result would be
46 // invalid. 46 // invalid.
47 bool CanCheckInvalid() const { return !invalidation_.IsEmpty(); } 47 bool CanCheckInvalid() const { return !invalidation_.IsEmpty(); }
48 48
49 float device_scale_factor() const { return device_scale_factor_; }
50
49 // When true, the |bounds| touches an invalidated area, so should be 51 // When true, the |bounds| touches an invalidated area, so should be
50 // re-painted. When false, re-painting can be skipped. Bounds should be in 52 // re-painted. When false, re-painting can be skipped. Bounds should be in
51 // the local space with offsets up to the painting root in the PaintContext. 53 // the local space with offsets up to the painting root in the PaintContext.
52 bool IsRectInvalid(const gfx::Rect& bounds) const { 54 bool IsRectInvalid(const gfx::Rect& bounds) const {
53 DCHECK(CanCheckInvalid()); 55 DCHECK(CanCheckInvalid());
54 return invalidation_.Intersects(bounds + offset_); 56 return invalidation_.Intersects(bounds + offset_);
55 } 57 }
56 58
57 #if DCHECK_IS_ON() 59 #if DCHECK_IS_ON()
58 void Visited(void* visited) const { 60 void Visited(void* visited) const {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // recorder is active. 105 // recorder is active.
104 mutable bool inside_paint_recorder_; 106 mutable bool inside_paint_recorder_;
105 #endif 107 #endif
106 108
107 DISALLOW_COPY_AND_ASSIGN(PaintContext); 109 DISALLOW_COPY_AND_ASSIGN(PaintContext);
108 }; 110 };
109 111
110 } // namespace ui 112 } // namespace ui
111 113
112 #endif // UI_COMPOSITOR_PAINT_CONTEXT_H_ 114 #endif // UI_COMPOSITOR_PAINT_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698