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

Unified Diff: skia/ext/opacity_draw_filter.h

Issue 22867046: Optimize alpha software PictureDrawQuads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tomhudson@'s code review comments 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
Index: skia/ext/opacity_draw_filter.h
diff --git a/skia/ext/opacity_draw_filter.h b/skia/ext/opacity_draw_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..937e4b9bb6ed0b1dd2597f197b1d3d5d77700f85
--- /dev/null
+++ b/skia/ext/opacity_draw_filter.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SKIA_EXT_OPACITY_DRAW_FILTER_H
+#define SKIA_EXT_OPACITY_DRAW_FILTER_H
+
+#include "base/values.h"
+#include "third_party/skia/include/core/SkDrawFilter.h"
+
+class SkPaint;
+
+namespace skia {
+
+// This filter allows setting an opacity on every draw call to a canvas, and to
+// disable image filtering. Note that setting opacity with this is only correct
+// when there are no overlapping draw calls (as this doesn't allocate a bitmap
enne (OOO) 2013/08/28 20:08:42 It's also only correct when draw calls are all opa
aelias_OOO_until_Jul13 2013/08/28 20:23:00 I made the comment clearer.
+// to collapse them together before blending the result against the
+// backbuffer).
+class SK_API OpacityDrawFilter : public SkDrawFilter {
+ public:
+ OpacityDrawFilter(float opacity, bool disable_image_filtering);
+ virtual ~OpacityDrawFilter();
+ virtual bool filter(SkPaint* paint, SkDrawFilter::Type type) OVERRIDE;
+
+ private:
+ int alpha_;
+ bool disable_image_filtering_;
+};
+
+} // namespace skia
+
+#endif // SKIA_EXT_OPACITY_DRAW_FILTER_H
+

Powered by Google App Engine
This is Rietveld 408576698