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)))); | 38 skia::SharePtr(const_cast<SkPicture*>(picture)), gfx::PointF(0, 0))); |
| 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)); |
39 } | 46 } |
40 | 47 |
41 void WebDisplayItemListImpl::appendClipItem( | 48 void WebDisplayItemListImpl::appendClipItem( |
42 const blink::WebRect& clip_rect, | 49 const blink::WebRect& clip_rect, |
43 const blink::WebVector<SkRRect>& rounded_clip_rects) { | 50 const blink::WebVector<SkRRect>& rounded_clip_rects) { |
44 std::vector<SkRRect> rounded_rects; | 51 std::vector<SkRRect> rounded_rects; |
45 for (size_t i = 0; i < rounded_clip_rects.size(); ++i) { | 52 for (size_t i = 0; i < rounded_clip_rects.size(); ++i) { |
46 rounded_rects.push_back(rounded_clip_rects[i]); | 53 rounded_rects.push_back(rounded_clip_rects[i]); |
47 } | 54 } |
48 display_item_list_->AppendItem( | 55 display_item_list_->AppendItem( |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 94 } |
88 | 95 |
89 void WebDisplayItemListImpl::appendEndTransformItem() { | 96 void WebDisplayItemListImpl::appendEndTransformItem() { |
90 display_item_list_->AppendItem(cc::EndTransformDisplayItem::Create()); | 97 display_item_list_->AppendItem(cc::EndTransformDisplayItem::Create()); |
91 } | 98 } |
92 | 99 |
93 void WebDisplayItemListImpl::appendEndTransparencyItem() { | 100 void WebDisplayItemListImpl::appendEndTransparencyItem() { |
94 display_item_list_->AppendItem(cc::EndTransparencyDisplayItem::Create()); | 101 display_item_list_->AppendItem(cc::EndTransparencyDisplayItem::Create()); |
95 } | 102 } |
96 | 103 |
| 104 #if FILTER_DISPLAY_ITEM_USES_FILTER_OPERATIONS |
97 void WebDisplayItemListImpl::appendFilterItem( | 105 void WebDisplayItemListImpl::appendFilterItem( |
98 const blink::WebFilterOperations& filters, | 106 const blink::WebFilterOperations& filters, |
99 const blink::WebFloatRect& bounds) { | 107 const blink::WebFloatRect& bounds) { |
100 const WebFilterOperationsImpl& filters_impl = | 108 const WebFilterOperationsImpl& filters_impl = |
101 static_cast<const WebFilterOperationsImpl&>(filters); | 109 static_cast<const WebFilterOperationsImpl&>(filters); |
102 display_item_list_->AppendItem( | 110 display_item_list_->AppendItem( |
103 cc::FilterDisplayItem::Create(filters_impl.AsFilterOperations(), bounds)); | 111 cc::FilterDisplayItem::Create(filters_impl.AsFilterOperations(), bounds)); |
104 } | 112 } |
| 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 |
105 | 124 |
106 void WebDisplayItemListImpl::appendEndFilterItem() { | 125 void WebDisplayItemListImpl::appendEndFilterItem() { |
107 display_item_list_->AppendItem(cc::EndFilterDisplayItem::Create()); | 126 display_item_list_->AppendItem(cc::EndFilterDisplayItem::Create()); |
108 } | 127 } |
109 | 128 |
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 | |
122 WebDisplayItemListImpl::~WebDisplayItemListImpl() { | 129 WebDisplayItemListImpl::~WebDisplayItemListImpl() { |
123 } | 130 } |
124 | 131 |
125 } // namespace cc_blink | 132 } // namespace cc_blink |
OLD | NEW |