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

Unified Diff: components/exo/surface.cc

Issue 2293223002: exo: Avoid creating transparent texture quads. (Closed)
Patch Set: Created 4 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/surface.cc
diff --git a/components/exo/surface.cc b/components/exo/surface.cc
index 0822a3d17dfa41f49d67446fe4f87706f559bf36..e2f81215bb6d238a07db03b1110a946f2bdc1a0f 100644
--- a/components/exo/surface.cc
+++ b/components/exo/surface.cc
@@ -784,22 +784,25 @@ void Surface::UpdateSurface(bool full_damage) {
std::unique_ptr<cc::DelegatedFrameData> delegated_frame(
new cc::DelegatedFrameData);
if (current_resource_.id) {
- cc::TextureDrawQuad* texture_quad =
- render_pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>();
- float vertex_opacity[4] = {1.0, 1.0, 1.0, 1.0};
- gfx::Rect opaque_rect;
- if (state_.blend_mode == SkXfermode::kSrc_Mode ||
- state_.opaque_region.contains(gfx::RectToSkIRect(quad_rect))) {
- opaque_rect = quad_rect;
- } else if (state_.opaque_region.isRect()) {
- opaque_rect = gfx::SkIRectToRect(state_.opaque_region.getBounds());
+ // Texture quad is only needed if buffer is not fully transparent.
+ if (state_.alpha) {
+ cc::TextureDrawQuad* texture_quad =
+ render_pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>();
+ float vertex_opacity[4] = {1.0, 1.0, 1.0, 1.0};
+ gfx::Rect opaque_rect;
+ if (state_.blend_mode == SkXfermode::kSrc_Mode ||
+ state_.opaque_region.contains(gfx::RectToSkIRect(quad_rect))) {
+ opaque_rect = quad_rect;
+ } else if (state_.opaque_region.isRect()) {
+ opaque_rect = gfx::SkIRectToRect(state_.opaque_region.getBounds());
+ }
+
+ texture_quad->SetNew(quad_state, quad_rect, opaque_rect, quad_rect,
+ current_resource_.id, true, uv_top_left,
+ uv_bottom_right, SK_ColorTRANSPARENT, vertex_opacity,
+ false, false, state_.only_visible_on_secure_output);
+ delegated_frame->resource_list.push_back(current_resource_);
}
-
- texture_quad->SetNew(quad_state, quad_rect, opaque_rect, quad_rect,
- current_resource_.id, true, uv_top_left,
- uv_bottom_right, SK_ColorTRANSPARENT, vertex_opacity,
- false, false, state_.only_visible_on_secure_output);
- delegated_frame->resource_list.push_back(current_resource_);
} else {
cc::SolidColorDrawQuad* solid_quad =
render_pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698