| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "base/debug/trace_event.h" | 5 #include "base/debug/trace_event.h" |
| 6 #include "cc/picture_pile_impl.h" | 6 #include "cc/picture_pile_impl.h" |
| 7 #include "cc/region.h" | 7 #include "cc/region.h" |
| 8 #include "cc/rendering_stats.h" | 8 #include "cc/rendering_stats.h" |
| 9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 10 #include "third_party/skia/include/core/SkSize.h" | 10 #include "third_party/skia/include/core/SkSize.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 void PicturePileImpl::GatherPixelRefs( | 93 void PicturePileImpl::GatherPixelRefs( |
| 94 const gfx::Rect& rect, std::list<skia::LazyPixelRef*>& pixel_refs) { | 94 const gfx::Rect& rect, std::list<skia::LazyPixelRef*>& pixel_refs) { |
| 95 std::list<skia::LazyPixelRef*> result; | 95 std::list<skia::LazyPixelRef*> result; |
| 96 for (Pile::const_iterator i = pile_.begin(); i != pile_.end(); ++i) { | 96 for (Pile::const_iterator i = pile_.begin(); i != pile_.end(); ++i) { |
| 97 (*i)->GatherPixelRefs(rect, result); | 97 (*i)->GatherPixelRefs(rect, result); |
| 98 pixel_refs.splice(pixel_refs.end(), result); | 98 pixel_refs.splice(pixel_refs.end(), result); |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 | 101 |
| 102 void PicturePileImpl::PushPropertiesTo(PicturePileImpl* other) { |
| 103 PicturePileBase::PushPropertiesTo(other); |
| 104 other->clones_ = clones_; |
| 105 } |
| 106 |
| 102 skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() { | 107 skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() { |
| 103 TRACE_EVENT0("cc", "PicturePileImpl::GetFlattenedPicture"); | 108 TRACE_EVENT0("cc", "PicturePileImpl::GetFlattenedPicture"); |
| 104 | 109 |
| 105 gfx::Rect layer_rect; | 110 gfx::Rect layer_rect; |
| 106 for (Pile::const_iterator i = pile_.begin(); i != pile_.end(); ++i) { | 111 for (Pile::const_iterator i = pile_.begin(); i != pile_.end(); ++i) { |
| 107 layer_rect.Union((*i)->LayerRect()); | 112 layer_rect.Union((*i)->LayerRect()); |
| 108 } | 113 } |
| 109 | 114 |
| 110 skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture); | 115 skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture); |
| 111 if (layer_rect.IsEmpty()) | 116 if (layer_rect.IsEmpty()) |
| 112 return picture; | 117 return picture; |
| 113 | 118 |
| 114 SkCanvas* canvas = picture->beginRecording( | 119 SkCanvas* canvas = picture->beginRecording( |
| 115 layer_rect.width(), | 120 layer_rect.width(), |
| 116 layer_rect.height(), | 121 layer_rect.height(), |
| 117 SkPicture::kUsePathBoundsForClip_RecordingFlag); | 122 SkPicture::kUsePathBoundsForClip_RecordingFlag); |
| 118 | 123 |
| 119 RenderingStats stats; | 124 RenderingStats stats; |
| 120 Raster(canvas, layer_rect, 1.0, &stats); | 125 Raster(canvas, layer_rect, 1.0, &stats); |
| 121 picture->endRecording(); | 126 picture->endRecording(); |
| 122 | 127 |
| 123 return picture; | 128 return picture; |
| 124 } | 129 } |
| 125 | 130 |
| 126 } // namespace cc | 131 } // namespace cc |
| OLD | NEW |