OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/layers/picture_image_layer.h" | 5 #include "cc/layers/picture_image_layer.h" |
6 | 6 |
7 #include "cc/layers/picture_image_layer_impl.h" | 7 #include "cc/layers/picture_image_layer_impl.h" |
| 8 #include "cc/resources/drawing_display_item.h" |
8 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 10 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| 11 #include "ui/gfx/skia_util.h" |
9 | 12 |
10 namespace cc { | 13 namespace cc { |
11 | 14 |
12 scoped_refptr<PictureImageLayer> PictureImageLayer::Create() { | 15 scoped_refptr<PictureImageLayer> PictureImageLayer::Create() { |
13 return make_scoped_refptr(new PictureImageLayer()); | 16 return make_scoped_refptr(new PictureImageLayer()); |
14 } | 17 } |
15 | 18 |
16 PictureImageLayer::PictureImageLayer() : PictureLayer(this) {} | 19 PictureImageLayer::PictureImageLayer() : PictureLayer(this) {} |
17 | 20 |
18 PictureImageLayer::~PictureImageLayer() { | 21 PictureImageLayer::~PictureImageLayer() { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 59 |
57 // Because Android WebView resourceless software draw mode rasters directly | 60 // Because Android WebView resourceless software draw mode rasters directly |
58 // to the root canvas, this draw must use the kSrcOver_Mode so that | 61 // to the root canvas, this draw must use the kSrcOver_Mode so that |
59 // transparent images blend correctly. | 62 // transparent images blend correctly. |
60 canvas->drawBitmap(bitmap_, 0, 0); | 63 canvas->drawBitmap(bitmap_, 0, 0); |
61 } | 64 } |
62 | 65 |
63 scoped_refptr<DisplayItemList> PictureImageLayer::PaintContentsToDisplayList( | 66 scoped_refptr<DisplayItemList> PictureImageLayer::PaintContentsToDisplayList( |
64 const gfx::Rect& clip, | 67 const gfx::Rect& clip, |
65 GraphicsContextStatus gc_status) { | 68 GraphicsContextStatus gc_status) { |
66 NOTIMPLEMENTED(); | 69 scoped_refptr<DisplayItemList> display_item_list = DisplayItemList::Create(); |
67 return DisplayItemList::Create(); | 70 |
| 71 SkPictureRecorder recorder; |
| 72 SkCanvas* canvas = recorder.beginRecording(gfx::RectToSkRect(clip)); |
| 73 PaintContents(canvas, clip, gc_status); |
| 74 |
| 75 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); |
| 76 display_item_list->AppendItem( |
| 77 DrawingDisplayItem::Create(picture, gfx::Point())); |
| 78 return display_item_list; |
68 } | 79 } |
69 | 80 |
70 bool PictureImageLayer::FillsBoundsCompletely() const { | 81 bool PictureImageLayer::FillsBoundsCompletely() const { |
71 return false; | 82 return false; |
72 } | 83 } |
73 | 84 |
74 } // namespace cc | 85 } // namespace cc |
OLD | NEW |