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

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

Issue 1423653005: Further plumb visual rect into cc:DisplayItemList. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix cc unit tests. Created 5 years, 1 month 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_CLIP_TRANSFORM_RECORDER_H_ 5 #ifndef UI_COMPOSITOR_CLIP_TRANSFORM_RECORDER_H_
6 #define UI_COMPOSITOR_CLIP_TRANSFORM_RECORDER_H_ 6 #define UI_COMPOSITOR_CLIP_TRANSFORM_RECORDER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "ui/compositor/compositor_export.h" 11 #include "ui/compositor/compositor_export.h"
12 #include "ui/gfx/geometry/rect.h"
12 13
13 namespace cc { 14 namespace cc {
14 class DisplayItem; 15 class DisplayItem;
15 class DisplayItemList; 16 class DisplayItemList;
16 } 17 }
17 18
18 namespace gfx { 19 namespace gfx {
19 class Path; 20 class Path;
20 class Rect; 21 class Rect;
21 class Transform; 22 class Transform;
22 } 23 }
23 24
24 namespace ui { 25 namespace ui {
25 class PaintContext; 26 class PaintContext;
26 27
27 // A class to provide scoped clips and transforms of painting to a 28 // A class to provide scoped clips and transforms of painting to a
28 // DisplayItemList. The the clip/transform provided will be applied to any 29 // DisplayItemList. The the clip/transform provided will be applied to any
29 // DisplayItems added to the DisplayItemList while this object is alive. In 30 // DisplayItems added to the DisplayItemList while this object is alive. In
30 // other words, any nested PaintRecorders or other ClipTransformRecorders will 31 // other words, any nested PaintRecorders or other ClipTransformRecorders will
31 // be clipped/transformed. 32 // be clipped/transformed.
32 class COMPOSITOR_EXPORT ClipTransformRecorder { 33 class COMPOSITOR_EXPORT ClipTransformRecorder {
33 public: 34 public:
34 explicit ClipTransformRecorder(const PaintContext& context); 35 // |visual_rect| is expected to be in the coordinate space of the
danakj 2015/11/06 00:32:45 This belongs on visual_rect_, or should talk about
wkorman 2015/11/16 19:01:03 Renamed to layer_size.
36 // layer that contains the view.
37 explicit ClipTransformRecorder(const PaintContext& context,
38 const gfx::Size& visual_size);
35 ~ClipTransformRecorder(); 39 ~ClipTransformRecorder();
36 40
37 void ClipRect(const gfx::Rect& clip_rect); 41 void ClipRect(const gfx::Rect& clip_rect);
38 void ClipPath(const gfx::Path& clip_path); 42 void ClipPath(const gfx::Path& clip_path);
39 void ClipPathWithAntiAliasing(const gfx::Path& clip_path); 43 void ClipPathWithAntiAliasing(const gfx::Path& clip_path);
40 void Transform(const gfx::Transform& transform); 44 void Transform(const gfx::Transform& transform);
41 45
42 private: 46 private:
43 enum Closer { 47 enum Closer {
44 CLIP_RECT, 48 CLIP_RECT,
45 CLIP_PATH, 49 CLIP_PATH,
46 TRANSFORM, 50 TRANSFORM,
47 }; 51 };
48 const PaintContext& context_; 52 const PaintContext& context_;
53 const gfx::Rect visual_rect_;
danakj 2015/11/06 00:32:45 would it make sense to call it layer_bounds_ or la
wkorman 2015/11/16 19:01:03 Renamed to layer_bounds_.
49 // If someone needs to do more than this many operations with a single 54 // If someone needs to do more than this many operations with a single
50 // ClipTransformRecorder then increase the size of the closers_ array. 55 // ClipTransformRecorder then increase the size of the closers_ array.
51 Closer closers_[4]; 56 Closer closers_[4];
52 size_t num_closers_; 57 size_t num_closers_;
53 58
54 DISALLOW_COPY_AND_ASSIGN(ClipTransformRecorder); 59 DISALLOW_COPY_AND_ASSIGN(ClipTransformRecorder);
55 }; 60 };
56 61
57 } // namespace ui 62 } // namespace ui
58 63
59 #endif // UI_COMPOSITOR_CLIP_TRANSFORM_RECORDER_H_ 64 #endif // UI_COMPOSITOR_CLIP_TRANSFORM_RECORDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698