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

Side by Side Diff: cc/layers/picture_layer_impl.cc

Issue 15995033: cc: Low quality support for low res tiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase fix Created 7 years, 6 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
« no previous file with comments | « no previous file | cc/resources/managed_tile_state.h » ('j') | 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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 draw_transform(), 156 draw_transform(),
157 gfx::QuadF(rect), 157 gfx::QuadF(rect),
158 &clipped); 158 &clipped);
159 if (ShowDebugBorders()) { 159 if (ShowDebugBorders()) {
160 for (PictureLayerTilingSet::CoverageIterator iter( 160 for (PictureLayerTilingSet::CoverageIterator iter(
161 tilings_.get(), contents_scale_x(), rect, ideal_contents_scale_); 161 tilings_.get(), contents_scale_x(), rect, ideal_contents_scale_);
162 iter; 162 iter;
163 ++iter) { 163 ++iter) {
164 SkColor color; 164 SkColor color;
165 float width; 165 float width;
166 if (*iter && iter->tile_version().IsReadyToDraw()) { 166 TileRasterMode raster_mode;
167 ManagedTileState::TileVersion::Mode mode = iter->tile_version().mode(); 167 if (*iter && iter->IsReadyToDraw(&raster_mode)) {
168 ManagedTileState::TileVersion::Mode mode =
169 iter->tile_version(raster_mode).mode();
168 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) { 170 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) {
169 color = DebugColors::SolidColorTileBorderColor(); 171 color = DebugColors::SolidColorTileBorderColor();
170 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); 172 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl());
171 } else if (mode == ManagedTileState::TileVersion::PICTURE_PILE_MODE) { 173 } else if (mode == ManagedTileState::TileVersion::PICTURE_PILE_MODE) {
172 color = DebugColors::PictureTileBorderColor(); 174 color = DebugColors::PictureTileBorderColor();
173 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); 175 width = DebugColors::PictureTileBorderWidth(layer_tree_impl());
174 } else if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) { 176 } else if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) {
175 color = DebugColors::HighResTileBorderColor(); 177 color = DebugColors::HighResTileBorderColor();
176 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); 178 width = DebugColors::HighResTileBorderWidth(layer_tree_impl());
177 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) { 179 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) {
(...skipping 22 matching lines...) Expand all
200 202
201 // Keep track of the tilings that were used so that tilings that are 203 // Keep track of the tilings that were used so that tilings that are
202 // unused can be considered for removal. 204 // unused can be considered for removal.
203 std::vector<PictureLayerTiling*> seen_tilings; 205 std::vector<PictureLayerTiling*> seen_tilings;
204 206
205 for (PictureLayerTilingSet::CoverageIterator iter( 207 for (PictureLayerTilingSet::CoverageIterator iter(
206 tilings_.get(), contents_scale_x(), rect, ideal_contents_scale_); 208 tilings_.get(), contents_scale_x(), rect, ideal_contents_scale_);
207 iter; 209 iter;
208 ++iter) { 210 ++iter) {
209 gfx::Rect geometry_rect = iter.geometry_rect(); 211 gfx::Rect geometry_rect = iter.geometry_rect();
210 if (!*iter || !iter->tile_version().IsReadyToDraw()) { 212 TileRasterMode raster_mode;
213 if (!*iter || !iter->IsReadyToDraw(&raster_mode)) {
211 if (DrawCheckerboardForMissingTiles()) { 214 if (DrawCheckerboardForMissingTiles()) {
212 // TODO(enne): Figure out how to show debug "invalidated checker" color 215 // TODO(enne): Figure out how to show debug "invalidated checker" color
213 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create(); 216 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create();
214 SkColor color = DebugColors::DefaultCheckerboardColor(); 217 SkColor color = DebugColors::DefaultCheckerboardColor();
215 quad->SetNew(shared_quad_state, geometry_rect, color); 218 quad->SetNew(shared_quad_state, geometry_rect, color);
216 if (quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data)) 219 if (quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data))
217 append_quads_data->num_missing_tiles++; 220 append_quads_data->num_missing_tiles++;
218 } else { 221 } else {
219 SkColor color = SafeOpaqueBackgroundColor(); 222 SkColor color = SafeOpaqueBackgroundColor();
220 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); 223 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
221 quad->SetNew(shared_quad_state, geometry_rect, color, false); 224 quad->SetNew(shared_quad_state, geometry_rect, color, false);
222 if (quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data)) 225 if (quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data))
223 append_quads_data->num_missing_tiles++; 226 append_quads_data->num_missing_tiles++;
224 } 227 }
225 228
226 append_quads_data->had_incomplete_tile = true; 229 append_quads_data->had_incomplete_tile = true;
227 continue; 230 continue;
228 } 231 }
229 232
230 const ManagedTileState::TileVersion& tile_version = iter->tile_version(); 233 const ManagedTileState::TileVersion& tile_version =
234 iter->tile_version(raster_mode);
231 switch (tile_version.mode()) { 235 switch (tile_version.mode()) {
232 case ManagedTileState::TileVersion::RESOURCE_MODE: { 236 case ManagedTileState::TileVersion::RESOURCE_MODE: {
233 gfx::RectF texture_rect = iter.texture_rect(); 237 gfx::RectF texture_rect = iter.texture_rect();
234 gfx::Rect opaque_rect = iter->opaque_rect(); 238 gfx::Rect opaque_rect = iter->opaque_rect();
235 opaque_rect.Intersect(content_rect); 239 opaque_rect.Intersect(content_rect);
236 240
237 if (iter->contents_scale() != ideal_contents_scale_) 241 if (iter->contents_scale() != ideal_contents_scale_)
238 append_quads_data->had_incomplete_tile = true; 242 append_quads_data->had_incomplete_tile = true;
239 243
240 scoped_ptr<TileDrawQuad> quad = TileDrawQuad::Create(); 244 scoped_ptr<TileDrawQuad> quad = TileDrawQuad::Create();
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 } 610 }
607 611
608 ResourceProvider::ResourceId PictureLayerImpl::ContentsResourceId() const { 612 ResourceProvider::ResourceId PictureLayerImpl::ContentsResourceId() const {
609 gfx::Rect content_rect(content_bounds()); 613 gfx::Rect content_rect(content_bounds());
610 float scale = contents_scale_x(); 614 float scale = contents_scale_x();
611 for (PictureLayerTilingSet::CoverageIterator 615 for (PictureLayerTilingSet::CoverageIterator
612 iter(tilings_.get(), scale, content_rect, ideal_contents_scale_); 616 iter(tilings_.get(), scale, content_rect, ideal_contents_scale_);
613 iter; 617 iter;
614 ++iter) { 618 ++iter) {
615 // Mask resource not ready yet. 619 // Mask resource not ready yet.
616 if (!*iter || 620 TileRasterMode raster_mode;
617 iter->tile_version().mode() != 621 if (!*iter || !iter->IsReadyToDraw(&raster_mode))
618 ManagedTileState::TileVersion::RESOURCE_MODE ||
619 !iter->tile_version().IsReadyToDraw())
620 return 0; 622 return 0;
623
624 if (iter->tile_version(raster_mode).mode() !=
625 ManagedTileState::TileVersion::RESOURCE_MODE)
626 return 0;
627
621 // Masks only supported if they fit on exactly one tile. 628 // Masks only supported if they fit on exactly one tile.
622 if (iter.geometry_rect() != content_rect) 629 if (iter.geometry_rect() != content_rect)
623 return 0; 630 return 0;
624 return iter->tile_version().get_resource_id(); 631
632 return iter->tile_version(raster_mode).get_resource_id();
625 } 633 }
626 return 0; 634 return 0;
627 } 635 }
628 636
629 void PictureLayerImpl::MarkVisibleResourcesAsRequired() const { 637 void PictureLayerImpl::MarkVisibleResourcesAsRequired() const {
630 DCHECK(layer_tree_impl()->IsPendingTree()); 638 DCHECK(layer_tree_impl()->IsPendingTree());
631 DCHECK(!layer_tree_impl()->needs_update_draw_properties()); 639 DCHECK(!layer_tree_impl()->needs_update_draw_properties());
632 DCHECK(ideal_contents_scale_); 640 DCHECK(ideal_contents_scale_);
633 DCHECK_GT(tilings_->num_tilings(), 0u); 641 DCHECK_GT(tilings_->num_tilings(), 0u);
634 642
(...skipping 29 matching lines...) Expand all
664 if (tiling->resolution() == HIGH_RESOLUTION) { 672 if (tiling->resolution() == HIGH_RESOLUTION) {
665 DCHECK(!high_res) << "There can only be one high res tiling"; 673 DCHECK(!high_res) << "There can only be one high res tiling";
666 high_res = tiling; 674 high_res = tiling;
667 continue; 675 continue;
668 } 676 }
669 for (PictureLayerTiling::CoverageIterator iter(tiling, 677 for (PictureLayerTiling::CoverageIterator iter(tiling,
670 contents_scale_x(), 678 contents_scale_x(),
671 rect); 679 rect);
672 iter; 680 iter;
673 ++iter) { 681 ++iter) {
674 if (!*iter || !iter->tile_version().IsReadyToDraw()) 682 if (!*iter || !iter->IsReadyToDraw(NULL))
675 continue; 683 continue;
676 684
677 // This iteration is over the visible content rect which is potentially 685 // This iteration is over the visible content rect which is potentially
678 // less conservative than projecting the viewport into the layer. 686 // less conservative than projecting the viewport into the layer.
679 // Ignore tiles that are know to be outside the viewport. 687 // Ignore tiles that are know to be outside the viewport.
680 if (iter->priority(PENDING_TREE).distance_to_visible_in_pixels != 0) 688 if (iter->priority(PENDING_TREE).distance_to_visible_in_pixels != 0)
681 continue; 689 continue;
682 690
683 missing_region.Subtract(iter.geometry_rect()); 691 missing_region.Subtract(iter.geometry_rect());
684 iter->mark_required_for_activation(); 692 iter->mark_required_for_activation();
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 state->Set("tilings", tilings_->AsValue().release()); 1021 state->Set("tilings", tilings_->AsValue().release());
1014 state->Set("pictures", pile_->AsValue().release()); 1022 state->Set("pictures", pile_->AsValue().release());
1015 state->Set("invalidation", invalidation_.AsValue().release()); 1023 state->Set("invalidation", invalidation_.AsValue().release());
1016 } 1024 }
1017 1025
1018 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { 1026 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const {
1019 return tilings_->GPUMemoryUsageInBytes(); 1027 return tilings_->GPUMemoryUsageInBytes();
1020 } 1028 }
1021 1029
1022 } // namespace cc 1030 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/resources/managed_tile_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698