OLD | NEW |
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 #include "ui/compositor/clip_recorder.h" | 5 #include "ui/compositor/clip_recorder.h" |
6 | 6 |
7 #include "cc/playback/clip_display_item.h" | 7 #include "cc/playback/clip_display_item.h" |
8 #include "cc/playback/clip_path_display_item.h" | 8 #include "cc/playback/clip_path_display_item.h" |
9 #include "cc/playback/display_item_list.h" | 9 #include "cc/playback/display_item_list.h" |
10 #include "ui/compositor/paint_context.h" | 10 #include "ui/compositor/paint_context.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 closers_[num_closers_] = closer; | 41 closers_[num_closers_] = closer; |
42 bounds_in_layer_[num_closers_++] = bounds_in_layer; | 42 bounds_in_layer_[num_closers_++] = bounds_in_layer; |
43 } | 43 } |
44 | 44 |
45 static gfx::Rect PathToEnclosingRect(const gfx::Path& path) { | 45 static gfx::Rect PathToEnclosingRect(const gfx::Path& path) { |
46 return gfx::ToEnclosingRect(gfx::SkRectToRectF(path.getBounds())); | 46 return gfx::ToEnclosingRect(gfx::SkRectToRectF(path.getBounds())); |
47 } | 47 } |
48 | 48 |
49 void ClipRecorder::ClipRect(const gfx::Rect& clip_rect) { | 49 void ClipRecorder::ClipRect(const gfx::Rect& clip_rect) { |
50 gfx::Rect clip_in_layer_space = context_.ToLayerSpaceRect(clip_rect); | 50 gfx::Rect clip_in_layer_space = context_.ToLayerSpaceRect(clip_rect); |
51 context_.list_->CreateAndAppendItem<cc::ClipDisplayItem>( | 51 auto* item = context_.list_->CreateAndAppendItem<cc::ClipDisplayItem>( |
52 clip_in_layer_space, clip_rect, std::vector<SkRRect>()); | 52 clip_in_layer_space); |
| 53 item->SetNew(clip_rect, std::vector<SkRRect>()); |
53 RecordCloser(clip_in_layer_space, CLIP_RECT); | 54 RecordCloser(clip_in_layer_space, CLIP_RECT); |
54 } | 55 } |
55 | 56 |
56 void ClipRecorder::ClipPath(const gfx::Path& clip_path) { | 57 void ClipRecorder::ClipPath(const gfx::Path& clip_path) { |
57 bool anti_alias = false; | 58 bool anti_alias = false; |
58 gfx::Rect clip_in_layer_space = | 59 gfx::Rect clip_in_layer_space = |
59 context_.ToLayerSpaceRect(PathToEnclosingRect(clip_path)); | 60 context_.ToLayerSpaceRect(PathToEnclosingRect(clip_path)); |
60 context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>( | 61 auto* item = context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>( |
61 clip_in_layer_space, clip_path, SkRegion::kIntersect_Op, anti_alias); | 62 clip_in_layer_space); |
| 63 item->SetNew(clip_path, SkRegion::kIntersect_Op, anti_alias); |
62 RecordCloser(clip_in_layer_space, CLIP_PATH); | 64 RecordCloser(clip_in_layer_space, CLIP_PATH); |
63 } | 65 } |
64 | 66 |
65 void ClipRecorder::ClipPathWithAntiAliasing(const gfx::Path& clip_path) { | 67 void ClipRecorder::ClipPathWithAntiAliasing(const gfx::Path& clip_path) { |
66 bool anti_alias = true; | 68 bool anti_alias = true; |
67 gfx::Rect clip_in_layer_space = | 69 gfx::Rect clip_in_layer_space = |
68 context_.ToLayerSpaceRect(PathToEnclosingRect(clip_path)); | 70 context_.ToLayerSpaceRect(PathToEnclosingRect(clip_path)); |
69 context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>( | 71 auto* item = context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>( |
70 clip_in_layer_space, clip_path, SkRegion::kIntersect_Op, anti_alias); | 72 clip_in_layer_space); |
| 73 item->SetNew(clip_path, SkRegion::kIntersect_Op, anti_alias); |
71 RecordCloser(clip_in_layer_space, CLIP_PATH); | 74 RecordCloser(clip_in_layer_space, CLIP_PATH); |
72 } | 75 } |
73 | 76 |
74 } // namespace ui | 77 } // namespace ui |
OLD | NEW |