OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "cc/blink/web_display_item_list_impl.h" | 5 #include "cc/blink/web_display_item_list_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "cc/blink/web_blend_mode.h" | 9 #include "cc/blink/web_blend_mode.h" |
10 #include "cc/blink/web_filter_operations_impl.h" | 10 #include "cc/blink/web_filter_operations_impl.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 WebDisplayItemListImpl::WebDisplayItemListImpl() | 28 WebDisplayItemListImpl::WebDisplayItemListImpl() |
29 : display_item_list_(cc::DisplayItemList::Create()) { | 29 : display_item_list_(cc::DisplayItemList::Create()) { |
30 } | 30 } |
31 | 31 |
32 scoped_refptr<cc::DisplayItemList> WebDisplayItemListImpl::ToDisplayItemList() { | 32 scoped_refptr<cc::DisplayItemList> WebDisplayItemListImpl::ToDisplayItemList() { |
33 return display_item_list_; | 33 return display_item_list_; |
34 } | 34 } |
35 | 35 |
36 void WebDisplayItemListImpl::appendDrawingItem(const SkPicture* picture) { | 36 void WebDisplayItemListImpl::appendDrawingItem(const SkPicture* picture) { |
37 display_item_list_->AppendItem(cc::DrawingDisplayItem::Create( | 37 display_item_list_->AppendItem(cc::DrawingDisplayItem::Create( |
38 skia::SharePtr(const_cast<SkPicture*>(picture)), gfx::PointF(0, 0))); | 38 skia::SharePtr(const_cast<SkPicture*>(picture)))); |
39 } | |
40 | |
41 void WebDisplayItemListImpl::appendDrawingItem( | |
42 SkPicture* picture, | |
43 const blink::WebFloatPoint& location) { | |
44 display_item_list_->AppendItem( | |
45 cc::DrawingDisplayItem::Create(skia::SharePtr(picture), location)); | |
46 } | 39 } |
47 | 40 |
48 void WebDisplayItemListImpl::appendClipItem( | 41 void WebDisplayItemListImpl::appendClipItem( |
49 const blink::WebRect& clip_rect, | 42 const blink::WebRect& clip_rect, |
50 const blink::WebVector<SkRRect>& rounded_clip_rects) { | 43 const blink::WebVector<SkRRect>& rounded_clip_rects) { |
51 std::vector<SkRRect> rounded_rects; | 44 std::vector<SkRRect> rounded_rects; |
52 for (size_t i = 0; i < rounded_clip_rects.size(); ++i) { | 45 for (size_t i = 0; i < rounded_clip_rects.size(); ++i) { |
53 rounded_rects.push_back(rounded_clip_rects[i]); | 46 rounded_rects.push_back(rounded_clip_rects[i]); |
54 } | 47 } |
55 display_item_list_->AppendItem( | 48 display_item_list_->AppendItem( |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 87 } |
95 | 88 |
96 void WebDisplayItemListImpl::appendEndTransformItem() { | 89 void WebDisplayItemListImpl::appendEndTransformItem() { |
97 display_item_list_->AppendItem(cc::EndTransformDisplayItem::Create()); | 90 display_item_list_->AppendItem(cc::EndTransformDisplayItem::Create()); |
98 } | 91 } |
99 | 92 |
100 void WebDisplayItemListImpl::appendEndTransparencyItem() { | 93 void WebDisplayItemListImpl::appendEndTransparencyItem() { |
101 display_item_list_->AppendItem(cc::EndTransparencyDisplayItem::Create()); | 94 display_item_list_->AppendItem(cc::EndTransparencyDisplayItem::Create()); |
102 } | 95 } |
103 | 96 |
104 #if FILTER_DISPLAY_ITEM_USES_FILTER_OPERATIONS | |
105 void WebDisplayItemListImpl::appendFilterItem( | 97 void WebDisplayItemListImpl::appendFilterItem( |
106 const blink::WebFilterOperations& filters, | 98 const blink::WebFilterOperations& filters, |
107 const blink::WebFloatRect& bounds) { | 99 const blink::WebFloatRect& bounds) { |
108 const WebFilterOperationsImpl& filters_impl = | 100 const WebFilterOperationsImpl& filters_impl = |
109 static_cast<const WebFilterOperationsImpl&>(filters); | 101 static_cast<const WebFilterOperationsImpl&>(filters); |
110 display_item_list_->AppendItem( | 102 display_item_list_->AppendItem( |
111 cc::FilterDisplayItem::Create(filters_impl.AsFilterOperations(), bounds)); | 103 cc::FilterDisplayItem::Create(filters_impl.AsFilterOperations(), bounds)); |
112 } | 104 } |
113 #else | |
114 void WebDisplayItemListImpl::appendFilterItem( | |
115 SkImageFilter* filter, | |
116 const blink::WebFloatRect& bounds) { | |
117 cc::FilterOperations filter_operations; | |
118 filter_operations.Append( | |
119 cc::FilterOperation::CreateReferenceFilter(skia::SharePtr(filter))); | |
120 display_item_list_->AppendItem( | |
121 cc::FilterDisplayItem::Create(filter_operations, bounds)); | |
122 } | |
123 #endif | |
124 | 105 |
125 void WebDisplayItemListImpl::appendEndFilterItem() { | 106 void WebDisplayItemListImpl::appendEndFilterItem() { |
126 display_item_list_->AppendItem(cc::EndFilterDisplayItem::Create()); | 107 display_item_list_->AppendItem(cc::EndFilterDisplayItem::Create()); |
127 } | 108 } |
128 | 109 |
| 110 void WebDisplayItemListImpl::appendScrollItem( |
| 111 const blink::WebSize& scrollOffset, |
| 112 ScrollContainerId) { |
| 113 SkMatrix44 matrix; |
| 114 matrix.setTranslate(-scrollOffset.width, -scrollOffset.height, 0); |
| 115 appendTransformItem(matrix); |
| 116 } |
| 117 |
| 118 void WebDisplayItemListImpl::appendEndScrollItem() { |
| 119 appendEndTransformItem(); |
| 120 } |
| 121 |
129 WebDisplayItemListImpl::~WebDisplayItemListImpl() { | 122 WebDisplayItemListImpl::~WebDisplayItemListImpl() { |
130 } | 123 } |
131 | 124 |
132 } // namespace cc_blink | 125 } // namespace cc_blink |
OLD | NEW |