Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / src / utils / SkShaderUtils.h
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/core/SkTypes.h"
12 #include "include/private/SkSLProgramKind.h"
13
14 #include <functional>
15 #include <string>
16
17 namespace SkShaderUtils {
18
19 std::string PrettyPrint(const std::string& string);
20
21 void VisitLineByLine(const std::string& text,
22                      const std::function<void(int lineNumber, const char* lineText)>&);
23
24 // Prints shaders one line at the time. This ensures they don't get truncated by the adb log.
25 inline void PrintLineByLine(const std::string& text) {
26     VisitLineByLine(text, [](int lineNumber, const char* lineText) {
27         SkDebugf("%4i\t%s\n", lineNumber, lineText);
28     });
29 }
30
31 // Combines raw shader and error text into an easier-to-read error message with line numbers.
32 std::string BuildShaderErrorMessage(const char* shader, const char* errors);
33
34 void PrintShaderBanner(SkSL::ProgramKind programKind);
35
36 }  // namespace SkShaderUtils
37
38 #endif