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