| 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 DCHECK_EQ(0u, pixel_refs->size()); | 162 // TODO(ajuma): Implement this. |
| 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 } | |
| 172 } | 163 } |
| 173 | 164 |
| 174 bool DisplayListRasterSource::CoversRect(const gfx::Rect& content_rect, | 165 bool DisplayListRasterSource::CoversRect(const gfx::Rect& content_rect, |
| 175 float contents_scale) const { | 166 float contents_scale) const { |
| 176 if (size_.IsEmpty()) | 167 if (size_.IsEmpty()) |
| 177 return false; | 168 return false; |
| 178 gfx::Rect layer_rect = | 169 gfx::Rect layer_rect = |
| 179 gfx::ScaleToEnclosingRect(content_rect, 1.f / contents_scale); | 170 gfx::ScaleToEnclosingRect(content_rect, 1.f / contents_scale); |
| 180 layer_rect.Intersect(gfx::Rect(size_)); | 171 layer_rect.Intersect(gfx::Rect(size_)); |
| 181 | 172 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 } | 214 } |
| 224 | 215 |
| 225 scoped_refptr<RasterSource> DisplayListRasterSource::CreateCloneWithoutLCDText() | 216 scoped_refptr<RasterSource> DisplayListRasterSource::CreateCloneWithoutLCDText() |
| 226 const { | 217 const { |
| 227 bool can_use_lcd_text = false; | 218 bool can_use_lcd_text = false; |
| 228 return scoped_refptr<RasterSource>( | 219 return scoped_refptr<RasterSource>( |
| 229 new DisplayListRasterSource(this, can_use_lcd_text)); | 220 new DisplayListRasterSource(this, can_use_lcd_text)); |
| 230 } | 221 } |
| 231 | 222 |
| 232 } // namespace cc | 223 } // namespace cc |
| OLD | NEW |