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

Unified Diff: cc/layer.cc

Issue 11175009: Implement SkImageFilter support in the compositor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated to ToT (past the Great Renaming) Created 8 years, 2 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 | « cc/layer.h ('k') | cc/layer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer.cc
diff --git a/cc/layer.cc b/cc/layer.cc
index c2ea6a7de8daf6ba713eb7a9b1abb8a5310d1138..24955d35b60f13249d93b2b0d852f1e5f1673ef0 100644
--- a/cc/layer.cc
+++ b/cc/layer.cc
@@ -12,6 +12,7 @@
#include "CCLayerImpl.h"
#include "CCLayerTreeHost.h"
#include "cc/settings.h"
+#include "third_party/skia/include/core/SkImageFilter.h"
#include <public/WebAnimationDelegate.h>
#include <public/WebLayerScrollClient.h>
#include <public/WebSize.h>
@@ -44,6 +45,7 @@ Layer::Layer()
, m_debugBorderColor(0)
, m_debugBorderWidth(0)
, m_opacity(1.0)
+ , m_filter(0)
, m_anchorPointZ(0)
, m_isContainerForFixedPositionLayers(false)
, m_fixedToContainerLayer(false)
@@ -81,6 +83,8 @@ Layer::~Layer()
// Remove the parent reference from all children.
removeAllChildren();
+
+ SkSafeUnref(m_filter);
}
void Layer::setUseLCDText(bool useLCDText)
@@ -315,6 +319,7 @@ void Layer::setReplicaLayer(Layer* layer)
void Layer::setFilters(const WebKit::WebFilterOperations& filters)
{
+ DCHECK(!m_filter);
if (m_filters == filters)
return;
m_filters = filters;
@@ -323,6 +328,17 @@ void Layer::setFilters(const WebKit::WebFilterOperations& filters)
LayerTreeHost::setNeedsFilterContext(true);
}
+void Layer::setFilter(SkImageFilter* filter)
+{
+ DCHECK(m_filters.isEmpty());
+ if (m_filter == filter)
+ return;
+ SkRefCnt_SafeAssign(m_filter, filter);
+ setNeedsCommit();
+ if (filter)
+ LayerTreeHost::setNeedsFilterContext(true);
+}
+
void Layer::setBackgroundFilters(const WebKit::WebFilterOperations& backgroundFilters)
{
if (m_backgroundFilters == backgroundFilters)
@@ -544,6 +560,7 @@ void Layer::pushPropertiesTo(LayerImpl* layer)
layer->setForceRenderSurface(m_forceRenderSurface);
layer->setDrawsContent(drawsContent());
layer->setFilters(filters());
+ layer->setFilter(filter());
layer->setBackgroundFilters(backgroundFilters());
layer->setUseLCDText(m_useLCDText);
layer->setMasksToBounds(m_masksToBounds);
« no previous file with comments | « cc/layer.h ('k') | cc/layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698