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

Unified Diff: components/exo/surface.cc

Issue 2277833004: exo: Avoid creating transparent texture quads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 1e2026c28a34218ae05c622a10ee3b88aa339a48..ab4cf7b60c9256fe7fec22ef40e6c162558a8ad8 100644
--- a/components/exo/surface.cc
+++ b/components/exo/surface.cc
@@ -791,24 +791,27 @@ 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);
+ if (current_resource_.is_overlay_candidate)
+ texture_quad->set_resource_size_in_pixels(current_resource_.size);
+ 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);
- if (current_resource_.is_overlay_candidate)
- texture_quad->set_resource_size_in_pixels(current_resource_.size);
- 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