blob: 9df1c84e16d9e4127c7841fca86bdd782baaf9fe [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;
Derek Sollenberger1958e5d2018-11-27 15:33:38 -050017class SkSurface;
Stan Iliev73d8fd92017-08-02 15:36:24 -040018
19/**
20 * SkAndroidFrameworkUtils expose private APIs used only by Android framework.
21 */
22class SkAndroidFrameworkUtils {
23public:
24
25#if SK_SUPPORT_GPU
26 /**
27 * clipWithStencil draws the current clip into a stencil buffer with reference value and mask
28 * set to 0x1. This function works only on a GPU canvas.
29 *
30 * @param canvas A GPU canvas that has a non-empty clip.
31 *
32 * @return true on success or false if clip is empty or not a GPU canvas.
33 */
34 static bool clipWithStencil(SkCanvas* canvas);
35#endif //SK_SUPPORT_GPU
Leon Scroggins III44764002018-11-13 10:26:34 -050036
37 static void SafetyNetLog(const char*);
Derek Sollenberger1958e5d2018-11-27 15:33:38 -050038
39 static sk_sp<SkSurface> getSurfaceFromCanvas(SkCanvas* canvas);
Stan Iliev73d8fd92017-08-02 15:36:24 -040040};
41
Leon Scroggins III44764002018-11-13 10:26:34 -050042#endif // SK_BUILD_FOR_ANDROID_ANDROID
Stan Iliev73d8fd92017-08-02 15:36:24 -040043
44#endif // SkAndroidFrameworkUtils_DEFINED