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

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

Issue 659683002: Include mask texture size in RenderPassDrawQuad (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@update_mask_draw_quad_test
Patch Set: danakj review Created 6 years, 2 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
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 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 10
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 if (!layer_tree_impl()->needs_update_draw_properties() && 799 if (!layer_tree_impl()->needs_update_draw_properties() &&
800 should_update_tile_priorities_) { 800 should_update_tile_priorities_) {
801 // TODO(danakj): Add a DCHECK() that we are not using occlusion tracking 801 // TODO(danakj): Add a DCHECK() that we are not using occlusion tracking
802 // when we stop using the pending tree in the browser compositor. If we want 802 // when we stop using the pending tree in the browser compositor. If we want
803 // to support occlusion tracking here, we need to dirty the draw properties 803 // to support occlusion tracking here, we need to dirty the draw properties
804 // or save occlusion as a draw property. 804 // or save occlusion as a draw property.
805 UpdateTilePriorities(Occlusion()); 805 UpdateTilePriorities(Occlusion());
806 } 806 }
807 } 807 }
808 808
809 ResourceProvider::ResourceId PictureLayerImpl::ContentsResourceId() const { 809 void PictureLayerImpl::ContentsResourceId(
810 gfx::Rect content_rect(content_bounds()); 810 ResourceProvider::ResourceId* resource_id,
811 gfx::Size* resource_size) const {
812 gfx::Rect content_rect(bounds());
811 PictureLayerTilingSet::CoverageIterator iter( 813 PictureLayerTilingSet::CoverageIterator iter(
812 tilings_.get(), 1.f, content_rect, ideal_contents_scale_); 814 tilings_.get(), 1.f, content_rect, ideal_contents_scale_);
813 815
814 // Mask resource not ready yet. 816 // Mask resource not ready yet.
815 if (!iter || !*iter) 817 if (!iter || !*iter) {
816 return 0; 818 *resource_id = 0;
819 return;
820 }
817 821
818 // Masks only supported if they fit on exactly one tile. 822 // Masks only supported if they fit on exactly one tile.
819 DCHECK(iter.geometry_rect() == content_rect) 823 DCHECK(iter.geometry_rect() == content_rect)
820 << "iter rect " << iter.geometry_rect().ToString() << " content rect " 824 << "iter rect " << iter.geometry_rect().ToString() << " content rect "
821 << content_rect.ToString(); 825 << content_rect.ToString();
822 826
823 const ManagedTileState::DrawInfo& draw_info = iter->draw_info(); 827 const ManagedTileState::DrawInfo& draw_info = iter->draw_info();
824 if (!draw_info.IsReadyToDraw() || 828 if (!draw_info.IsReadyToDraw() ||
825 draw_info.mode() != ManagedTileState::DrawInfo::RESOURCE_MODE) 829 draw_info.mode() != ManagedTileState::DrawInfo::RESOURCE_MODE) {
826 return 0; 830 *resource_id = 0;
831 return;
832 }
827 833
828 return draw_info.get_resource_id(); 834 *resource_id = draw_info.get_resource_id();
835 *resource_size = iter.texture_size();
829 } 836 }
830 837
831 void PictureLayerImpl::DoPostCommitInitialization() { 838 void PictureLayerImpl::DoPostCommitInitialization() {
832 DCHECK(needs_post_commit_initialization_); 839 DCHECK(needs_post_commit_initialization_);
833 DCHECK(layer_tree_impl()->IsPendingTree()); 840 DCHECK(layer_tree_impl()->IsPendingTree());
834 841
835 if (!tilings_) 842 if (!tilings_)
836 tilings_.reset(new PictureLayerTilingSet(this, bounds())); 843 tilings_.reset(new PictureLayerTilingSet(this, bounds()));
837 844
838 DCHECK(!twin_layer_); 845 DCHECK(!twin_layer_);
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); 1682 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange();
1676 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; 1683 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start;
1677 return tiling_range.end - 1 - current_tiling_range_offset; 1684 return tiling_range.end - 1 - current_tiling_range_offset;
1678 } 1685 }
1679 } 1686 }
1680 NOTREACHED(); 1687 NOTREACHED();
1681 return 0; 1688 return 0;
1682 } 1689 }
1683 1690
1684 } // namespace cc 1691 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698