Commit 48f2d921 authored by Bo Liu's avatar Bo Liu Committed by Commit Bot

android: Avoid render pass in browser compositor

Setting opacity on a layer with children that draws leads to using a
render pass, which is super expensive. Use the usual trick of setting
opacity on the leaf layers directly instead.

Change-Id: If394f0bba0953b9c6b951d2f320b358fe16c8acb
Reviewed-on: https://chromium-review.googlesource.com/1238566Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Bo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593556}
parent 6254e556
......@@ -489,7 +489,7 @@ void TabLayer::SetProperties(int id,
transform.Translate(toolbar_position.x(), toolbar_position.y());
toolbar_layer_->layer()->SetTransformOrigin(gfx::Point3F(0.f, 0.f, 0.f));
toolbar_layer_->layer()->SetTransform(transform);
toolbar_layer_->layer()->SetOpacity(toolbar_alpha);
toolbar_layer_->SetOpacity(toolbar_alpha);
toolbar_layer_->layer()->SetMasksToBounds(
toolbar_layer_->layer()->bounds() != toolbar_size);
......
......@@ -157,6 +157,14 @@ void ToolbarLayer::UpdateProgressBar(int progress_bar_x,
}
}
void ToolbarLayer::SetOpacity(float opacity) {
toolbar_background_layer_->SetOpacity(opacity);
url_bar_background_layer_->SetOpacity(opacity);
bitmap_layer_->SetOpacity(opacity);
progress_bar_layer_->SetOpacity(opacity);
progress_bar_background_layer_->SetOpacity(opacity);
}
ToolbarLayer::ToolbarLayer(ui::ResourceManager* resource_manager)
: resource_manager_(resource_manager),
layer_(cc::Layer::Create()),
......
......@@ -51,6 +51,8 @@ class ToolbarLayer : public Layer {
int progress_bar_background_height,
int progress_bar_background_color);
void SetOpacity(float opacity);
protected:
explicit ToolbarLayer(ui::ResourceManager* resource_manager);
~ToolbarLayer() override;
......
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