| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 const gfx::Rect& canvas_playback_rect, | 107 const gfx::Rect& canvas_playback_rect, |
| 108 float contents_scale) const { | 108 float contents_scale) const { |
| 109 canvas->translate(-canvas_bitmap_rect.x(), -canvas_bitmap_rect.y()); | 109 canvas->translate(-canvas_bitmap_rect.x(), -canvas_bitmap_rect.y()); |
| 110 gfx::Rect content_rect = | 110 gfx::Rect content_rect = |
| 111 gfx::ToEnclosingRect(gfx::ScaleRect(gfx::Rect(size_), contents_scale)); | 111 gfx::ToEnclosingRect(gfx::ScaleRect(gfx::Rect(size_), contents_scale)); |
| 112 content_rect.Intersect(canvas_playback_rect); | 112 content_rect.Intersect(canvas_playback_rect); |
| 113 | 113 |
| 114 canvas->clipRect(gfx::RectToSkRect(content_rect), SkRegion::kIntersect_Op); | 114 canvas->clipRect(gfx::RectToSkRect(content_rect), SkRegion::kIntersect_Op); |
| 115 | 115 |
| 116 DCHECK(display_list_.get()); | 116 DCHECK(display_list_.get()); |
| 117 display_list_->Raster(canvas, callback, contents_scale); | 117 gfx::Rect canvas_target_playback_rect = |
| 118 canvas_playback_rect - canvas_bitmap_rect.OffsetFromOrigin(); |
| 119 display_list_->Raster(canvas, callback, canvas_target_playback_rect, |
| 120 contents_scale); |
| 118 } | 121 } |
| 119 | 122 |
| 120 skia::RefPtr<SkPicture> DisplayListRasterSource::GetFlattenedPicture() { | 123 skia::RefPtr<SkPicture> DisplayListRasterSource::GetFlattenedPicture() { |
| 121 TRACE_EVENT0("cc", "DisplayListRasterSource::GetFlattenedPicture"); | 124 TRACE_EVENT0("cc", "DisplayListRasterSource::GetFlattenedPicture"); |
| 122 | 125 |
| 123 gfx::Rect display_list_rect(size_); | 126 gfx::Rect display_list_rect(size_); |
| 124 SkPictureRecorder recorder; | 127 SkPictureRecorder recorder; |
| 125 SkCanvas* canvas = recorder.beginRecording(display_list_rect.width(), | 128 SkCanvas* canvas = recorder.beginRecording(display_list_rect.width(), |
| 126 display_list_rect.height()); | 129 display_list_rect.height()); |
| 127 if (!display_list_rect.IsEmpty()) | 130 if (!display_list_rect.IsEmpty()) |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 } | 225 } |
| 223 | 226 |
| 224 scoped_refptr<RasterSource> DisplayListRasterSource::CreateCloneWithoutLCDText() | 227 scoped_refptr<RasterSource> DisplayListRasterSource::CreateCloneWithoutLCDText() |
| 225 const { | 228 const { |
| 226 bool can_use_lcd_text = false; | 229 bool can_use_lcd_text = false; |
| 227 return scoped_refptr<RasterSource>( | 230 return scoped_refptr<RasterSource>( |
| 228 new DisplayListRasterSource(this, can_use_lcd_text)); | 231 new DisplayListRasterSource(this, can_use_lcd_text)); |
| 229 } | 232 } |
| 230 | 233 |
| 231 } // namespace cc | 234 } // namespace cc |
| OLD | NEW |