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) { | |
enne (OOO)
2013/01/17 23:34:55
You should just call PicturePileBase::PushProperti
jamesr
2013/01/18 01:16:42
Ah, missed that there was a base class. Done
| |
103 other->pile_ = pile_; | |
104 other->clones_ = clones_; | |
105 other->min_contents_scale_ = min_contents_scale_; | |
106 } | |
107 | |
102 skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() { | 108 skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() { |
103 TRACE_EVENT0("cc", "PicturePileImpl::GetFlattenedPicture"); | 109 TRACE_EVENT0("cc", "PicturePileImpl::GetFlattenedPicture"); |
104 | 110 |
105 gfx::Rect layer_rect; | 111 gfx::Rect layer_rect; |
106 for (Pile::const_iterator i = pile_.begin(); i != pile_.end(); ++i) { | 112 for (Pile::const_iterator i = pile_.begin(); i != pile_.end(); ++i) { |
107 layer_rect.Union((*i)->LayerRect()); | 113 layer_rect.Union((*i)->LayerRect()); |
108 } | 114 } |
109 | 115 |
110 skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture); | 116 skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture); |
111 if (layer_rect.IsEmpty()) | 117 if (layer_rect.IsEmpty()) |
112 return picture; | 118 return picture; |
113 | 119 |
114 SkCanvas* canvas = picture->beginRecording( | 120 SkCanvas* canvas = picture->beginRecording( |
115 layer_rect.width(), | 121 layer_rect.width(), |
116 layer_rect.height(), | 122 layer_rect.height(), |
117 SkPicture::kUsePathBoundsForClip_RecordingFlag); | 123 SkPicture::kUsePathBoundsForClip_RecordingFlag); |
118 | 124 |
119 RenderingStats stats; | 125 RenderingStats stats; |
120 Raster(canvas, layer_rect, 1.0, &stats); | 126 Raster(canvas, layer_rect, 1.0, &stats); |
121 picture->endRecording(); | 127 picture->endRecording(); |
122 | 128 |
123 return picture; | 129 return picture; |
124 } | 130 } |
125 | 131 |
126 } // namespace cc | 132 } // namespace cc |
OLD | NEW |