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..e11ee37b3ea81f86addb624a1cd5526d8e0610f3 |
--- /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 |
+// 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: |
+ float opacity_; |
tomhudson
2013/08/28 14:55:18
Why not store SkScalarRound(opacity_*255), instead
aelias_OOO_until_Jul13
2013/08/28 18:50:35
Done.
|
+ float disable_image_filtering_; |
tomhudson
2013/08/28 14:55:18
bool?!
aelias_OOO_until_Jul13
2013/08/28 18:50:35
Oops, thanks for catching that.
|
+}; |
+ |
+} // namespace skia |
+ |
+#endif // SKIA_EXT_OPACITY_DRAW_FILTER_H |
+ |