sk_tool_utils -> ToolUtils, and git clang-format
sk_tool_utils doesn't really fit the naming convention
the rest of code under tools/ tends to use.
Change-Id: I45326a174101c6eb4b6149e9c742f658f2fd23b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202313
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/samplecode/SampleAndroidShadows.cpp b/samplecode/SampleAndroidShadows.cpp
index fff2f94..b367ae9 100644
--- a/samplecode/SampleAndroidShadows.cpp
+++ b/samplecode/SampleAndroidShadows.cpp
@@ -9,15 +9,15 @@
#include "SkAnimTimer.h"
#include "SkBlurMask.h"
#include "SkBlurMaskFilter.h"
-#include "SkColorFilter.h"
#include "SkCamera.h"
#include "SkCanvas.h"
+#include "SkColorFilter.h"
#include "SkPath.h"
#include "SkPathOps.h"
#include "SkPoint3.h"
#include "SkShadowUtils.h"
#include "SkUTF.h"
-#include "sk_tool_utils.h"
+#include "ToolUtils.h"
////////////////////////////////////////////////////////////////////////////
diff --git a/samplecode/SampleChineseFling.cpp b/samplecode/SampleChineseFling.cpp
index b123942..d5e2479 100644
--- a/samplecode/SampleChineseFling.cpp
+++ b/samplecode/SampleChineseFling.cpp
@@ -7,7 +7,7 @@
#include "Resources.h"
#include "Sample.h"
-#include "sk_tool_utils.h"
+#include "ToolUtils.h"
#include "SkCanvas.h"
#include "SkFontMetrics.h"
@@ -92,8 +92,13 @@
this->createRandomWord(glyphs);
SkTextBlobBuilder builder;
- sk_tool_utils::add_to_text_blob_w_len(&builder, (const char*) glyphs, kWordLength*4,
- kUTF32_SkTextEncoding, font, 0, 0);
+ ToolUtils::add_to_text_blob_w_len(&builder,
+ (const char*)glyphs,
+ kWordLength * 4,
+ kUTF32_SkTextEncoding,
+ font,
+ 0,
+ 0);
fBlobs.emplace_back(builder.make());
}
@@ -216,9 +221,13 @@
auto currentLineLength = SkTMin(45, paragraphLength - 45);
this->createRandomLine(glyphs, currentLineLength);
- sk_tool_utils::add_to_text_blob_w_len(&builder, (const char*) glyphs,
- currentLineLength*4, kUTF32_SkTextEncoding,
- font, 0, y);
+ ToolUtils::add_to_text_blob_w_len(&builder,
+ (const char*)glyphs,
+ currentLineLength * 4,
+ kUTF32_SkTextEncoding,
+ font,
+ 0,
+ y);
y += fMetrics.fDescent - fMetrics.fAscent + fMetrics.fLeading;
paragraphLength -= 45;
}
diff --git a/samplecode/SampleColorFilter.cpp b/samplecode/SampleColorFilter.cpp
index 8a44fc4..d95aad4 100644
--- a/samplecode/SampleColorFilter.cpp
+++ b/samplecode/SampleColorFilter.cpp
@@ -4,12 +4,12 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "sk_tool_utils.h"
#include "Sample.h"
#include "SkCanvas.h"
#include "SkColorFilter.h"
#include "SkPaint.h"
#include "SkShader.h"
+#include "ToolUtils.h"
static int inflate5To8(int x) {
return (x << 3) | (x >> 2);
@@ -116,8 +116,7 @@
protected:
void onOnceBeforeDraw() override {
fBitmap = createBitmap(N);
- fShader = sk_tool_utils::create_checkerboard_shader(
- 0xFFCCCCCC, 0xFFFFFFFF, 12);
+ fShader = ToolUtils::create_checkerboard_shader(0xFFCCCCCC, 0xFFFFFFFF, 12);
if (false) { // avoid bit rot, suppress warning
test_5bits();
diff --git a/samplecode/SampleFatBits.cpp b/samplecode/SampleFatBits.cpp
index 1e988e7..5382af6 100644
--- a/samplecode/SampleFatBits.cpp
+++ b/samplecode/SampleFatBits.cpp
@@ -23,7 +23,7 @@
#include "SkString.h"
#include "SkSurface.h"
#include "SkTypes.h"
-#include "sk_tool_utils.h"
+#include "ToolUtils.h"
class SkEvent;
@@ -105,7 +105,7 @@
fBounds.set(0, 0, SkIntToScalar(width * zoom), SkIntToScalar(height * zoom));
fMatrix.setScale(SkIntToScalar(zoom), SkIntToScalar(zoom));
fInverse.setScale(SK_Scalar1 / zoom, SK_Scalar1 / zoom);
- fShader0 = sk_tool_utils::create_checkerboard_shader(0xFFDDDDDD, 0xFFFFFFFF, zoom);
+ fShader0 = ToolUtils::create_checkerboard_shader(0xFFDDDDDD, 0xFFFFFFFF, zoom);
fShader1 = SkShader::MakeColorShader(SK_ColorWHITE);
fShader = fShader0;
diff --git a/samplecode/SampleGlyphTransform.cpp b/samplecode/SampleGlyphTransform.cpp
index ff42251..ecd160c 100644
--- a/samplecode/SampleGlyphTransform.cpp
+++ b/samplecode/SampleGlyphTransform.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
#include "Sample.h"
-#include "sk_tool_utils.h"
+#include "ToolUtils.h"
#include "SkAnimTimer.h"
#include "SkCanvas.h"
@@ -26,8 +26,8 @@
protected:
void onOnceBeforeDraw() override {
- fEmojiFont.fTypeface = sk_tool_utils::emoji_typeface();
- fEmojiFont.fText = sk_tool_utils::emoji_sample_text();
+ fEmojiFont.fTypeface = ToolUtils::emoji_typeface();
+ fEmojiFont.fText = ToolUtils::emoji_sample_text();
}
bool onQuery(Sample::Event* evt) override {
diff --git a/samplecode/SampleLitAtlas.cpp b/samplecode/SampleLitAtlas.cpp
index 534b66b..13a2656 100644
--- a/samplecode/SampleLitAtlas.cpp
+++ b/samplecode/SampleLitAtlas.cpp
@@ -16,7 +16,7 @@
#include "SkRandom.h"
#include "SkRSXform.h"
-#include "sk_tool_utils.h"
+#include "ToolUtils.h"
// A crude normal mapped asteroids-like sample
class DrawLitAtlasDrawable : public SkDrawable {
@@ -251,9 +251,8 @@
}
}
- sk_tool_utils::create_hemi_normal_map(&atlas,
- SkIRect::MakeXYWH(kNormXOff, kBigYOff,
- kBigSize, kBigSize));
+ ToolUtils::create_hemi_normal_map(
+ &atlas, SkIRect::MakeXYWH(kNormXOff, kBigYOff, kBigSize, kBigSize));
}
// medium asteroid
@@ -264,9 +263,8 @@
}
}
- sk_tool_utils::create_frustum_normal_map(&atlas,
- SkIRect::MakeXYWH(kNormXOff, kMedYOff,
- kMedSize, kMedSize));
+ ToolUtils::create_frustum_normal_map(
+ &atlas, SkIRect::MakeXYWH(kNormXOff, kMedYOff, kMedSize, kMedSize));
}
// small asteroid
@@ -285,9 +283,8 @@
}
}
- sk_tool_utils::create_hemi_normal_map(&atlas,
- SkIRect::MakeXYWH(kNormXOff, kSmYOff,
- kSmSize, kSmSize));
+ ToolUtils::create_hemi_normal_map(
+ &atlas, SkIRect::MakeXYWH(kNormXOff, kSmYOff, kSmSize, kSmSize));
}
// ship
@@ -314,9 +311,8 @@
}
}
- sk_tool_utils::create_tetra_normal_map(&atlas,
- SkIRect::MakeXYWH(kNormXOff, kShipYOff,
- kMedSize, kMedSize));
+ ToolUtils::create_tetra_normal_map(
+ &atlas, SkIRect::MakeXYWH(kNormXOff, kShipYOff, kMedSize, kMedSize));
}
return atlas;
diff --git a/samplecode/SamplePathText.cpp b/samplecode/SamplePathText.cpp
index 8f4b8a1..e9b2be3 100644
--- a/samplecode/SamplePathText.cpp
+++ b/samplecode/SamplePathText.cpp
@@ -14,7 +14,7 @@
#include "SkStrike.h"
#include "SkStrikeCache.h"
#include "SkTaskGroup.h"
-#include "sk_tool_utils.h"
+#include "ToolUtils.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
// Static text from paths.
@@ -106,7 +106,7 @@
Glyph fGlyphs[kNumPaths];
SkRandom fRand{25};
- SkPath fClipPath = sk_tool_utils::make_star(SkRect{0,0,1,1}, 11, 3);
+ SkPath fClipPath = ToolUtils::make_star(SkRect{0, 0, 1, 1}, 11, 3);
bool fDoClip = false;
typedef Sample INHERITED;
diff --git a/samplecode/SampleQuadStroker.cpp b/samplecode/SampleQuadStroker.cpp
index 10e9bbc..6122f4b 100644
--- a/samplecode/SampleQuadStroker.cpp
+++ b/samplecode/SampleQuadStroker.cpp
@@ -30,7 +30,7 @@
#include "SkTemplates.h"
#include "SkTextUtils.h"
#include "SkTypes.h"
-#include "sk_tool_utils.h"
+#include "ToolUtils.h"
#include <cfloat>
@@ -282,7 +282,7 @@
fBounds.set(0, 0, SkIntToScalar(width * zoom), SkIntToScalar(height * zoom));
fMatrix.setScale(SkIntToScalar(zoom), SkIntToScalar(zoom));
fInverse.setScale(SK_Scalar1 / zoom, SK_Scalar1 / zoom);
- fShader = sk_tool_utils::create_checkerboard_shader(0xFFCCCCCC, 0xFFFFFFFF, zoom);
+ fShader = ToolUtils::create_checkerboard_shader(0xFFCCCCCC, 0xFFFFFFFF, zoom);
SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
fMinSurface = SkSurface::MakeRaster(info);
diff --git a/samplecode/SampleShadowUtils.cpp b/samplecode/SampleShadowUtils.cpp
index c6ae470..5389c38 100644
--- a/samplecode/SampleShadowUtils.cpp
+++ b/samplecode/SampleShadowUtils.cpp
@@ -9,15 +9,15 @@
#include "SkAnimTimer.h"
#include "SkBlurMask.h"
#include "SkBlurMaskFilter.h"
-#include "SkColorFilter.h"
#include "SkCamera.h"
#include "SkCanvas.h"
+#include "SkColorFilter.h"
#include "SkPath.h"
#include "SkPathOps.h"
#include "SkPoint3.h"
#include "SkShadowUtils.h"
#include "SkUTF.h"
-#include "sk_tool_utils.h"
+#include "ToolUtils.h"
////////////////////////////////////////////////////////////////////////////
diff --git a/samplecode/SampleSlides.cpp b/samplecode/SampleSlides.cpp
index f581b80..bd2967b 100644
--- a/samplecode/SampleSlides.cpp
+++ b/samplecode/SampleSlides.cpp
@@ -14,7 +14,7 @@
#include "SkPaint.h"
#include "SkVertices.h"
-#include "sk_tool_utils.h"
+#include "ToolUtils.h"
#define BG_COLOR 0xFFDDDDDD
@@ -429,7 +429,7 @@
canvas.restore();
SkString str;
str.printf("/skimages/slide_" SK_SIZE_T_SPECIFIER ".png", i);
- sk_tool_utils::EncodeImageToFile(str.c_str(), bm, SkEncodedImageFormat::kPNG, 100);
+ ToolUtils::EncodeImageToFile(str.c_str(), bm, SkEncodedImageFormat::kPNG, 100);
}
this->setBGColor(BG_COLOR);
}
diff --git a/samplecode/SampleUnpremul.cpp b/samplecode/SampleUnpremul.cpp
index da7e42d..e7278ff 100644
--- a/samplecode/SampleUnpremul.cpp
+++ b/samplecode/SampleUnpremul.cpp
@@ -5,12 +5,11 @@
* found in the LICENSE file.
*/
-#include "sk_tool_utils.h"
#include "DecodeFile.h"
#include "Resources.h"
#include "Sample.h"
-#include "SkBlurMask.h"
#include "SkBlurDrawLooper.h"
+#include "SkBlurMask.h"
#include "SkCanvas.h"
#include "SkColorPriv.h"
#include "SkOSFile.h"
@@ -19,6 +18,7 @@
#include "SkString.h"
#include "SkTypes.h"
#include "SkUTF.h"
+#include "ToolUtils.h"
/**
* Interprets c as an unpremultiplied color, and returns the
@@ -69,7 +69,7 @@
}
void onDrawBackground(SkCanvas* canvas) override {
- sk_tool_utils::draw_checkerboard(canvas, 0xFFCCCCCC, 0xFFFFFFFF, 12);
+ ToolUtils::draw_checkerboard(canvas, 0xFFCCCCCC, 0xFFFFFFFF, 12);
}
void onDrawContent(SkCanvas* canvas) override {