/src/skia/tools/DecodeUtils.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright 2023 Google LLC |
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 DecodeUtils_DEFINED |
9 | | #define DecodeUtils_DEFINED |
10 | | |
11 | | #include "include/core/SkImage.h" |
12 | | #include "include/core/SkRefCnt.h" |
13 | | #include "tools/Resources.h" |
14 | | |
15 | | class SkBitmap; |
16 | | class SkData; |
17 | | |
18 | | namespace ToolUtils { |
19 | | bool DecodeDataToBitmap(sk_sp<SkData> data, SkBitmap* dst); |
20 | | |
21 | 0 | inline bool GetResourceAsBitmap(const char* resource, SkBitmap* dst) { |
22 | 0 | return DecodeDataToBitmap(GetResourceAsData(resource), dst); |
23 | 0 | } |
24 | | |
25 | 0 | inline sk_sp<SkImage> GetResourceAsImage(const char* resource) { |
26 | 0 | return SkImages::DeferredFromEncodedData(GetResourceAsData(resource)); |
27 | 0 | } |
28 | | |
29 | | } // namespace ToolUtils |
30 | | |
31 | | #endif |