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/debug/rendering_stats.h" | 6 #include "cc/debug/rendering_stats.h" |
7 #include "cc/layers/content_layer_client.h" | 7 #include "cc/layers/content_layer_client.h" |
8 #include "cc/resources/picture.h" | 8 #include "cc/resources/picture.h" |
9 #include "skia/ext/analysis_canvas.h" | 9 #include "skia/ext/analysis_canvas.h" |
10 #include "third_party/skia/include/core/SkCanvas.h" | 10 #include "third_party/skia/include/core/SkCanvas.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 void Picture::Record(ContentLayerClient* painter, | 81 void Picture::Record(ContentLayerClient* painter, |
82 RenderingStats* stats, | 82 RenderingStats* stats, |
83 const SkTileGridPicture::TileGridInfo& tile_grid_info) { | 83 const SkTileGridPicture::TileGridInfo& tile_grid_info) { |
84 TRACE_EVENT2("cc", "Picture::Record", | 84 TRACE_EVENT2("cc", "Picture::Record", |
85 "width", layer_rect_.width(), "height", layer_rect_.height()); | 85 "width", layer_rect_.width(), "height", layer_rect_.height()); |
86 | 86 |
87 // Record() should only be called once. | 87 // Record() should only be called once. |
88 DCHECK(!picture_); | 88 DCHECK(!picture_); |
89 DCHECK(!tile_grid_info.fTileInterval.isEmpty()); | 89 DCHECK(!tile_grid_info.fTileInterval.isEmpty()); |
90 // TODO(enne): Turn back on tile grid after | 90 picture_ = skia::AdoptRef(new SkTileGridPicture( |
91 // https://code.google.com/p/skia/issues/detail?id=1209 is fixed. | 91 layer_rect_.width(), layer_rect_.height(), tile_grid_info)); |
92 picture_ = skia::AdoptRef(new SkPicture()); | |
93 | 92 |
94 SkCanvas* canvas = picture_->beginRecording( | 93 SkCanvas* canvas = picture_->beginRecording( |
95 layer_rect_.width(), | 94 layer_rect_.width(), |
96 layer_rect_.height(), | 95 layer_rect_.height(), |
97 SkPicture::kUsePathBoundsForClip_RecordingFlag | | 96 SkPicture::kUsePathBoundsForClip_RecordingFlag | |
98 SkPicture::kOptimizeForClippedPlayback_RecordingFlag); | 97 SkPicture::kOptimizeForClippedPlayback_RecordingFlag); |
99 | 98 |
100 canvas->save(); | 99 canvas->save(); |
101 canvas->translate(SkFloatToScalar(-layer_rect_.x()), | 100 canvas->translate(SkFloatToScalar(-layer_rect_.x()), |
102 SkFloatToScalar(-layer_rect_.y())); | 101 SkFloatToScalar(-layer_rect_.y())); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 if (*refs && (*refs)->getURI() && !strncmp( | 172 if (*refs && (*refs)->getURI() && !strncmp( |
174 (*refs)->getURI(), kLabelLazyDecoded, 4)) { | 173 (*refs)->getURI(), kLabelLazyDecoded, 4)) { |
175 pixel_ref_list.push_back(static_cast<skia::LazyPixelRef*>(*refs)); | 174 pixel_ref_list.push_back(static_cast<skia::LazyPixelRef*>(*refs)); |
176 } | 175 } |
177 refs++; | 176 refs++; |
178 } | 177 } |
179 pixel_refs->unref(); | 178 pixel_refs->unref(); |
180 } | 179 } |
181 | 180 |
182 } // namespace cc | 181 } // namespace cc |
OLD | NEW |