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 19 matching lines...) Expand all Loading... |
30 case CLIP_PATH: | 30 case CLIP_PATH: |
31 context_.list_->CreateAndAppendItem<cc::EndClipPathDisplayItem>( | 31 context_.list_->CreateAndAppendItem<cc::EndClipPathDisplayItem>( |
32 bounds_in_layer_); | 32 bounds_in_layer_); |
33 break; | 33 break; |
34 } | 34 } |
35 } | 35 } |
36 } | 36 } |
37 | 37 |
38 void ClipRecorder::ClipRect(const gfx::Rect& clip_rect) { | 38 void ClipRecorder::ClipRect(const gfx::Rect& clip_rect) { |
39 gfx::Rect clip_in_layer_space = context_.ToLayerSpaceRect(clip_rect); | 39 gfx::Rect clip_in_layer_space = context_.ToLayerSpaceRect(clip_rect); |
40 auto* item = context_.list_->CreateAndAppendItem<cc::ClipDisplayItem>( | 40 context_.list_->CreateAndAppendItem<cc::ClipDisplayItem>( |
41 clip_in_layer_space); | 41 clip_in_layer_space, clip_rect, std::vector<SkRRect>()); |
42 item->SetNew(clip_rect, std::vector<SkRRect>()); | |
43 DCHECK_LT(num_closers_, arraysize(closers_)); | 42 DCHECK_LT(num_closers_, arraysize(closers_)); |
44 closers_[num_closers_++] = CLIP_RECT; | 43 closers_[num_closers_++] = CLIP_RECT; |
45 } | 44 } |
46 | 45 |
47 void ClipRecorder::ClipPath(const gfx::Path& clip_path) { | 46 void ClipRecorder::ClipPath(const gfx::Path& clip_path) { |
48 bool anti_alias = false; | 47 bool anti_alias = false; |
49 // As a further optimization, consider passing a more granular visual rect. | 48 // As a further optimization, consider passing a more granular visual rect. |
50 auto* item = context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>( | 49 context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>( |
51 bounds_in_layer_); | 50 bounds_in_layer_, clip_path, SkRegion::kIntersect_Op, anti_alias); |
52 item->SetNew(clip_path, SkRegion::kIntersect_Op, anti_alias); | |
53 DCHECK_LT(num_closers_, arraysize(closers_)); | 51 DCHECK_LT(num_closers_, arraysize(closers_)); |
54 closers_[num_closers_++] = CLIP_PATH; | 52 closers_[num_closers_++] = CLIP_PATH; |
55 } | 53 } |
56 | 54 |
57 void ClipRecorder::ClipPathWithAntiAliasing( | 55 void ClipRecorder::ClipPathWithAntiAliasing( |
58 const gfx::Path& clip_path) { | 56 const gfx::Path& clip_path) { |
59 bool anti_alias = true; | 57 bool anti_alias = true; |
60 // As a further optimization, consider passing a more granular visual rect. | 58 // As a further optimization, consider passing a more granular visual rect. |
61 auto* item = context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>( | 59 context_.list_->CreateAndAppendItem<cc::ClipPathDisplayItem>( |
62 bounds_in_layer_); | 60 bounds_in_layer_, clip_path, SkRegion::kIntersect_Op, anti_alias); |
63 item->SetNew(clip_path, SkRegion::kIntersect_Op, anti_alias); | |
64 DCHECK_LT(num_closers_, arraysize(closers_)); | 61 DCHECK_LT(num_closers_, arraysize(closers_)); |
65 closers_[num_closers_++] = CLIP_PATH; | 62 closers_[num_closers_++] = CLIP_PATH; |
66 } | 63 } |
67 | 64 |
68 } // namespace ui | 65 } // namespace ui |
OLD | NEW |