| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 const gfx::Rect& canvas_playback_rect, | 179 const gfx::Rect& canvas_playback_rect, |
| 180 float contents_scale) const { | 180 float contents_scale) const { |
| 181 canvas->translate(-canvas_bitmap_rect.x(), -canvas_bitmap_rect.y()); | 181 canvas->translate(-canvas_bitmap_rect.x(), -canvas_bitmap_rect.y()); |
| 182 gfx::Rect content_rect = | 182 gfx::Rect content_rect = |
| 183 gfx::ScaleToEnclosingRect(gfx::Rect(size_), contents_scale); | 183 gfx::ScaleToEnclosingRect(gfx::Rect(size_), contents_scale); |
| 184 content_rect.Intersect(canvas_playback_rect); | 184 content_rect.Intersect(canvas_playback_rect); |
| 185 | 185 |
| 186 canvas->clipRect(gfx::RectToSkRect(content_rect), SkRegion::kIntersect_Op); | 186 canvas->clipRect(gfx::RectToSkRect(content_rect), SkRegion::kIntersect_Op); |
| 187 | 187 |
| 188 DCHECK(display_list_.get()); | 188 DCHECK(display_list_.get()); |
| 189 gfx::Rect canvas_target_playback_rect = | |
| 190 canvas_playback_rect - canvas_bitmap_rect.OffsetFromOrigin(); | |
| 191 int repeat_count = std::max(1, slow_down_raster_scale_factor_for_debug_); | 189 int repeat_count = std::max(1, slow_down_raster_scale_factor_for_debug_); |
| 192 for (int i = 0; i < repeat_count; ++i) { | 190 for (int i = 0; i < repeat_count; ++i) { |
| 193 display_list_->Raster(canvas, callback, canvas_target_playback_rect, | 191 display_list_->Raster(canvas, callback, canvas_playback_rect, |
| 194 contents_scale); | 192 contents_scale); |
| 195 } | 193 } |
| 196 } | 194 } |
| 197 | 195 |
| 198 skia::RefPtr<SkPicture> DisplayListRasterSource::GetFlattenedPicture() { | 196 skia::RefPtr<SkPicture> DisplayListRasterSource::GetFlattenedPicture() { |
| 199 TRACE_EVENT0("cc", "DisplayListRasterSource::GetFlattenedPicture"); | 197 TRACE_EVENT0("cc", "DisplayListRasterSource::GetFlattenedPicture"); |
| 200 | 198 |
| 201 gfx::Rect display_list_rect(size_); | 199 gfx::Rect display_list_rect(size_); |
| 202 SkPictureRecorder recorder; | 200 SkPictureRecorder recorder; |
| 203 SkCanvas* canvas = recorder.beginRecording(display_list_rect.width(), | 201 SkCanvas* canvas = recorder.beginRecording(display_list_rect.width(), |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 } | 292 } |
| 295 | 293 |
| 296 scoped_refptr<DisplayListRasterSource> | 294 scoped_refptr<DisplayListRasterSource> |
| 297 DisplayListRasterSource::CreateCloneWithoutLCDText() const { | 295 DisplayListRasterSource::CreateCloneWithoutLCDText() const { |
| 298 bool can_use_lcd_text = false; | 296 bool can_use_lcd_text = false; |
| 299 return scoped_refptr<DisplayListRasterSource>( | 297 return scoped_refptr<DisplayListRasterSource>( |
| 300 new DisplayListRasterSource(this, can_use_lcd_text)); | 298 new DisplayListRasterSource(this, can_use_lcd_text)); |
| 301 } | 299 } |
| 302 | 300 |
| 303 } // namespace cc | 301 } // namespace cc |
| OLD | NEW |