Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef SKIA_EXT_OPACITY_DRAW_FILTER_H | |
| 6 #define SKIA_EXT_OPACITY_DRAW_FILTER_H | |
| 7 | |
| 8 #include "base/values.h" | |
| 9 #include "third_party/skia/include/core/SkDrawFilter.h" | |
| 10 | |
| 11 class SkPaint; | |
| 12 | |
| 13 namespace skia { | |
| 14 | |
| 15 // This filter allows setting an opacity on every draw call to a canvas, and to | |
| 16 // disable image filtering. Note that setting opacity with this is only correct | |
| 17 // 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.
| |
| 18 // to collapse them together before blending the result against the | |
| 19 // backbuffer). | |
| 20 class SK_API OpacityDrawFilter : public SkDrawFilter { | |
| 21 public: | |
| 22 OpacityDrawFilter(float opacity, bool disable_image_filtering); | |
| 23 virtual ~OpacityDrawFilter(); | |
| 24 virtual bool filter(SkPaint* paint, SkDrawFilter::Type type) OVERRIDE; | |
| 25 | |
| 26 private: | |
| 27 int alpha_; | |
| 28 bool disable_image_filtering_; | |
| 29 }; | |
| 30 | |
| 31 } // namespace skia | |
| 32 | |
| 33 #endif // SKIA_EXT_OPACITY_DRAW_FILTER_H | |
| 34 | |
| OLD | NEW |