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

Side by Side Diff: ui/gfx/compositor/layer.cc

Issue 9566036: Expose compositor filters on ui::Layer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: when blur radius is 0, remove the blur filter Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/compositor/layer.h ('k') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/gfx/compositor/layer.h" 5 #include "ui/gfx/compositor/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebContentLa yer.h" 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayer.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebExternalT extureLayer.h" 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureL ayer.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFloatPoin t.h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperation. h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFloatRect .h" 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations .h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSolidColo rLayer.h" 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h"
19 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
20 #include "third_party/WebKit/Source/Platform/chromium/public/WebSolidColorLayer. h"
19 #include "ui/base/animation/animation.h" 21 #include "ui/base/animation/animation.h"
20 #include "ui/gfx/canvas.h" 22 #include "ui/gfx/canvas.h"
21 #include "ui/gfx/compositor/compositor_switches.h" 23 #include "ui/gfx/compositor/compositor_switches.h"
22 #include "ui/gfx/compositor/layer_animator.h" 24 #include "ui/gfx/compositor/layer_animator.h"
23 #include "ui/gfx/interpolated_transform.h" 25 #include "ui/gfx/interpolated_transform.h"
24 #include "ui/gfx/point3.h" 26 #include "ui/gfx/point3.h"
25 27
26 namespace { 28 namespace {
27 29
28 const float EPSILON = 1e-3f; 30 const float EPSILON = 1e-3f;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } 178 }
177 179
178 bool Layer::GetMasksToBounds() const { 180 bool Layer::GetMasksToBounds() const {
179 return web_layer_.masksToBounds(); 181 return web_layer_.masksToBounds();
180 } 182 }
181 183
182 void Layer::SetOpacity(float opacity) { 184 void Layer::SetOpacity(float opacity) {
183 GetAnimator()->SetOpacity(opacity); 185 GetAnimator()->SetOpacity(opacity);
184 } 186 }
185 187
188 void Layer::SetBackgroundBlur(int blur_radius)
189 {
190 WebKit::WebFilterOperations filters;
191 if (blur_radius)
192 filters.append(WebKit::WebBlurFilterOperation(blur_radius));
193 web_layer_.setBackgroundFilters(filters);
194
195 background_blur_radius_ = blur_radius;
196 }
197
186 float Layer::GetTargetOpacity() const { 198 float Layer::GetTargetOpacity() const {
187 if (animator_.get() && animator_->IsAnimatingProperty( 199 if (animator_.get() && animator_->IsAnimatingProperty(
188 LayerAnimationElement::OPACITY)) 200 LayerAnimationElement::OPACITY))
189 return animator_->GetTargetOpacity(); 201 return animator_->GetTargetOpacity();
190 return opacity_; 202 return opacity_;
191 } 203 }
192 204
193 void Layer::SetVisible(bool visible) { 205 void Layer::SetVisible(bool visible) {
194 GetAnimator()->SetVisibility(visible); 206 GetAnimator()->SetVisibility(visible);
195 } 207 }
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 return; 546 return;
535 unsigned int color = 0xFF000000; 547 unsigned int color = 0xFF000000;
536 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; 548 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000;
537 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); 549 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f);
538 if (!opaque) 550 if (!opaque)
539 color |= 0xFF; 551 color |= 0xFF;
540 web_layer_.setDebugBorderColor(color); 552 web_layer_.setDebugBorderColor(color);
541 } 553 }
542 554
543 } // namespace ui 555 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gfx/compositor/layer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698