Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Unified Diff: src/core/SkStringUtils.cpp

Issue 1293563003: Put clear and discard into GrBatch. (Closed) Base URL: https://skia.googlesource.com/skia.git@protectedprepare
Patch Set: tiny Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkStringUtils.h ('k') | src/gpu/GrBufferedDrawTarget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkStringUtils.cpp
diff --git a/src/core/SkStringUtils.cpp b/src/core/SkStringUtils.cpp
index 390de7f264b599598366f54b38d724e9a6ac4afb..35e55570c33ce500b7bb974facc6bd7cfbe60538 100644
--- a/src/core/SkStringUtils.cpp
+++ b/src/core/SkStringUtils.cpp
@@ -35,3 +35,29 @@ void SkAppendScalar(SkString* str, SkScalar value, SkScalarAsStringType asType)
}
}
+SkString SkTabString(const SkString& string, int tabCnt) {
+ if (tabCnt <= 0) {
+ return string;
+ }
+ SkString tabs;
+ for (int i = 0; i < tabCnt; ++i) {
+ tabs.append("\t");
+ }
+ SkString result;
+ static const char newline[] = "\n";
+ const char* input = string.c_str();
+ int nextNL = SkStrFind(input, newline);
+ while (nextNL >= 0) {
+ if (nextNL > 0) {
+ result.append(tabs);
+ }
+ result.append(input, nextNL + 1);
+ input += nextNL + 1;
+ nextNL = SkStrFind(input, newline);
+ }
+ if (*input != '\0') {
+ result.append(tabs);
+ }
+ result.append(input);
+ return result;
+}
« no previous file with comments | « src/core/SkStringUtils.h ('k') | src/gpu/GrBufferedDrawTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698