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

Side by Side Diff: content/browser/android/edge_effect.cc

Issue 319183011: [Android] Use SetTransformOrigin for glow-effect layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/android/edge_effect.h" 5 #include "content/browser/android/edge_effect.h"
6 6
7 #include "cc/layers/layer.h" 7 #include "cc/layers/layer.h"
8 8
9 namespace content { 9 namespace content {
10 10
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 126 }
127 127
128 void UpdateLayer(cc::Layer* layer, 128 void UpdateLayer(cc::Layer* layer,
129 EdgeEffect::Edge edge, 129 EdgeEffect::Edge edge,
130 const gfx::SizeF& window_size, 130 const gfx::SizeF& window_size,
131 int offset, 131 int offset,
132 int height, 132 int height,
133 float opacity) { 133 float opacity) {
134 DCHECK(layer); 134 DCHECK(layer);
135 layer->SetIsDrawable(true); 135 layer->SetIsDrawable(true);
136 gfx::Size bounds = ComputeBounds(edge, window_size, height);
137 layer->SetTransformOrigin(
138 gfx::Point3F(bounds.width() * 0.5f, bounds.height() * 0.5f, 0));
136 layer->SetTransform(ComputeTransform(edge, window_size, offset, height)); 139 layer->SetTransform(ComputeTransform(edge, window_size, offset, height));
137 layer->SetBounds(ComputeBounds(edge, window_size, height)); 140 layer->SetBounds(bounds);
138 layer->SetOpacity(Clamp(opacity, 0.f, 1.f)); 141 layer->SetOpacity(Clamp(opacity, 0.f, 1.f));
139 } 142 }
140 143
141 } // namespace 144 } // namespace
142 145
143 EdgeEffect::EdgeEffect(scoped_refptr<cc::Layer> edge, 146 EdgeEffect::EdgeEffect(scoped_refptr<cc::Layer> edge,
144 scoped_refptr<cc::Layer> glow) 147 scoped_refptr<cc::Layer> glow)
145 : edge_(edge) 148 : edge_(edge)
146 , glow_(glow) 149 , glow_(glow)
147 , edge_alpha_(0) 150 , edge_alpha_(0)
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 UpdateLayer( 371 UpdateLayer(
369 glow_.get(), edge, window_size, offset, scaled_glow_height, glow_alpha_); 372 glow_.get(), edge, window_size, offset, scaled_glow_height, glow_alpha_);
370 373
371 // Edge 374 // Edge
372 const int scaled_edge_height = static_cast<int>(edge_height * edge_scale_y_); 375 const int scaled_edge_height = static_cast<int>(edge_height * edge_scale_y_);
373 UpdateLayer( 376 UpdateLayer(
374 edge_.get(), edge, window_size, offset, scaled_edge_height, edge_alpha_); 377 edge_.get(), edge, window_size, offset, scaled_edge_height, edge_alpha_);
375 } 378 }
376 379
377 } // namespace content 380 } // namespace content
OLDNEW
« 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