| 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/raster_source.h" | 5 #include "cc/playback/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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 can_use_lcd_text_(can_use_lcd_text), | 62 can_use_lcd_text_(can_use_lcd_text), |
| 63 is_solid_color_(other->is_solid_color_), | 63 is_solid_color_(other->is_solid_color_), |
| 64 solid_color_(other->solid_color_), | 64 solid_color_(other->solid_color_), |
| 65 recorded_viewport_(other->recorded_viewport_), | 65 recorded_viewport_(other->recorded_viewport_), |
| 66 size_(other->size_), | 66 size_(other->size_), |
| 67 clear_canvas_with_debug_color_(other->clear_canvas_with_debug_color_), | 67 clear_canvas_with_debug_color_(other->clear_canvas_with_debug_color_), |
| 68 slow_down_raster_scale_factor_for_debug_( | 68 slow_down_raster_scale_factor_for_debug_( |
| 69 other->slow_down_raster_scale_factor_for_debug_), | 69 other->slow_down_raster_scale_factor_for_debug_), |
| 70 should_attempt_to_use_distance_field_text_( | 70 should_attempt_to_use_distance_field_text_( |
| 71 other->should_attempt_to_use_distance_field_text_), | 71 other->should_attempt_to_use_distance_field_text_), |
| 72 image_decode_controller_(other->image_decode_controller_) { | 72 image_decode_controller_(other->image_decode_controller_), |
| 73 subpixel_offset_(other->subpixel_offset_) { |
| 73 // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview). | 74 // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview). |
| 74 // Don't register a dump provider in these cases. | 75 // Don't register a dump provider in these cases. |
| 75 // TODO(ericrk): Get this working in Android Webview. crbug.com/517156 | 76 // TODO(ericrk): Get this working in Android Webview. crbug.com/517156 |
| 76 if (base::ThreadTaskRunnerHandle::IsSet()) { | 77 if (base::ThreadTaskRunnerHandle::IsSet()) { |
| 77 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 78 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 78 this, "cc::RasterSource", base::ThreadTaskRunnerHandle::Get()); | 79 this, "cc::RasterSource", base::ThreadTaskRunnerHandle::Get()); |
| 79 } | 80 } |
| 80 } | 81 } |
| 81 | 82 |
| 82 RasterSource::~RasterSource() { | 83 RasterSource::~RasterSource() { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 } | 228 } |
| 228 } | 229 } |
| 229 } | 230 } |
| 230 | 231 |
| 231 void RasterSource::RasterCommon(SkCanvas* canvas, | 232 void RasterSource::RasterCommon(SkCanvas* canvas, |
| 232 SkPicture::AbortCallback* callback, | 233 SkPicture::AbortCallback* callback, |
| 233 const gfx::Rect& canvas_bitmap_rect, | 234 const gfx::Rect& canvas_bitmap_rect, |
| 234 const gfx::Rect& canvas_playback_rect, | 235 const gfx::Rect& canvas_playback_rect, |
| 235 float contents_scale) const { | 236 float contents_scale) const { |
| 236 canvas->translate(-canvas_bitmap_rect.x(), -canvas_bitmap_rect.y()); | 237 canvas->translate(-canvas_bitmap_rect.x(), -canvas_bitmap_rect.y()); |
| 238 LOG(ERROR) << "subpixel_offset: " << this << ": " << subpixel_offset_.ToString
() << ": " << GetSize().ToString(); |
| 239 canvas->translate(subpixel_offset_.x(), subpixel_offset_.y()); |
| 237 gfx::Rect content_rect = | 240 gfx::Rect content_rect = |
| 238 gfx::ScaleToEnclosingRect(gfx::Rect(size_), contents_scale); | 241 gfx::ScaleToEnclosingRect(gfx::Rect(size_), contents_scale); |
| 239 content_rect.Intersect(canvas_playback_rect); | 242 content_rect.Intersect(canvas_playback_rect); |
| 240 | 243 |
| 241 canvas->clipRect(gfx::RectToSkRect(content_rect), SkRegion::kIntersect_Op); | 244 canvas->clipRect(gfx::RectToSkRect(content_rect), SkRegion::kIntersect_Op); |
| 242 | 245 |
| 243 DCHECK(display_list_.get()); | 246 DCHECK(display_list_.get()); |
| 244 gfx::Rect canvas_target_playback_rect = | 247 gfx::Rect canvas_target_playback_rect = |
| 245 canvas_playback_rect - canvas_bitmap_rect.OffsetFromOrigin(); | 248 canvas_playback_rect - canvas_bitmap_rect.OffsetFromOrigin(); |
| 246 int repeat_count = std::max(1, slow_down_raster_scale_factor_for_debug_); | 249 int repeat_count = std::max(1, slow_down_raster_scale_factor_for_debug_); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 base::trace_event::MemoryAllocatorDump* dump = | 371 base::trace_event::MemoryAllocatorDump* dump = |
| 369 pmd->CreateAllocatorDump(dump_name); | 372 pmd->CreateAllocatorDump(dump_name); |
| 370 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 373 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
| 371 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 374 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 372 memory_usage); | 375 memory_usage); |
| 373 } | 376 } |
| 374 return true; | 377 return true; |
| 375 } | 378 } |
| 376 | 379 |
| 377 } // namespace cc | 380 } // namespace cc |
| OLD | NEW |