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

Unified Diff: cc/layers/picture_layer_impl.cc

Issue 2688673003: cc: Distinguish single texture mask from normal masks (Closed)
Patch Set: Created 3 years, 10 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 4f6bfdb2981a21197bad72053e068f6b34ae6fd8..4f609b5b5844ea7879426d109b086c1f04ed8684 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -92,7 +92,8 @@ namespace cc {
PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl,
int id,
- bool is_mask)
+ bool is_mask,
+ bool is_single_texture_mask)
: LayerImpl(tree_impl, id),
twin_layer_(nullptr),
tilings_(CreatePictureLayerTilingSet()),
@@ -108,6 +109,7 @@ PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl,
was_screen_space_transform_animating_(false),
only_used_low_res_last_append_quads_(false),
is_mask_(is_mask),
+ is_single_texture_mask_(is_single_texture_mask),
nearest_neighbor_(false),
is_directly_composited_image_(false) {
layer_tree_impl()->RegisterPictureLayerImpl(this);
@@ -125,12 +127,14 @@ const char* PictureLayerImpl::LayerTypeAsString() const {
std::unique_ptr<LayerImpl> PictureLayerImpl::CreateLayerImpl(
LayerTreeImpl* tree_impl) {
- return PictureLayerImpl::Create(tree_impl, id(), is_mask_);
+ return PictureLayerImpl::Create(tree_impl, id(), is_mask_,
+ is_single_texture_mask_);
}
void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) {
PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer);
DCHECK_EQ(layer_impl->is_mask_, is_mask_);
+ DCHECK_EQ(layer_impl->is_single_texture_mask_, is_single_texture_mask_);
LayerImpl::PushPropertiesTo(base_layer);
@@ -696,7 +700,7 @@ std::unique_ptr<Tile> PictureLayerImpl::CreateTile(
// We don't handle solid color masks, so we shouldn't bother analyzing those.
// Otherwise, always analyze to maximize memory savings.
- if (!is_mask_)
+ if (!is_mask_ && !is_single_texture_mask_)
flags = Tile::USE_PICTURE_ANALYSIS;
if (contents_opaque())
@@ -738,7 +742,7 @@ gfx::Size PictureLayerImpl::CalculateTileSize(
int max_texture_size =
layer_tree_impl()->resource_provider()->max_texture_size();
- if (is_mask_) {
+ if (is_mask_ || is_single_texture_mask_) {
// Masks are not tiled, so if we can't cover the whole mask with one tile,
// we shouldn't have such a tiling at all.
DCHECK_LE(content_bounds.width(), max_texture_size);
@@ -1177,8 +1181,9 @@ float PictureLayerImpl::MaximumContentsScale() const {
// tiling. Other layers can have tilings such that dimension * scale
// does not overflow.
float max_dimension = static_cast<float>(
- is_mask_ ? layer_tree_impl()->resource_provider()->max_texture_size()
- : std::numeric_limits<int>::max());
+ is_mask_ || is_single_texture_mask_
+ ? layer_tree_impl()->resource_provider()->max_texture_size()
+ : std::numeric_limits<int>::max());
float max_scale_width = max_dimension / bounds().width();
float max_scale_height = max_dimension / bounds().height();
float max_scale = std::min(max_scale_width, max_scale_height);

Powered by Google App Engine
This is Rietveld 408576698