Stan Iliev | 73d8fd9 | 2017-08-02 15:36:24 -0400 | [diff] [blame] | 1 | /* |
| 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 Sollenberger | 1958e5d | 2018-11-27 15:33:38 -0500 | [diff] [blame] | 12 | #include "SkRefCnt.h" |
Stan Iliev | 73d8fd9 | 2017-08-02 15:36:24 -0400 | [diff] [blame] | 13 | |
Leon Scroggins III | 4476400 | 2018-11-13 10:26:34 -0500 | [diff] [blame] | 14 | #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
Stan Iliev | 73d8fd9 | 2017-08-02 15:36:24 -0400 | [diff] [blame] | 15 | |
| 16 | class SkCanvas; |
Derek Sollenberger | 1958e5d | 2018-11-27 15:33:38 -0500 | [diff] [blame] | 17 | class SkSurface; |
Stan Iliev | 73d8fd9 | 2017-08-02 15:36:24 -0400 | [diff] [blame] | 18 | |
| 19 | /** |
| 20 | * SkAndroidFrameworkUtils expose private APIs used only by Android framework. |
| 21 | */ |
| 22 | class SkAndroidFrameworkUtils { |
| 23 | public: |
| 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 III | 4476400 | 2018-11-13 10:26:34 -0500 | [diff] [blame] | 36 | |
| 37 | static void SafetyNetLog(const char*); |
Derek Sollenberger | 1958e5d | 2018-11-27 15:33:38 -0500 | [diff] [blame] | 38 | |
| 39 | static sk_sp<SkSurface> getSurfaceFromCanvas(SkCanvas* canvas); |
Stan Iliev | 73d8fd9 | 2017-08-02 15:36:24 -0400 | [diff] [blame] | 40 | }; |
| 41 | |
Leon Scroggins III | 4476400 | 2018-11-13 10:26:34 -0500 | [diff] [blame] | 42 | #endif // SK_BUILD_FOR_ANDROID_ANDROID |
Stan Iliev | 73d8fd9 | 2017-08-02 15:36:24 -0400 | [diff] [blame] | 43 | |
| 44 | #endif // SkAndroidFrameworkUtils_DEFINED |