diff options
author | 2016-11-20 14:53:35 +0000 | |
---|---|---|
committer | 2016-11-20 14:53:48 +0000 | |
commit | 792d0f13d6cb58ddf27b45e6835ba54c1d8ade77 (patch) | |
tree | 929ba3d4638561e480bb070da4d01eec2cce21ab /src/gpu/gl | |
parent | 7a5b48a75b6f5819c196d158eefa70677783554f (diff) |
Revert "switched skslc from std::string to SkString"
This reverts commit d8df21a1e08b5b3380261f4b90acfbdc538ef93c.
Reason for revert: Breaking Roll
Original change's description:
> switched skslc from std::string to SkString
>
> BUG=skia:
>
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4977
>
> Change-Id: I15e24963b09b719a2c07da67745114f5ac66cee8
> Reviewed-on: https://skia-review.googlesource.com/4977
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
>
TBR=bsalomon@google.com,benjaminwagner@google.com,ethannicholas@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: I84d5311beb9d5e607b7a4a3c138332f0c8f19648
Reviewed-on: https://skia-review.googlesource.com/5077
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/gl')
-rw-r--r-- | src/gpu/gl/builders/GrGLShaderStringBuilder.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp b/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp index 86df089d82..1e42259128 100644 --- a/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp +++ b/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp @@ -21,19 +21,18 @@ static const bool c_PrintShaders{false}; static void print_shader_source(const char** strings, int* lengths, int count); -static void dump_string(SkString s) { +static void dump_string(std::string s) { // on Android, SkDebugf only displays the first 1K characters of output, which results in // incomplete shader source code. Print each line individually to avoid this problem. - const char* chars = s.c_str(); + size_t index = 0; for (;;) { - const char* next = strchr(chars, '\n'); - if (next) { - next++; - SkDebugf("%s", SkString(chars, next - chars).c_str()); - chars = next; - } else { - SkDebugf("%s", chars); + size_t next = s.find("\n", index); + if (next == std::string::npos) { + SkDebugf("%s", s.substr(index).c_str()); break; + } else { + SkDebugf("%s", s.substr(index, next - index + 1).c_str()); + index = next + 1; } } } @@ -53,22 +52,23 @@ GrGLuint GrGLCompileAndAttachShader(const GrGLContext& glCtx, return 0; } - SkString sksl; + std::string sksl; #ifdef SK_DEBUG - sksl = GrGLSLPrettyPrint::PrettyPrintGLSL(strings, lengths, count, false); + SkString prettySource = GrGLSLPrettyPrint::PrettyPrintGLSL(strings, lengths, count, false); + sksl = std::string(prettySource.c_str()); #else for (int i = 0; i < count; i++) { sksl.append(strings[i], lengths[i]); } #endif - SkString glsl; + std::string glsl; SkSL::Compiler& compiler = *glCtx.compiler(); SkASSERT(type == GR_GL_VERTEX_SHADER || type == GR_GL_FRAGMENT_SHADER); SkDEBUGCODE(bool result = )compiler.toGLSL(type == GR_GL_VERTEX_SHADER ? SkSL::Program::kVertex_Kind : SkSL::Program::kFragment_Kind, - sksl, + std::string(sksl.c_str()), *glCtx.caps()->glslCaps(), &glsl); #ifdef SK_DEBUG @@ -82,7 +82,7 @@ GrGLuint GrGLCompileAndAttachShader(const GrGLContext& glCtx, #endif const char* glslChars = glsl.c_str(); - GrGLint glslLength = (GrGLint) glsl.size(); + GrGLint glslLength = (GrGLint) glsl.length(); GR_GL_CALL(gli, ShaderSource(shaderId, 1, &glslChars, &glslLength)); // If tracing is enabled in chrome then we pretty print |