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/paint_recorder.h" | 5 #include "ui/compositor/paint_recorder.h" |
6 | 6 |
7 #include "cc/resources/display_item_list.h" | 7 #include "cc/resources/display_item_list.h" |
8 #include "cc/resources/drawing_display_item.h" | 8 #include "cc/resources/drawing_display_item.h" |
9 #include "third_party/skia/include/core/SkPictureRecorder.h" | 9 #include "third_party/skia/include/core/SkPictureRecorder.h" |
10 #include "ui/compositor/paint_cache.h" | 10 #include "ui/compositor/paint_cache.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 | 41 |
42 PaintRecorder::~PaintRecorder() { | 42 PaintRecorder::~PaintRecorder() { |
43 #if DCHECK_IS_ON() | 43 #if DCHECK_IS_ON() |
44 context_.inside_paint_recorder_ = false; | 44 context_.inside_paint_recorder_ = false; |
45 #endif | 45 #endif |
46 | 46 |
47 if (!context_.list_) | 47 if (!context_.list_) |
48 return; | 48 return; |
49 | 49 |
50 scoped_ptr<cc::DrawingDisplayItem> item = cc::DrawingDisplayItem::Create( | 50 auto* item = context_.list_->CreateAndAppendItem<cc::DrawingDisplayItem>(); |
51 skia::AdoptRef(context_.recorder_->endRecordingAsPicture())); | 51 item->SetNew(skia::AdoptRef(context_.recorder_->endRecordingAsPicture())); |
52 if (cache_) | 52 if (cache_) |
53 cache_->SetCache(item->Clone()); | 53 cache_->SetCache(item); |
54 context_.list_->AppendItem(item.Pass()); | |
55 } | 54 } |
56 | 55 |
57 } // namespace ui | 56 } // namespace ui |
OLD | NEW |