Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / skia / ext / opacity_filter_canvas.h
blobee3eca6e1d6d059c39b563e6eeea337a7064c8a8
1 // Copyright 2015 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.
5 #ifndef SKIA_EXT_OPACITY_FILTER_CANVAS_H
6 #define SKIA_EXT_OPACITY_FILTER_CANVAS_H
8 #include "third_party/skia/include/utils/SkPaintFilterCanvas.h"
10 namespace skia {
12 // This filter canvas allows setting an opacity on every draw call to a canvas,
13 // and to disable image filtering. Note that the opacity setting is only
14 // correct in very limited conditions: when there is only zero or one opaque,
15 // nonlayer draw for every pixel in the surface.
16 class SK_API OpacityFilterCanvas : public SkPaintFilterCanvas {
17 public:
18 OpacityFilterCanvas(SkCanvas* canvas,
19 float opacity,
20 bool disable_image_filtering);
22 protected:
23 void onFilterPaint(SkPaint* paint, Type type) const override;
25 void onDrawPicture(const SkPicture* picture,
26 const SkMatrix* matrix,
27 const SkPaint* paint) override;
29 private:
30 typedef SkPaintFilterCanvas INHERITED;
32 int alpha_;
33 bool disable_image_filtering_;
36 } // namespace skia
38 #endif // SKIA_EXT_OPACITY_FILTER_CANVAS_H