blob: 67b849237c72b305bc31663c6288a41d5e1ca136 [file] [log] [blame]
Stan Iliev73d8fd92017-08-02 15:36:24 -04001/*
2 * Copyright 2017 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkAndroidFrameworkUtils_DEFINED
9#define SkAndroidFrameworkUtils_DEFINED
10
11#include "SkTypes.h"
Derek Sollenberger1958e5d2018-11-27 15:33:38 -050012#include "SkRefCnt.h"
Stan Iliev73d8fd92017-08-02 15:36:24 -040013
Leon Scroggins III44764002018-11-13 10:26:34 -050014#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
Stan Iliev73d8fd92017-08-02 15:36:24 -040015
16class SkCanvas;
Mike Reed148b7fd2018-12-18 17:38:18 -050017struct SkRect;
Derek Sollenberger1958e5d2018-11-27 15:33:38 -050018class SkSurface;
Stan Iliev73d8fd92017-08-02 15:36:24 -040019
20/**
21 * SkAndroidFrameworkUtils expose private APIs used only by Android framework.
22 */
23class SkAndroidFrameworkUtils {
24public:
25
26#if SK_SUPPORT_GPU
27 /**
28 * clipWithStencil draws the current clip into a stencil buffer with reference value and mask
29 * set to 0x1. This function works only on a GPU canvas.
30 *
31 * @param canvas A GPU canvas that has a non-empty clip.
32 *
33 * @return true on success or false if clip is empty or not a GPU canvas.
34 */
35 static bool clipWithStencil(SkCanvas* canvas);
36#endif //SK_SUPPORT_GPU
Leon Scroggins III44764002018-11-13 10:26:34 -050037
38 static void SafetyNetLog(const char*);
Derek Sollenberger1958e5d2018-11-27 15:33:38 -050039
40 static sk_sp<SkSurface> getSurfaceFromCanvas(SkCanvas* canvas);
Mike Reed148b7fd2018-12-18 17:38:18 -050041
42 static int SaveBehind(SkCanvas* canvas, const SkRect* subset);
Stan Iliev73d8fd92017-08-02 15:36:24 -040043};
44
Leon Scroggins III44764002018-11-13 10:26:34 -050045#endif // SK_BUILD_FOR_ANDROID_ANDROID
Stan Iliev73d8fd92017-08-02 15:36:24 -040046
47#endif // SkAndroidFrameworkUtils_DEFINED