OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/resources/display_list_raster_source.h" | 5 #include "cc/resources/display_list_raster_source.h" |
6 | 6 |
7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
8 #include "cc/base/region.h" | 8 #include "cc/base/region.h" |
9 #include "cc/debug/debug_colors.h" | 9 #include "cc/debug/debug_colors.h" |
10 #include "cc/resources/display_item_list.h" | 10 #include "cc/resources/display_item_list.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 layer_rect.Intersect(gfx::Rect(size_)); | 152 layer_rect.Intersect(gfx::Rect(size_)); |
153 skia::AnalysisCanvas canvas(layer_rect.width(), layer_rect.height()); | 153 skia::AnalysisCanvas canvas(layer_rect.width(), layer_rect.height()); |
154 RasterForAnalysis(&canvas, layer_rect, 1.0f); | 154 RasterForAnalysis(&canvas, layer_rect, 1.0f); |
155 analysis->is_solid_color = canvas.GetColorIfSolid(&analysis->solid_color); | 155 analysis->is_solid_color = canvas.GetColorIfSolid(&analysis->solid_color); |
156 } | 156 } |
157 | 157 |
158 void DisplayListRasterSource::GatherPixelRefs( | 158 void DisplayListRasterSource::GatherPixelRefs( |
159 const gfx::Rect& content_rect, | 159 const gfx::Rect& content_rect, |
160 float contents_scale, | 160 float contents_scale, |
161 std::vector<SkPixelRef*>* pixel_refs) const { | 161 std::vector<SkPixelRef*>* pixel_refs) const { |
162 // TODO(ajuma): Implement this. | 162 DCHECK_EQ(0u, pixel_refs->size()); |
| 163 |
| 164 gfx::Rect layer_rect = |
| 165 gfx::ScaleToEnclosingRect(content_rect, 1.0f / contents_scale); |
| 166 |
| 167 PixelRefMap::Iterator iterator(layer_rect, display_list_.get()); |
| 168 while (iterator) { |
| 169 pixel_refs->push_back(*iterator); |
| 170 ++iterator; |
| 171 } |
163 } | 172 } |
164 | 173 |
165 bool DisplayListRasterSource::CoversRect(const gfx::Rect& content_rect, | 174 bool DisplayListRasterSource::CoversRect(const gfx::Rect& content_rect, |
166 float contents_scale) const { | 175 float contents_scale) const { |
167 if (size_.IsEmpty()) | 176 if (size_.IsEmpty()) |
168 return false; | 177 return false; |
169 gfx::Rect layer_rect = | 178 gfx::Rect layer_rect = |
170 gfx::ScaleToEnclosingRect(content_rect, 1.f / contents_scale); | 179 gfx::ScaleToEnclosingRect(content_rect, 1.f / contents_scale); |
171 layer_rect.Intersect(gfx::Rect(size_)); | 180 layer_rect.Intersect(gfx::Rect(size_)); |
172 | 181 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 } | 223 } |
215 | 224 |
216 scoped_refptr<RasterSource> DisplayListRasterSource::CreateCloneWithoutLCDText() | 225 scoped_refptr<RasterSource> DisplayListRasterSource::CreateCloneWithoutLCDText() |
217 const { | 226 const { |
218 bool can_use_lcd_text = false; | 227 bool can_use_lcd_text = false; |
219 return scoped_refptr<RasterSource>( | 228 return scoped_refptr<RasterSource>( |
220 new DisplayListRasterSource(this, can_use_lcd_text)); | 229 new DisplayListRasterSource(this, can_use_lcd_text)); |
221 } | 230 } |
222 | 231 |
223 } // namespace cc | 232 } // namespace cc |
OLD | NEW |