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

Unified Diff: src/effects/SkComposeImageFilter.cpp

Issue 22438003: Move SkComposeImageFilter into its own {.h, .cpp} files (Closed) Base URL: http://skia.googlecode.com/svn/trunk
Patch Set: Fix nit Created 7 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 | « include/effects/SkTestImageFilters.h ('k') | src/effects/SkTestImageFilters.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkComposeImageFilter.cpp
diff --git a/src/effects/SkComposeImageFilter.cpp b/src/effects/SkComposeImageFilter.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2ba2f3df276d1004c269a5584e69ca7098e20aa7
--- /dev/null
+++ b/src/effects/SkComposeImageFilter.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkBitmap.h"
+#include "SkComposeImageFilter.h"
+#include "SkFlattenableBuffers.h"
+
+SkComposeImageFilter::~SkComposeImageFilter() {
+}
+
+bool SkComposeImageFilter::onFilterImage(Proxy* proxy,
+ const SkBitmap& src,
+ const SkMatrix& ctm,
+ SkBitmap* result,
+ SkIPoint* loc) {
+ SkImageFilter* outer = getInput(0);
+ SkImageFilter* inner = getInput(1);
+
+ if (!outer && !inner) {
+ return false;
+ }
+
+ if (!outer || !inner) {
+ return (outer ? outer : inner)->filterImage(proxy, src, ctm, result, loc);
+ }
+
+ SkBitmap tmp;
+ return inner->filterImage(proxy, src, ctm, &tmp, loc) &&
+ outer->filterImage(proxy, tmp, ctm, result, loc);
+}
+
+bool SkComposeImageFilter::onFilterBounds(const SkIRect& src,
+ const SkMatrix& ctm,
+ SkIRect* dst) {
+ SkImageFilter* outer = getInput(0);
+ SkImageFilter* inner = getInput(1);
+
+ if (!outer && !inner) {
+ return false;
+ }
+
+ if (!outer || !inner) {
+ return (outer ? outer : inner)->filterBounds(src, ctm, dst);
+ }
+
+ SkIRect tmp;
+ return inner->filterBounds(src, ctm, &tmp) &&
+ outer->filterBounds(tmp, ctm, dst);
+}
+
+SkComposeImageFilter::SkComposeImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {
+}
« no previous file with comments | « include/effects/SkTestImageFilters.h ('k') | src/effects/SkTestImageFilters.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698