OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cc/blink/web_display_item_list_impl.h" |
| 6 |
| 7 #include <vector> |
| 8 |
| 9 #include "cc/blink/web_blend_mode.h" |
| 10 #include "cc/resources/clip_display_item.h" |
| 11 #include "cc/resources/drawing_display_item.h" |
| 12 #include "cc/resources/filter_display_item.h" |
| 13 #include "cc/resources/transform_display_item.h" |
| 14 #include "cc/resources/transparency_display_item.h" |
| 15 #include "skia/ext/refptr.h" |
| 16 #include "third_party/WebKit/public/platform/WebFloatRect.h" |
| 17 #include "third_party/WebKit/public/platform/WebRect.h" |
| 18 #include "third_party/skia/include/core/SkImageFilter.h" |
| 19 #include "third_party/skia/include/core/SkPicture.h" |
| 20 #include "third_party/skia/include/utils/SkMatrix44.h" |
| 21 #include "ui/gfx/transform.h" |
| 22 |
| 23 namespace cc_blink { |
| 24 |
| 25 WebDisplayItemListImpl::WebDisplayItemListImpl() |
| 26 : display_item_list_(cc::DisplayItemList::Create()) { |
| 27 } |
| 28 |
| 29 scoped_refptr<cc::DisplayItemList> WebDisplayItemListImpl::ToDisplayItemList() { |
| 30 return display_item_list_; |
| 31 } |
| 32 |
| 33 void WebDisplayItemListImpl::appendDrawingItem( |
| 34 SkPicture* picture, |
| 35 const blink::WebFloatPoint& location) { |
| 36 display_item_list_->AppendItem( |
| 37 cc::DrawingDisplayItem::Create(skia::SharePtr(picture), location)); |
| 38 } |
| 39 |
| 40 void WebDisplayItemListImpl::appendClipItem( |
| 41 const blink::WebRect& clip_rect, |
| 42 const blink::WebVector<SkRRect>& rounded_clip_rects) { |
| 43 std::vector<SkRRect> rounded_rects; |
| 44 for (size_t i = 0; i < rounded_clip_rects.size(); ++i) { |
| 45 rounded_rects.push_back(rounded_clip_rects[i]); |
| 46 } |
| 47 display_item_list_->AppendItem( |
| 48 cc::ClipDisplayItem::Create(clip_rect, rounded_rects)); |
| 49 } |
| 50 |
| 51 void WebDisplayItemListImpl::appendEndClipItem() { |
| 52 display_item_list_->AppendItem(cc::EndClipDisplayItem::Create()); |
| 53 } |
| 54 |
| 55 void WebDisplayItemListImpl::appendTransformItem(const SkMatrix44& matrix) { |
| 56 gfx::Transform transform; |
| 57 transform.matrix() = matrix; |
| 58 display_item_list_->AppendItem(cc::TransformDisplayItem::Create(transform)); |
| 59 } |
| 60 |
| 61 void WebDisplayItemListImpl::appendTransparencyItem( |
| 62 float opacity, |
| 63 blink::WebBlendMode blend_mode) { |
| 64 display_item_list_->AppendItem(cc::TransparencyDisplayItem::Create( |
| 65 opacity, BlendModeToSkia(blend_mode))); |
| 66 } |
| 67 |
| 68 void WebDisplayItemListImpl::appendEndTransformItem() { |
| 69 display_item_list_->AppendItem(cc::EndTransformDisplayItem::Create()); |
| 70 } |
| 71 |
| 72 void WebDisplayItemListImpl::appendEndTransparencyItem() { |
| 73 display_item_list_->AppendItem(cc::EndTransparencyDisplayItem::Create()); |
| 74 } |
| 75 |
| 76 void WebDisplayItemListImpl::appendFilterItem( |
| 77 SkImageFilter* filter, |
| 78 const blink::WebFloatRect& bounds) { |
| 79 display_item_list_->AppendItem( |
| 80 cc::FilterDisplayItem::Create(skia::SharePtr(filter), bounds)); |
| 81 } |
| 82 |
| 83 void WebDisplayItemListImpl::appendEndFilterItem() { |
| 84 display_item_list_->AppendItem(cc::EndFilterDisplayItem::Create()); |
| 85 } |
| 86 |
| 87 WebDisplayItemListImpl::~WebDisplayItemListImpl() { |
| 88 } |
| 89 |
| 90 } // namespace cc_blink |
OLD | NEW |