From 73d8fd90653135bb1247f92ebc1d730a40b4f9d5 Mon Sep 17 00:00:00 2001 From: Stan Iliev Date: Wed, 2 Aug 2017 15:36:24 -0400 Subject: Add a private API for writing the clip to the stencil Add a private API used by Android framework, which writes the clip into a stencil buffer. This is used by HWUI to clip the WebView. Bug: 31489986 Change-Id: I94515f1539acd9d069c8aceb3300577feed9c94f Reviewed-on: https://skia-review.googlesource.com/29521 Commit-Queue: Stan Iliev Reviewed-by: Derek Sollenberger --- include/android/SkAndroidFrameworkUtils.h | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 include/android/SkAndroidFrameworkUtils.h (limited to 'include/android') diff --git a/include/android/SkAndroidFrameworkUtils.h b/include/android/SkAndroidFrameworkUtils.h new file mode 100644 index 0000000000..0457d03534 --- /dev/null +++ b/include/android/SkAndroidFrameworkUtils.h @@ -0,0 +1,38 @@ +/* + * Copyright 2017 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkAndroidFrameworkUtils_DEFINED +#define SkAndroidFrameworkUtils_DEFINED + +#include "SkTypes.h" + +#ifdef SK_BUILD_FOR_ANDROID + +class SkCanvas; + +/** + * SkAndroidFrameworkUtils expose private APIs used only by Android framework. + */ +class SkAndroidFrameworkUtils { +public: + +#if SK_SUPPORT_GPU + /** + * clipWithStencil draws the current clip into a stencil buffer with reference value and mask + * set to 0x1. This function works only on a GPU canvas. + * + * @param canvas A GPU canvas that has a non-empty clip. + * + * @return true on success or false if clip is empty or not a GPU canvas. + */ + static bool clipWithStencil(SkCanvas* canvas); +#endif //SK_SUPPORT_GPU +}; + +#endif // SK_BUILD_FOR_ANDROID + +#endif // SkAndroidFrameworkUtils_DEFINED -- cgit v1.2.3