blob: 450e3784e5c41760c2b71e13979099d352d1ad48 [file] [log] [blame]
// Copyright 2015 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.
#include "third_party/skia/include/utils/SkPaintFilterCanvas.h"
namespace skia {
// This filter canvas allows setting an opacity on every draw call to a canvas,
// and to disable image filtering. Note that the opacity setting is only
// correct in very limited conditions: when there is only zero or one opaque,
// nonlayer draw for every pixel in the surface.
class SK_API OpacityFilterCanvas : public SkPaintFilterCanvas {
OpacityFilterCanvas(SkCanvas* canvas,
float opacity,
bool disable_image_filtering);
bool onFilter(SkTCopyOnFirstWrite<SkPaint>* paint, Type type) const override;
void onDrawPicture(const SkPicture* picture,
const SkMatrix* matrix,
const SkPaint* paint) override;
typedef SkPaintFilterCanvas INHERITED;
int alpha_;
bool disable_image_filtering_;
} // namespace skia