/src/skia/src/utils/SkShaderUtils.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright 2019 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 SkShaderUtils_DEFINED |
9 | | #define SkShaderUtils_DEFINED |
10 | | |
11 | | #include "include/private/base/SkDebug.h" |
12 | | |
13 | | #include <cstdint> |
14 | | #include <functional> |
15 | | #include <string> |
16 | | |
17 | | namespace SkSL { enum class ProgramKind : int8_t; } |
18 | | |
19 | | namespace SkShaderUtils { |
20 | | |
21 | | std::string PrettyPrint(const std::string& string); |
22 | | |
23 | | void VisitLineByLine(const std::string& text, |
24 | | const std::function<void(int lineNumber, const char* lineText)>&); |
25 | | |
26 | | // Prints shaders one line at the time. This ensures they don't get truncated by the adb log. |
27 | 0 | inline void PrintLineByLine(const std::string& text) { |
28 | 0 | VisitLineByLine(text, [](int lineNumber, const char* lineText) { |
29 | 0 | SkDebugf("%4i\t%s\n", lineNumber, lineText); |
30 | 0 | }); |
31 | 0 | } |
32 | | |
33 | | // Combines raw shader and error text into an easier-to-read error message with line numbers. |
34 | | std::string BuildShaderErrorMessage(const char* shader, const char* errors); |
35 | | |
36 | | void PrintShaderBanner(SkSL::ProgramKind programKind); |
37 | | |
38 | | } // namespace SkShaderUtils |
39 | | |
40 | | #endif |