Commit 9f38439e authored by Daniele Castagna's avatar Daniele Castagna Committed by Commit Bot

cc: Remove TextureLayer::SetVertexOpacity

TextureLayer::SetVertexOpacity is not used anywhere outside tests.

This CL removes it. The final goal is to get rid of vertex_opacity in
viz:TextureDrawQuad that affects the size of QuadList.

Bug: None

Change-Id: I584dc3315b7a5d26e57ed067f2974866bef5d284
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2059788
Auto-Submit: Daniele Castagna <dcastagna@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742482}
parent c6d4321f
......@@ -65,26 +65,6 @@ void TextureLayer::SetUV(const gfx::PointF& top_left,
SetNeedsCommit();
}
void TextureLayer::SetVertexOpacity(float bottom_left,
float top_left,
float top_right,
float bottom_right) {
// Indexing according to the quad vertex generation:
// 1--2
// | |
// 0--3
if (vertex_opacity_[0] == bottom_left &&
vertex_opacity_[1] == top_left &&
vertex_opacity_[2] == top_right &&
vertex_opacity_[3] == bottom_right)
return;
vertex_opacity_[0] = bottom_left;
vertex_opacity_[1] = top_left;
vertex_opacity_[2] = top_right;
vertex_opacity_[3] = bottom_right;
SetNeedsCommit();
}
void TextureLayer::SetPremultipliedAlpha(bool premultiplied_alpha) {
if (premultiplied_alpha_ == premultiplied_alpha)
return;
......@@ -216,7 +196,6 @@ void TextureLayer::PushPropertiesTo(LayerImpl* layer) {
texture_layer->SetNearestNeighbor(nearest_neighbor_);
texture_layer->SetUVTopLeft(uv_top_left_);
texture_layer->SetUVBottomRight(uv_bottom_right_);
texture_layer->SetVertexOpacity(vertex_opacity_);
texture_layer->SetPremultipliedAlpha(premultiplied_alpha_);
texture_layer->SetBlendBackgroundColor(blend_background_color_);
texture_layer->SetForceTextureToOpaque(force_texture_to_opaque_);
......
......@@ -137,13 +137,6 @@ class CC_EXPORT TextureLayer : public Layer, SharedBitmapIdRegistrar {
// Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1).
void SetUV(const gfx::PointF& top_left, const gfx::PointF& bottom_right);
// Sets an opacity value per vertex. It will be multiplied by the layer
// opacity value.
void SetVertexOpacity(float bottom_left,
float top_left,
float top_right,
float bottom_right);
// Sets whether the alpha channel is premultiplied or unpremultiplied.
// Defaults to true.
void SetPremultipliedAlpha(bool premultiplied_alpha);
......@@ -208,7 +201,6 @@ class CC_EXPORT TextureLayer : public Layer, SharedBitmapIdRegistrar {
gfx::PointF uv_top_left_ = gfx::PointF();
gfx::PointF uv_bottom_right_ = gfx::PointF(1.f, 1.f);
// [bottom left, top left, top right, bottom right]
float vertex_opacity_[4] = {1.f, 1.f, 1.f, 1.f};
bool premultiplied_alpha_ = true;
bool blend_background_color_ = false;
bool force_texture_to_opaque_ = false;
......
......@@ -53,7 +53,6 @@ void TextureLayerImpl::PushPropertiesTo(LayerImpl* layer) {
texture_layer->SetFlipped(flipped_);
texture_layer->SetUVTopLeft(uv_top_left_);
texture_layer->SetUVBottomRight(uv_bottom_right_);
texture_layer->SetVertexOpacity(vertex_opacity_);
texture_layer->SetPremultipliedAlpha(premultiplied_alpha_);
texture_layer->SetBlendBackgroundColor(blend_background_color_);
texture_layer->SetForceTextureToOpaque(force_texture_to_opaque_);
......@@ -146,14 +145,11 @@ void TextureLayerImpl::AppendQuads(viz::RenderPass* render_pass,
if (visible_quad_rect.IsEmpty())
return;
if (!vertex_opacity_[0] && !vertex_opacity_[1] && !vertex_opacity_[2] &&
!vertex_opacity_[3])
return;
float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f};
auto* quad = render_pass->CreateAndAppendDrawQuad<viz::TextureDrawQuad>();
quad->SetNew(shared_quad_state, quad_rect, visible_quad_rect, needs_blending,
resource_id_, premultiplied_alpha_, uv_top_left_,
uv_bottom_right_, bg_color, vertex_opacity_, flipped_,
uv_bottom_right_, bg_color, vertex_opacity, flipped_,
nearest_neighbor_, /*secure_output_only=*/false,
gfx::ProtectedVideoType::kClear);
quad->set_resource_size_in_pixels(transferable_resource_.size);
......@@ -232,16 +228,6 @@ void TextureLayerImpl::SetUVBottomRight(const gfx::PointF& bottom_right) {
uv_bottom_right_ = bottom_right;
}
// 1--2
// | |
// 0--3
void TextureLayerImpl::SetVertexOpacity(const float vertex_opacity[4]) {
vertex_opacity_[0] = vertex_opacity[0];
vertex_opacity_[1] = vertex_opacity[1];
vertex_opacity_[2] = vertex_opacity[2];
vertex_opacity_[3] = vertex_opacity[3];
}
void TextureLayerImpl::SetTransferableResource(
const viz::TransferableResource& resource,
std::unique_ptr<viz::SingleReleaseCallback> release_callback) {
......
......@@ -58,11 +58,6 @@ class CC_EXPORT TextureLayerImpl : public LayerImpl {
void SetUVTopLeft(const gfx::PointF& top_left);
void SetUVBottomRight(const gfx::PointF& bottom_right);
// 1--2
// | |
// 0--3
void SetVertexOpacity(const float vertex_opacity[4]);
void SetTransferableResource(
const viz::TransferableResource& resource,
std::unique_ptr<viz::SingleReleaseCallback> release_callback);
......@@ -94,7 +89,6 @@ class CC_EXPORT TextureLayerImpl : public LayerImpl {
bool nearest_neighbor_ = false;
gfx::PointF uv_top_left_ = gfx::PointF();
gfx::PointF uv_bottom_right_ = gfx::PointF(1.f, 1.f);
float vertex_opacity_[4] = {1.f, 1.f, 1.f, 1.f};
// True while the |transferable_resource_| is owned by this layer, and
// becomes false once it is passed to another layer or to the
......
......@@ -214,8 +214,6 @@ TEST_F(TextureLayerTest, CheckPropertyChangeCausesCorrectBehavior) {
EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetNearestNeighbor(true));
EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetUV(
gfx::PointF(0.25f, 0.25f), gfx::PointF(0.75f, 0.75f)));
EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetVertexOpacity(
0.5f, 0.5f, 0.5f, 0.5f));
EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetPremultipliedAlpha(false));
EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetBlendBackgroundColor(true));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment