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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 gfx::Rect layer_rect = | 155 gfx::Rect layer_rect = |
156 gfx::ScaleToEnclosingRect(content_rect, 1.0f / contents_scale); | 156 gfx::ScaleToEnclosingRect(content_rect, 1.0f / contents_scale); |
157 | 157 |
158 layer_rect.Intersect(gfx::Rect(size_)); | 158 layer_rect.Intersect(gfx::Rect(size_)); |
159 skia::AnalysisCanvas canvas(layer_rect.width(), layer_rect.height()); | 159 skia::AnalysisCanvas canvas(layer_rect.width(), layer_rect.height()); |
160 RasterForAnalysis(&canvas, layer_rect, 1.0f); | 160 RasterForAnalysis(&canvas, layer_rect, 1.0f); |
161 analysis->is_solid_color = canvas.GetColorIfSolid(&analysis->solid_color); | 161 analysis->is_solid_color = canvas.GetColorIfSolid(&analysis->solid_color); |
162 } | 162 } |
163 | 163 |
164 void DisplayListRasterSource::GatherPixelRefs( | 164 void DisplayListRasterSource::GatherPixelRefs( |
165 const gfx::Rect& content_rect, | 165 const gfx::Rect& layer_rect, |
166 float contents_scale, | |
167 std::vector<skia::PositionPixelRef>* pixel_refs) const { | 166 std::vector<skia::PositionPixelRef>* pixel_refs) const { |
168 DCHECK_EQ(0u, pixel_refs->size()); | 167 DCHECK_EQ(0u, pixel_refs->size()); |
169 | 168 |
170 gfx::Rect layer_rect = | |
171 gfx::ScaleToEnclosingRect(content_rect, 1.0f / contents_scale); | |
172 | |
173 PixelRefMap::Iterator iterator(layer_rect, display_list_.get()); | 169 PixelRefMap::Iterator iterator(layer_rect, display_list_.get()); |
174 while (iterator) { | 170 while (iterator) { |
175 pixel_refs->push_back(*iterator); | 171 pixel_refs->push_back(*iterator); |
176 ++iterator; | 172 ++iterator; |
177 } | 173 } |
178 } | 174 } |
179 | 175 |
180 bool DisplayListRasterSource::CoversRect(const gfx::Rect& content_rect, | 176 bool DisplayListRasterSource::CoversRect(const gfx::Rect& layer_rect) const { |
181 float contents_scale) const { | |
182 if (size_.IsEmpty()) | 177 if (size_.IsEmpty()) |
183 return false; | 178 return false; |
184 gfx::Rect layer_rect = | 179 gfx::Rect bounded_rect = layer_rect; |
185 gfx::ScaleToEnclosingRect(content_rect, 1.f / contents_scale); | 180 bounded_rect.Intersect(gfx::Rect(size_)); |
186 layer_rect.Intersect(gfx::Rect(size_)); | 181 return recorded_viewport_.Contains(bounded_rect); |
187 | |
188 return recorded_viewport_.Contains(layer_rect); | |
189 } | 182 } |
190 | 183 |
191 gfx::Size DisplayListRasterSource::GetSize() const { | 184 gfx::Size DisplayListRasterSource::GetSize() const { |
192 return size_; | 185 return size_; |
193 } | 186 } |
194 | 187 |
195 bool DisplayListRasterSource::IsSolidColor() const { | 188 bool DisplayListRasterSource::IsSolidColor() const { |
196 return is_solid_color_; | 189 return is_solid_color_; |
197 } | 190 } |
198 | 191 |
(...skipping 30 matching lines...) Expand all Loading... |
229 } | 222 } |
230 | 223 |
231 scoped_refptr<RasterSource> DisplayListRasterSource::CreateCloneWithoutLCDText() | 224 scoped_refptr<RasterSource> DisplayListRasterSource::CreateCloneWithoutLCDText() |
232 const { | 225 const { |
233 bool can_use_lcd_text = false; | 226 bool can_use_lcd_text = false; |
234 return scoped_refptr<RasterSource>( | 227 return scoped_refptr<RasterSource>( |
235 new DisplayListRasterSource(this, can_use_lcd_text)); | 228 new DisplayListRasterSource(this, can_use_lcd_text)); |
236 } | 229 } |
237 | 230 |
238 } // namespace cc | 231 } // namespace cc |
OLD | NEW |