John Reck | e170fb6 | 2018-05-07 08:12:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #pragma once |
| 18 | |
| 19 | #include <hwui/Bitmap.h> |
Kevin Lubick | 1175dc0 | 2022-02-28 12:41:27 -0500 | [diff] [blame] | 20 | #include <SkRefCnt.h> |
| 21 | |
| 22 | class SkBitmap; |
John Reck | e170fb6 | 2018-05-07 08:12:07 -0700 | [diff] [blame] | 23 | |
| 24 | namespace android::uirenderer { |
| 25 | |
Derek Sollenberger | 3fedf5a | 2020-02-21 13:07:28 -0500 | [diff] [blame] | 26 | class HardwareBitmapUploader { |
John Reck | e170fb6 | 2018-05-07 08:12:07 -0700 | [diff] [blame] | 27 | public: |
Greg Daniel | c073252 | 2019-02-20 08:31:03 -0500 | [diff] [blame] | 28 | static void initialize(); |
John Reck | 6104cea | 2019-01-10 14:37:17 -0800 | [diff] [blame] | 29 | static void terminate(); |
Leon Scroggins III | ee3bfe7 | 2019-01-31 08:42:23 -0500 | [diff] [blame] | 30 | |
Greg Daniel | c073252 | 2019-02-20 08:31:03 -0500 | [diff] [blame] | 31 | static sk_sp<Bitmap> allocateHardwareBitmap(const SkBitmap& sourceBitmap); |
| 32 | |
Jerome Gaillard | 21e7e2d | 2019-05-14 14:34:46 +0100 | [diff] [blame] | 33 | #ifdef __ANDROID__ |
Leon Scroggins III | ee3bfe7 | 2019-01-31 08:42:23 -0500 | [diff] [blame] | 34 | static bool hasFP16Support(); |
Alec Mouri | 1efd0a5 | 2022-01-20 13:58:23 -0800 | [diff] [blame] | 35 | static bool has1010102Support(); |
Greg Daniel | e77ab7a | 2024-09-04 15:29:52 +0000 | [diff] [blame] | 36 | static bool has10101010Support(); |
Leon Scroggins III | a008aa9 | 2022-03-10 16:25:30 -0500 | [diff] [blame] | 37 | static bool hasAlpha8Support(); |
Jerome Gaillard | 21e7e2d | 2019-05-14 14:34:46 +0100 | [diff] [blame] | 38 | #else |
| 39 | static bool hasFP16Support() { |
| 40 | return true; |
| 41 | } |
Alec Mouri | 1efd0a5 | 2022-01-20 13:58:23 -0800 | [diff] [blame] | 42 | static bool has1010102Support() { return true; } |
Greg Daniel | e77ab7a | 2024-09-04 15:29:52 +0000 | [diff] [blame] | 43 | static bool has10101010Support() { return true; } |
Leon Scroggins III | a008aa9 | 2022-03-10 16:25:30 -0500 | [diff] [blame] | 44 | static bool hasAlpha8Support() { return true; } |
Jerome Gaillard | 21e7e2d | 2019-05-14 14:34:46 +0100 | [diff] [blame] | 45 | #endif |
John Reck | e170fb6 | 2018-05-07 08:12:07 -0700 | [diff] [blame] | 46 | }; |
| 47 | |
Chris Blume | 7b8a808 | 2018-11-30 15:51:58 -0800 | [diff] [blame] | 48 | } // namespace android::uirenderer |