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

Side by Side Diff: cc/picture_layer_impl.cc

Issue 12353003: cc: Refactored Tile::GetResourceId (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed forward declare Created 7 years, 9 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 | Annotate | Revision Log
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/picture_layer_impl.h" 5 #include "cc/picture_layer_impl.h"
6 6
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "cc/append_quads_data.h" 8 #include "cc/append_quads_data.h"
9 #include "cc/checkerboard_draw_quad.h" 9 #include "cc/checkerboard_draw_quad.h"
10 #include "cc/debug_border_draw_quad.h" 10 #include "cc/debug_border_draw_quad.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 if (showDebugBorders()) { 108 if (showDebugBorders()) {
109 for (PictureLayerTilingSet::Iterator iter(tilings_.get(), 109 for (PictureLayerTilingSet::Iterator iter(tilings_.get(),
110 contentsScaleX(), 110 contentsScaleX(),
111 rect, 111 rect,
112 ideal_contents_scale_, 112 ideal_contents_scale_,
113 layerDeviceAlignment); 113 layerDeviceAlignment);
114 iter; 114 iter;
115 ++iter) { 115 ++iter) {
116 SkColor color; 116 SkColor color;
117 float width; 117 float width;
118 if (*iter && iter->GetResourceId()) { 118 if (*iter && iter->drawing_info().is_ready_to_draw()) {
119 if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) { 119 if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) {
120 color = DebugColors::HighResTileBorderColor(); 120 color = DebugColors::HighResTileBorderColor();
121 width = DebugColors::HighResTileBorderWidth(layerTreeImpl()); 121 width = DebugColors::HighResTileBorderWidth(layerTreeImpl());
122 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) { 122 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) {
123 color = DebugColors::LowResTileBorderColor(); 123 color = DebugColors::LowResTileBorderColor();
124 width = DebugColors::LowResTileBorderWidth(layerTreeImpl()); 124 width = DebugColors::LowResTileBorderWidth(layerTreeImpl());
125 } else if (iter->contents_scale() > contentsScaleX()) { 125 } else if (iter->contents_scale() > contentsScaleX()) {
126 color = DebugColors::ExtraHighResTileBorderColor(); 126 color = DebugColors::ExtraHighResTileBorderColor();
127 width = DebugColors::ExtraHighResTileBorderWidth(layerTreeImpl()); 127 width = DebugColors::ExtraHighResTileBorderWidth(layerTreeImpl());
128 } else { 128 } else {
(...skipping 19 matching lines...) Expand all
148 148
149 for (PictureLayerTilingSet::Iterator iter(tilings_.get(), 149 for (PictureLayerTilingSet::Iterator iter(tilings_.get(),
150 contentsScaleX(), 150 contentsScaleX(),
151 rect, 151 rect,
152 ideal_contents_scale_, 152 ideal_contents_scale_,
153 layerDeviceAlignment); 153 layerDeviceAlignment);
154 iter; 154 iter;
155 ++iter) { 155 ++iter) {
156 ResourceProvider::ResourceId resource = 0; 156 ResourceProvider::ResourceId resource = 0;
157 if (*iter) 157 if (*iter)
158 resource = iter->GetResourceId(); 158 resource = iter->drawing_info().get_resource_id();
enne (OOO) 2013/02/27 22:13:57 I think this isn't safe, given your changed implem
159 159
160 gfx::Rect geometry_rect = iter.geometry_rect(); 160 gfx::Rect geometry_rect = iter.geometry_rect();
161 161
162 if (!resource) { 162 if (!resource) {
163 if (drawCheckerboardForMissingTiles()) { 163 if (drawCheckerboardForMissingTiles()) {
164 // TODO(enne): Figure out how to show debug "invalidated checker" color 164 // TODO(enne): Figure out how to show debug "invalidated checker" color
165 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create(); 165 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create();
166 SkColor color = DebugColors::DefaultCheckerboardColor(); 166 SkColor color = DebugColors::DefaultCheckerboardColor();
167 quad->SetNew(sharedQuadState, geometry_rect, color); 167 quad->SetNew(sharedQuadState, geometry_rect, color);
168 if (quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData)) 168 if (quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData))
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 gfx::Rect content_rect(gfx::Point(), contentBounds()); 466 gfx::Rect content_rect(gfx::Point(), contentBounds());
467 float scale = contentsScaleX(); 467 float scale = contentsScaleX();
468 for (PictureLayerTilingSet::Iterator iter(tilings_.get(), 468 for (PictureLayerTilingSet::Iterator iter(tilings_.get(),
469 scale, 469 scale,
470 content_rect, 470 content_rect,
471 ideal_contents_scale_, 471 ideal_contents_scale_,
472 PictureLayerTiling::LayerDeviceAlign mentUnknown); 472 PictureLayerTiling::LayerDeviceAlign mentUnknown);
473 iter; 473 iter;
474 ++iter) { 474 ++iter) {
475 // Mask resource not ready yet. 475 // Mask resource not ready yet.
476 if (!*iter || !iter->GetResourceId()) 476 if (!*iter ||
477 !iter->drawing_info().mode() != TileDrawingInfo::TEXTURE_MODE ||
478 !iter->drawing_info().is_ready_to_draw())
477 return 0; 479 return 0;
478 // Masks only supported if they fit on exactly one tile. 480 // Masks only supported if they fit on exactly one tile.
479 if (iter.geometry_rect() != content_rect) 481 if (iter.geometry_rect() != content_rect)
480 return 0; 482 return 0;
481 return iter->GetResourceId(); 483 return iter->drawing_info().get_resource_id();
482 } 484 }
483 return 0; 485 return 0;
484 } 486 }
485 487
486 bool PictureLayerImpl::areVisibleResourcesReady() const { 488 bool PictureLayerImpl::areVisibleResourcesReady() const {
487 DCHECK(layerTreeImpl()->IsPendingTree()); 489 DCHECK(layerTreeImpl()->IsPendingTree());
488 DCHECK(ideal_contents_scale_); 490 DCHECK(ideal_contents_scale_);
489 491
490 const gfx::Rect& rect = visibleContentRect(); 492 const gfx::Rect& rect = visibleContentRect();
491 493
(...skipping 23 matching lines...) Expand all
515 if (tiling->contents_scale() < min_acceptable_scale) 517 if (tiling->contents_scale() < min_acceptable_scale)
516 continue; 518 continue;
517 519
518 for (PictureLayerTiling::Iterator iter(tiling, 520 for (PictureLayerTiling::Iterator iter(tiling,
519 contentsScaleX(), 521 contentsScaleX(),
520 rect, 522 rect,
521 PictureLayerTiling::LayerDeviceAlignm entUnknown); 523 PictureLayerTiling::LayerDeviceAlignm entUnknown);
522 iter; 524 iter;
523 ++iter) { 525 ++iter) {
524 // A null tile (i.e. no recording) is considered "ready". 526 // A null tile (i.e. no recording) is considered "ready".
525 if (!*iter || iter->GetResourceId()) 527 if (!*iter || iter->drawing_info().is_ready_to_draw())
526 missing_region.Subtract(iter.geometry_rect()); 528 missing_region.Subtract(iter.geometry_rect());
527 } 529 }
528 } 530 }
529 531
530 return missing_region.IsEmpty(); 532 return missing_region.IsEmpty();
531 } 533 }
532 534
533 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { 535 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) {
534 DCHECK(contents_scale >= MinimumContentsScale()); 536 DCHECK(contents_scale >= MinimumContentsScale());
535 537
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { 795 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const {
794 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 796 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
795 LayerImpl::AsValueInto(state.get()); 797 LayerImpl::AsValueInto(state.get());
796 798
797 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); 799 state->SetDouble("ideal_contents_scale", ideal_contents_scale_);
798 state->Set("tilings", tilings_->AsValue().release()); 800 state->Set("tilings", tilings_->AsValue().release());
799 return state.PassAs<base::Value>(); 801 return state.PassAs<base::Value>();
800 } 802 }
801 803
802 } // namespace cc 804 } // namespace cc
OLDNEW
« no previous file with comments | « cc/cc.gyp ('k') | cc/picture_layer_tiling_set.cc » ('j') | cc/tile_drawing_info.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698