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"
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
{
18 OpacityFilterCanvas(SkCanvas
* canvas
,
20 bool disable_image_filtering
);
23 void onFilterPaint(SkPaint
* paint
, Type type
) const override
;
25 void onDrawPicture(const SkPicture
* picture
,
26 const SkMatrix
* matrix
,
27 const SkPaint
* paint
) override
;
30 typedef SkPaintFilterCanvas INHERITED
;
33 bool disable_image_filtering_
;
38 #endif // SKIA_EXT_OPACITY_FILTER_CANVAS_H