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

Unified Diff: cc/layers/picture_layer_impl.cc

Issue 2828353003: Determine mask UVs based on texture size (Closed)
Patch Set: small fix Created 3 years, 8 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
Index: cc/layers/picture_layer_impl.cc
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index f385bddd8003344734c5ee27c144d901da007d3e..3a740c8624b925d8c9c863c55d3ece785be2a7b6 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -840,8 +840,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() ||
@@ -874,6 +876,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
+ // coordinatesis are (1.0f, 1.0f). However, if we are rasterizing to an
enne (OOO) 2017/05/02 21:31:37 typo
ericrk 2017/05/04 19:23:53 Done.
+ // 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());
enne (OOO) 2017/05/02 21:31:37 Is this the same as bounds()?
ericrk 2017/05/04 19:23:53 Most of the time, yes. In certain cases, bounds ap
+ 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) {

Powered by Google App Engine
This is Rietveld 408576698