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