summaryrefslogtreecommitdiff
path: root/chromium/components/viz/common/skia_helper.h
blob: dc351b7bfc262cf01fff88e0110b91c920df8d82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) 2018 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 COMPONENTS_VIZ_COMMON_SKIA_HELPER_H_
#define COMPONENTS_VIZ_COMMON_SKIA_HELPER_H_

#include "components/viz/common/viz_common_export.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkImageFilter.h"
#include "third_party/skia/include/core/SkPoint.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/vector2d_f.h"

namespace viz {
class VIZ_COMMON_EXPORT SkiaHelper {
 public:
  // |flush| is necessary for GLRenderer but not SkiaRenderer.
  static sk_sp<SkImage> ApplyImageFilter(GrContext* context,
                                         sk_sp<SkImage> src_image,
                                         const gfx::RectF& src_rect,
                                         const gfx::RectF& dst_rect,
                                         const gfx::Vector2dF& scale,
                                         sk_sp<SkImageFilter> filter,
                                         SkIPoint* offset,
                                         SkIRect* subset,
                                         const gfx::PointF& origin,
                                         bool flush);

  static sk_sp<SkColorFilter> MakeOverdrawColorFilter();

  static sk_sp<SkImageFilter> BuildOpacityFilter(float opacity);
};

}  // namespace viz

#endif  // COMPONENTS_VIZ_COMMON_SKIA_HELPER_H_