| 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/playback/display_list_raster_source.h" | 5 #include "cc/playback/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/playback/display_item_list.h" | 10 #include "cc/playback/display_item_list.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 return picture; | 210 return picture; |
| 211 } | 211 } |
| 212 | 212 |
| 213 size_t DisplayListRasterSource::GetPictureMemoryUsage() const { | 213 size_t DisplayListRasterSource::GetPictureMemoryUsage() const { |
| 214 if (!display_list_) | 214 if (!display_list_) |
| 215 return 0; | 215 return 0; |
| 216 return display_list_->ApproximateMemoryUsage() + | 216 return display_list_->ApproximateMemoryUsage() + |
| 217 painter_reported_memory_usage_; | 217 painter_reported_memory_usage_; |
| 218 } | 218 } |
| 219 | 219 |
| 220 void DisplayListRasterSource::PerformSolidColorAnalysis( | 220 bool DisplayListRasterSource::PerformSolidColorAnalysis( |
| 221 const gfx::Rect& content_rect, | 221 const gfx::Rect& content_rect, |
| 222 float contents_scale, | 222 float contents_scale, |
| 223 DisplayListRasterSource::SolidColorAnalysis* analysis) const { | 223 SkColor* color) const { |
| 224 DCHECK(analysis); | |
| 225 TRACE_EVENT0("cc", "DisplayListRasterSource::PerformSolidColorAnalysis"); | 224 TRACE_EVENT0("cc", "DisplayListRasterSource::PerformSolidColorAnalysis"); |
| 226 | 225 |
| 227 gfx::Rect layer_rect = | 226 gfx::Rect layer_rect = |
| 228 gfx::ScaleToEnclosingRect(content_rect, 1.0f / contents_scale); | 227 gfx::ScaleToEnclosingRect(content_rect, 1.0f / contents_scale); |
| 229 | 228 |
| 230 layer_rect.Intersect(gfx::Rect(size_)); | 229 layer_rect.Intersect(gfx::Rect(size_)); |
| 231 skia::AnalysisCanvas canvas(layer_rect.width(), layer_rect.height()); | 230 skia::AnalysisCanvas canvas(layer_rect.width(), layer_rect.height()); |
| 232 RasterForAnalysis(&canvas, layer_rect, 1.0f); | 231 RasterForAnalysis(&canvas, layer_rect, 1.0f); |
| 233 analysis->is_solid_color = canvas.GetColorIfSolid(&analysis->solid_color); | 232 return canvas.GetColorIfSolid(color); |
| 234 } | 233 } |
| 235 | 234 |
| 236 void DisplayListRasterSource::GetDiscardableImagesInRect( | 235 void DisplayListRasterSource::GetDiscardableImagesInRect( |
| 237 const gfx::Rect& layer_rect, | 236 const gfx::Rect& layer_rect, |
| 238 float raster_scale, | 237 float raster_scale, |
| 239 std::vector<DrawImage>* images) const { | 238 std::vector<DrawImage>* images) const { |
| 240 DCHECK_EQ(0u, images->size()); | 239 DCHECK_EQ(0u, images->size()); |
| 241 display_list_->GetDiscardableImagesInRect(layer_rect, raster_scale, images); | 240 display_list_->GetDiscardableImagesInRect(layer_rect, raster_scale, images); |
| 242 } | 241 } |
| 243 | 242 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 } | 293 } |
| 295 | 294 |
| 296 scoped_refptr<DisplayListRasterSource> | 295 scoped_refptr<DisplayListRasterSource> |
| 297 DisplayListRasterSource::CreateCloneWithoutLCDText() const { | 296 DisplayListRasterSource::CreateCloneWithoutLCDText() const { |
| 298 bool can_use_lcd_text = false; | 297 bool can_use_lcd_text = false; |
| 299 return scoped_refptr<DisplayListRasterSource>( | 298 return scoped_refptr<DisplayListRasterSource>( |
| 300 new DisplayListRasterSource(this, can_use_lcd_text)); | 299 new DisplayListRasterSource(this, can_use_lcd_text)); |
| 301 } | 300 } |
| 302 | 301 |
| 303 } // namespace cc | 302 } // namespace cc |
| OLD | NEW |