| 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/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 const gfx::Rect& canvas_playback_rect, | 244 const gfx::Rect& canvas_playback_rect, |
| 245 float contents_scale) const { | 245 float contents_scale) const { |
| 246 canvas->translate(-canvas_bitmap_rect.x(), -canvas_bitmap_rect.y()); | 246 canvas->translate(-canvas_bitmap_rect.x(), -canvas_bitmap_rect.y()); |
| 247 gfx::Rect content_rect = | 247 gfx::Rect content_rect = |
| 248 gfx::ScaleToEnclosingRect(gfx::Rect(size_), contents_scale); | 248 gfx::ScaleToEnclosingRect(gfx::Rect(size_), contents_scale); |
| 249 content_rect.Intersect(canvas_playback_rect); | 249 content_rect.Intersect(canvas_playback_rect); |
| 250 | 250 |
| 251 canvas->clipRect(gfx::RectToSkRect(content_rect), SkRegion::kIntersect_Op); | 251 canvas->clipRect(gfx::RectToSkRect(content_rect), SkRegion::kIntersect_Op); |
| 252 | 252 |
| 253 DCHECK(display_list_.get()); | 253 DCHECK(display_list_.get()); |
| 254 gfx::Rect canvas_target_playback_rect = | |
| 255 canvas_playback_rect - canvas_bitmap_rect.OffsetFromOrigin(); | |
| 256 int repeat_count = std::max(1, slow_down_raster_scale_factor_for_debug_); | 254 int repeat_count = std::max(1, slow_down_raster_scale_factor_for_debug_); |
| 257 for (int i = 0; i < repeat_count; ++i) { | 255 for (int i = 0; i < repeat_count; ++i) { |
| 258 display_list_->Raster(canvas, callback, canvas_target_playback_rect, | 256 display_list_->Raster(canvas, callback, canvas_playback_rect, |
| 259 contents_scale); | 257 contents_scale); |
| 260 } | 258 } |
| 261 } | 259 } |
| 262 | 260 |
| 263 sk_sp<SkPicture> DisplayListRasterSource::GetFlattenedPicture() { | 261 sk_sp<SkPicture> DisplayListRasterSource::GetFlattenedPicture() { |
| 264 TRACE_EVENT0("cc", "DisplayListRasterSource::GetFlattenedPicture"); | 262 TRACE_EVENT0("cc", "DisplayListRasterSource::GetFlattenedPicture"); |
| 265 | 263 |
| 266 gfx::Rect display_list_rect(size_); | 264 gfx::Rect display_list_rect(size_); |
| 267 SkPictureRecorder recorder; | 265 SkPictureRecorder recorder; |
| 268 SkCanvas* canvas = recorder.beginRecording(display_list_rect.width(), | 266 SkCanvas* canvas = recorder.beginRecording(display_list_rect.width(), |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 base::trace_event::MemoryAllocatorDump* dump = | 381 base::trace_event::MemoryAllocatorDump* dump = |
| 384 pmd->CreateAllocatorDump(dump_name); | 382 pmd->CreateAllocatorDump(dump_name); |
| 385 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 383 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
| 386 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 384 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 387 memory_usage); | 385 memory_usage); |
| 388 } | 386 } |
| 389 return true; | 387 return true; |
| 390 } | 388 } |
| 391 | 389 |
| 392 } // namespace cc | 390 } // namespace cc |
| OLD | NEW |