Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: cc/tiles/tile_manager.cc

Issue 2175553002: Raster PictureLayerTiling with fractional translation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Raster PictureLayerTiling with fractional translation Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« cc/tiles/picture_layer_tiling.cc ('K') | « cc/tiles/tile.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/tiles/tile_manager.h" 5 #include "cc/tiles/tile_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 TileTask::Vector* dependencies, 56 TileTask::Vector* dependencies,
57 bool supports_concurrent_execution) 57 bool supports_concurrent_execution)
58 : TileTask(supports_concurrent_execution, dependencies), 58 : TileTask(supports_concurrent_execution, dependencies),
59 tile_manager_(tile_manager), 59 tile_manager_(tile_manager),
60 tile_(tile), 60 tile_(tile),
61 resource_(resource), 61 resource_(resource),
62 raster_source_(std::move(raster_source)), 62 raster_source_(std::move(raster_source)),
63 content_rect_(tile->content_rect()), 63 content_rect_(tile->content_rect()),
64 invalid_content_rect_(invalidated_rect), 64 invalid_content_rect_(invalidated_rect),
65 contents_scale_(tile->contents_scale()), 65 contents_scale_(tile->contents_scale()),
66 contents_translation_(tile->contents_translation()),
66 playback_settings_(playback_settings), 67 playback_settings_(playback_settings),
67 tile_resolution_(tile_resolution), 68 tile_resolution_(tile_resolution),
68 layer_id_(tile->layer_id()), 69 layer_id_(tile->layer_id()),
69 source_prepare_tiles_id_(source_prepare_tiles_id), 70 source_prepare_tiles_id_(source_prepare_tiles_id),
70 tile_tracing_id_(static_cast<void*>(tile)), 71 tile_tracing_id_(static_cast<void*>(tile)),
71 new_content_id_(tile->id()), 72 new_content_id_(tile->id()),
72 source_frame_number_(tile->source_frame_number()), 73 source_frame_number_(tile->source_frame_number()),
73 raster_buffer_(std::move(raster_buffer)) { 74 raster_buffer_(std::move(raster_buffer)) {
74 DCHECK(origin_thread_checker_.CalledOnValidThread()); 75 DCHECK(origin_thread_checker_.CalledOnValidThread());
75 } 76 }
76 77
77 // Overridden from Task: 78 // Overridden from Task:
78 void RunOnWorkerThread() override { 79 void RunOnWorkerThread() override {
79 TRACE_EVENT1("cc", "RasterizerTaskImpl::RunOnWorkerThread", 80 TRACE_EVENT1("cc", "RasterizerTaskImpl::RunOnWorkerThread",
80 "source_prepare_tiles_id", source_prepare_tiles_id_); 81 "source_prepare_tiles_id", source_prepare_tiles_id_);
81 82
82 DCHECK(raster_source_.get()); 83 DCHECK(raster_source_.get());
83 DCHECK(raster_buffer_); 84 DCHECK(raster_buffer_);
84 85
85 frame_viewer_instrumentation::ScopedRasterTask raster_task( 86 frame_viewer_instrumentation::ScopedRasterTask raster_task(
86 tile_tracing_id_, tile_resolution_, source_frame_number_, layer_id_); 87 tile_tracing_id_, tile_resolution_, source_frame_number_, layer_id_);
87 ScopedRasterTaskTimer timer; 88 ScopedRasterTaskTimer timer;
88 timer.SetArea(content_rect_.size().GetArea()); 89 timer.SetArea(content_rect_.size().GetArea());
89 90
90 DCHECK(raster_source_); 91 DCHECK(raster_source_);
91 92
92 raster_buffer_->Playback(raster_source_.get(), content_rect_, 93 raster_buffer_->Playback(raster_source_.get(), content_rect_,
93 invalid_content_rect_, new_content_id_, 94 invalid_content_rect_, new_content_id_,
94 contents_scale_, playback_settings_); 95 contents_scale_, contents_translation_,
96 playback_settings_);
95 } 97 }
96 98
97 // Overridden from TileTask: 99 // Overridden from TileTask:
98 void OnTaskCompleted() override { 100 void OnTaskCompleted() override {
99 DCHECK(origin_thread_checker_.CalledOnValidThread()); 101 DCHECK(origin_thread_checker_.CalledOnValidThread());
100 102
101 // Here calling state().IsCanceled() is thread-safe, because this task is 103 // Here calling state().IsCanceled() is thread-safe, because this task is
102 // already concluded as FINISHED or CANCELLED and no longer will be worked 104 // already concluded as FINISHED or CANCELLED and no longer will be worked
103 // upon by task graph runner. 105 // upon by task graph runner.
104 tile_manager_->OnRasterTaskCompleted(std::move(raster_buffer_), tile_, 106 tile_manager_->OnRasterTaskCompleted(std::move(raster_buffer_), tile_,
(...skipping 14 matching lines...) Expand all
119 // origin thread. Ensure their access by checking CalledOnValidThread(). 121 // origin thread. Ensure their access by checking CalledOnValidThread().
120 TileManager* tile_manager_; 122 TileManager* tile_manager_;
121 Tile* tile_; 123 Tile* tile_;
122 Resource* resource_; 124 Resource* resource_;
123 125
124 // The following members should be used for running the task. 126 // The following members should be used for running the task.
125 scoped_refptr<RasterSource> raster_source_; 127 scoped_refptr<RasterSource> raster_source_;
126 gfx::Rect content_rect_; 128 gfx::Rect content_rect_;
127 gfx::Rect invalid_content_rect_; 129 gfx::Rect invalid_content_rect_;
128 float contents_scale_; 130 float contents_scale_;
131 gfx::Vector2dF contents_translation_;
129 RasterSource::PlaybackSettings playback_settings_; 132 RasterSource::PlaybackSettings playback_settings_;
130 TileResolution tile_resolution_; 133 TileResolution tile_resolution_;
131 int layer_id_; 134 int layer_id_;
132 uint64_t source_prepare_tiles_id_; 135 uint64_t source_prepare_tiles_id_;
133 void* tile_tracing_id_; 136 void* tile_tracing_id_;
134 uint64_t new_content_id_; 137 uint64_t new_content_id_;
135 int source_frame_number_; 138 int source_frame_number_;
136 std::unique_ptr<RasterBuffer> raster_buffer_; 139 std::unique_ptr<RasterBuffer> raster_buffer_;
137 140
138 DISALLOW_COPY_AND_ASSIGN(RasterTaskImpl); 141 DISALLOW_COPY_AND_ASSIGN(RasterTaskImpl);
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 break; 637 break;
635 } 638 }
636 639
637 bool tile_is_needed_now = priority.priority_bin == TilePriority::NOW; 640 bool tile_is_needed_now = priority.priority_bin == TilePriority::NOW;
638 if (tile->use_picture_analysis() && kUseColorEstimator) { 641 if (tile->use_picture_analysis() && kUseColorEstimator) {
639 // We analyze for solid color here, to decide to continue 642 // We analyze for solid color here, to decide to continue
640 // or drop the tile for scheduling and raster. 643 // or drop the tile for scheduling and raster.
641 // TODO(sohanjg): Check if we could use a shared analysis 644 // TODO(sohanjg): Check if we could use a shared analysis
642 // canvas which is reset between tiles. 645 // canvas which is reset between tiles.
643 SkColor color = SK_ColorTRANSPARENT; 646 SkColor color = SK_ColorTRANSPARENT;
647 gfx::RectF layer_rect(tile->content_rect());
648 layer_rect.Offset(-tile->contents_translation());
649 layer_rect.Scale(1 / tile->contents_scale());
644 bool is_solid_color = 650 bool is_solid_color =
645 prioritized_tile.raster_source()->PerformSolidColorAnalysis( 651 prioritized_tile.raster_source()->PerformSolidColorAnalysis(
646 tile->content_rect(), tile->contents_scale(), &color); 652 gfx::ToEnclosingRect(layer_rect), 1.f, &color);
enne (OOO) 2016/07/26 00:22:16 You should probably pass the translation through h
trchen 2016/08/03 06:06:07 IMO it is better to avoid RasterSource from knowin
647 if (is_solid_color) { 653 if (is_solid_color) {
648 tile->draw_info().set_solid_color(color); 654 tile->draw_info().set_solid_color(color);
649 tile->draw_info().set_was_ever_ready_to_draw(); 655 tile->draw_info().set_was_ever_ready_to_draw();
650 if (!tile_is_needed_now) 656 if (!tile_is_needed_now)
651 tile->draw_info().set_was_a_prepaint_tile(); 657 tile->draw_info().set_was_a_prepaint_tile();
652 client_->NotifyTileStateChanged(tile); 658 client_->NotifyTileStateChanged(tile);
653 continue; 659 continue;
654 } 660 }
655 } 661 }
656 662
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 all_tile_tasks_completed = false; 1339 all_tile_tasks_completed = false;
1334 did_notify_all_tile_tasks_completed = false; 1340 did_notify_all_tile_tasks_completed = false;
1335 } 1341 }
1336 1342
1337 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default; 1343 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default;
1338 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule( 1344 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule(
1339 PrioritizedWorkToSchedule&& other) = default; 1345 PrioritizedWorkToSchedule&& other) = default;
1340 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default; 1346 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default;
1341 1347
1342 } // namespace cc 1348 } // namespace cc
OLDNEW
« cc/tiles/picture_layer_tiling.cc ('K') | « cc/tiles/tile.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698