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

Unified Diff: cc/layers/picture_layer_impl.cc

Issue 2828353003: Determine mask UVs based on texture size (Closed)
Patch Set: nit Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_layer_impl.cc
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 1493709212f89ff8d4488cf3ed1f15ab93956b75..fd370f53e383219eeb0c113751ce8b09bd84ae5e 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -851,8 +851,10 @@ gfx::Size PictureLayerImpl::CalculateTileSize(
return gfx::Size(tile_width, tile_height);
}
-void PictureLayerImpl::GetContentsResourceId(ResourceId* resource_id,
- gfx::Size* resource_size) const {
+void PictureLayerImpl::GetContentsResourceId(
+ ResourceId* resource_id,
+ gfx::Size* resource_size,
+ gfx::SizeF* resource_uv_size) const {
// The bounds and the pile size may differ if the pile wasn't updated (ie.
// PictureLayer::Update didn't happen). In that case the pile will be empty.
DCHECK(raster_source_->GetSize().IsEmpty() ||
@@ -885,6 +887,18 @@ void PictureLayerImpl::GetContentsResourceId(ResourceId* resource_id,
*resource_id = draw_info.resource_id();
*resource_size = draw_info.resource_size();
+ // |resource_uv_size| represents the range of UV coordinates that map to the
+ // content being drawn. Typically, we draw to the entire texture, so these
+ // coordinates are (1.0f, 1.0f). However, if we are rasterizing to an
+ // over-large texture, this size will be smaller, mapping to the subset of the
+ // texture being used.
+ gfx::SizeF requested_tile_size =
+ gfx::SizeF(iter->tiling()->tiling_data()->tiling_size());
+ DCHECK_LE(requested_tile_size.width(), draw_info.resource_size().width());
+ DCHECK_LE(requested_tile_size.height(), draw_info.resource_size().height());
+ *resource_uv_size = gfx::SizeF(
+ requested_tile_size.width() / draw_info.resource_size().width(),
+ requested_tile_size.height() / draw_info.resource_size().height());
}
void PictureLayerImpl::SetNearestNeighbor(bool nearest_neighbor) {
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698