diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-06 15:42:12 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-06 15:42:12 +0000 |
commit | b7e98032420cd6308bd4b47b824a792f653a1deb (patch) | |
tree | 8610e98a5339ed7450030c8dea06856886514f5e /ui/gfx/compositor | |
parent | 0da828d0ba0aef8b8b11531919f01b002e326858 (diff) | |
download | chromium_src-b7e98032420cd6308bd4b47b824a792f653a1deb.zip chromium_src-b7e98032420cd6308bd4b47b824a792f653a1deb.tar.gz chromium_src-b7e98032420cd6308bd4b47b824a792f653a1deb.tar.bz2 |
Adds View::OnWillCompositeTexture that is invoked before a texture is
drawn by the compositor and Compositor::Blur to blur a region. If you
want to blur a region, then you have to override
OnWillCompositeTexture and invoke Blur.
I considered adding an Effect enum that allows you to set BLUR on any
view. I shied away from that as we may need blur to take a region, and
I wasn't too happy about adding more to view. I can easily change it
though.
BUG=none
TEST=none
R=ben@chromium.org,wjmaclean@chromium.org
Review URL: http://codereview.chromium.org/7056046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87989 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/compositor')
-rw-r--r-- | ui/gfx/compositor/compositor.h | 7 | ||||
-rw-r--r-- | ui/gfx/compositor/compositor_gl.cc | 5 | ||||
-rw-r--r-- | ui/gfx/compositor/compositor_win.cc | 6 |
3 files changed, 18 insertions, 0 deletions
diff --git a/ui/gfx/compositor/compositor.h b/ui/gfx/compositor/compositor.h index 9b35eb1..12b2e68 100644 --- a/ui/gfx/compositor/compositor.h +++ b/ui/gfx/compositor/compositor.h @@ -12,6 +12,7 @@ class SkBitmap; namespace gfx { class Point; +class Rect; class Size; } @@ -21,6 +22,9 @@ class Transform; #if !defined(COMPOSITOR_2) typedef unsigned int TextureID; +// NOTE: all coordinates passed to Texture/Compositor have 0x0 as the upper left +// corner. + // Compositor object to take care of GPU painting. // A Browser compositor object is responsible for generating the final // displayable form of pixels comprising a single widget's contents. It draws an @@ -97,6 +101,9 @@ class Compositor : public base::RefCounted<Compositor> { // Notifies the compositor that compositing is complete. virtual void NotifyEnd() = 0; + // Blurs the specific region in the compositor. + virtual void Blur(const gfx::Rect& bounds) = 0; + protected: virtual ~Compositor() {} diff --git a/ui/gfx/compositor/compositor_gl.cc b/ui/gfx/compositor/compositor_gl.cc index 7e6e297..794d836 100644 --- a/ui/gfx/compositor/compositor_gl.cc +++ b/ui/gfx/compositor/compositor_gl.cc @@ -66,6 +66,7 @@ class CompositorGL : public Compositor { virtual Texture* CreateTexture() OVERRIDE; virtual void NotifyStart() OVERRIDE; virtual void NotifyEnd() OVERRIDE; + virtual void Blur(const gfx::Rect& bounds) OVERRIDE; // Specific to CompositorGL. bool InitShaders(); @@ -272,6 +273,10 @@ void CompositorGL::NotifyEnd() { started_ = false; } +void CompositorGL::Blur(const gfx::Rect& bounds) { + NOTIMPLEMENTED(); +} + namespace { GLuint CompileShader(GLenum type, const GLchar* source) { diff --git a/ui/gfx/compositor/compositor_win.cc b/ui/gfx/compositor/compositor_win.cc index 67be3a6..a56f14b 100644 --- a/ui/gfx/compositor/compositor_win.cc +++ b/ui/gfx/compositor/compositor_win.cc @@ -9,6 +9,7 @@ #include <vector> #include "base/compiler_specific.h" +#include "base/logging.h" #include "base/stl_util-inl.h" #include "base/string_piece.h" #include "base/win/scoped_comptr.h" @@ -272,6 +273,7 @@ class CompositorWin : public Compositor, public ViewTextureHost { virtual Texture* CreateTexture() OVERRIDE; virtual void NotifyStart() OVERRIDE; virtual void NotifyEnd() OVERRIDE; + virtual void Blur(const gfx::Rect& bounds) OVERRIDE; private: ~CompositorWin(); @@ -407,6 +409,10 @@ void CompositorWin::NotifyEnd() { technique_->GetPassByIndex(i)->Apply(0); } +void CompositorWin::Blur(const gfx::Rect& bounds) { + NOTIMPLEMENTED(); +} + CompositorWin::~CompositorWin() { } |