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>
This commit is contained in:
Mike Klein 2019-03-20 11:12:10 -05:00 committed by Skia Commit-Bot
parent 8d1956edd8
commit ea3f014e2b
236 changed files with 1315 additions and 1335 deletions

View File

@ -1565,6 +1565,7 @@ if (skia_enable_tools) {
"tools/LsanSuppressions.cpp",
"tools/ProcStats.cpp",
"tools/Resources.cpp",
"tools/ToolUtils.cpp",
"tools/UrlDataManager.cpp",
"tools/debugger/SkDebugCanvas.cpp",
"tools/debugger/SkDrawCommand.cpp",
@ -1577,9 +1578,8 @@ if (skia_enable_tools) {
"tools/fonts/TestSVGTypeface.h",
"tools/fonts/TestTypeface.cpp",
"tools/fonts/TestTypeface.h",
"tools/fonts/sk_tool_utils_font.cpp",
"tools/fonts/ToolUtilsFont.cpp",
"tools/random_parse_path.cpp",
"tools/sk_tool_utils.cpp",
"tools/timer/SkAnimTimer.h",
"tools/timer/Timer.cpp",
"tools/trace/SkChromeTracingTracer.cpp",

View File

@ -8,7 +8,7 @@
#include "Benchmark.h"
#include "SkCanvas.h"
#include "SkPath.h"
#include "sk_tool_utils.h"
#include "ToolUtils.h"
enum Align {
kLeft_Align,
@ -42,9 +42,7 @@ protected:
return SkIPoint::Make(640, 100);
}
void onDelayedSetup() override {
sk_tool_utils::make_big_path(fPath);
}
void onDelayedSetup() override { ToolUtils::make_big_path(fPath); }
void onDraw(int loops, SkCanvas* canvas) override {
SkPaint paint;

View File

@ -12,7 +12,7 @@
#include "SkPaint.h"
#include "SkRandom.h"
#include "SkString.h"
#include "sk_tool_utils.h"
#include "ToolUtils.h"
/* Variants for bitmaps
@ -48,7 +48,8 @@ public:
protected:
const char* onGetName() override {
fName.set("bitmap");
fName.appendf("_%s%s", sk_tool_utils::colortype_name(fColorType),
fName.appendf("_%s%s",
ToolUtils::colortype_name(fColorType),
kOpaque_SkAlphaType == fAlphaType ? "" : "_A");
if (fDoScale) {
fName.append("_scale");

View File

@ -6,16 +6,16 @@
*/
#include "Benchmark.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkColorSpace.h"
#include "SkImage.h"
#include "SkPictureRecorder.h"
#include "SkString.h"
#include "SkSurface.h"
#include "ToolUtils.h"
static void DrawMask(SkCanvas* canvas) {
sk_tool_utils::draw_checkerboard(canvas, SK_ColorTRANSPARENT, SK_ColorGREEN, 10);
ToolUtils::draw_checkerboard(canvas, SK_ColorTRANSPARENT, SK_ColorGREEN, 10);
}
class ClipMaskBench : public Benchmark {

View File

@ -6,10 +6,10 @@
*/
#include "Benchmark.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkImage.h"
#include "SkSurface.h"
#include "ToolUtils.h"
#include "GrContext.h"
#include "GrContextPriv.h"
@ -27,8 +27,8 @@ static constexpr int kS = 25;
static void make_images(sk_sp<SkImage> imgs[], int cnt) {
for (int i = 0; i < cnt; ++i) {
SkBitmap bmp = sk_tool_utils::create_checkerboard_bitmap(kS, kS, SK_ColorBLACK,
SK_ColorCYAN, 10);
SkBitmap bmp =
ToolUtils::create_checkerboard_bitmap(kS, kS, SK_ColorBLACK, SK_ColorCYAN, 10);
imgs[i] = SkImage::MakeFromBitmap(bmp);
}
}

View File

@ -12,7 +12,7 @@
#include "SkRandom.h"
#include "SkStrike.h"
#include "SkStrikeCache.h"
#include "sk_tool_utils.h"
#include "ToolUtils.h"
static constexpr int kScreenWidth = 1500;
static constexpr int kScreenHeight = 1500;
@ -76,7 +76,7 @@ private:
}
if (fClipped) {
fClipPath = sk_tool_utils::make_star(SkRect::MakeIWH(kScreenWidth,kScreenHeight), 11,3);
fClipPath = ToolUtils::make_star(SkRect::MakeIWH(kScreenWidth, kScreenHeight), 11, 3);
fClipPath.setIsVolatile(fUncached);
}
}

View File

@ -8,7 +8,7 @@
#include "Benchmark.h"
#include "SkCanvas.h"
#include "SkString.h"
#include "sk_tool_utils.h"
#include "ToolUtils.h"
class PremulAndUnpremulAlphaOpsBench : public Benchmark {
enum {
@ -20,7 +20,7 @@ class PremulAndUnpremulAlphaOpsBench : public Benchmark {
public:
PremulAndUnpremulAlphaOpsBench(SkColorType ct) {
fColorType = ct;
fName.printf("premul_and_unpremul_alpha_%s", sk_tool_utils::colortype_name(ct));
fName.printf("premul_and_unpremul_alpha_%s", ToolUtils::colortype_name(ct));
}
protected:

View File

@ -11,7 +11,7 @@
#include "SkPaint.h"
#include "SkShader.h"
#include "SkString.h"
#include "sk_tool_utils.h"
#include "ToolUtils.h"
static void draw_into_bitmap(const SkBitmap& bm) {
const int w = bm.width();
@ -44,7 +44,8 @@ public:
fBitmap.setInfo(SkImageInfo::Make(w, h, ct, at));
fName.printf("repeatTile_%s_%c",
sk_tool_utils::colortype_name(ct), kOpaque_SkAlphaType == at ? 'X' : 'A');
ToolUtils::colortype_name(ct),
kOpaque_SkAlphaType == at ? 'X' : 'A');
}
protected:

View File

@ -10,12 +10,11 @@
#include "Benchmark.h"
#include "SkCanvas.h"
#include "SkStrikeCache.h"
#include "SkGraphics.h"
#include "SkStrikeCache.h"
#include "SkTaskGroup.h"
#include "SkTypeface.h"
#include "sk_tool_utils.h"
#include "ToolUtils.h"
static void do_font_stuff(SkFont* font) {
SkPaint defaultPaint;
@ -58,7 +57,7 @@ protected:
SkFont font;
font.setEdging(SkFont::Edging::kAntiAlias);
font.setSubpixel(true);
font.setTypeface(sk_tool_utils::create_portable_typeface("serif", SkFontStyle::Italic()));
font.setTypeface(ToolUtils::create_portable_typeface("serif", SkFontStyle::Italic()));
for (int work = 0; work < loops; work++) {
do_font_stuff(&font);
@ -89,9 +88,9 @@ protected:
void onDraw(int loops, SkCanvas*) override {
size_t oldCacheLimitSize = SkGraphics::GetFontCacheLimit();
SkGraphics::SetFontCacheLimit(fCacheSize);
sk_sp<SkTypeface> typefaces[] =
{sk_tool_utils::create_portable_typeface("serif", SkFontStyle::Italic()),
sk_tool_utils::create_portable_typeface("sans-serif", SkFontStyle::Italic())};
sk_sp<SkTypeface> typefaces[] = {
ToolUtils::create_portable_typeface("serif", SkFontStyle::Italic()),
ToolUtils::create_portable_typeface("sans-serif", SkFontStyle::Italic())};
for (int work = 0; work < loops; work++) {
SkTaskGroup().batch(16, [&](int threadIndex) {

View File

@ -17,7 +17,7 @@
#include "SkTextBlob.h"
#include "SkTypeface.h"
#include "sk_tool_utils.h"
#include "ToolUtils.h"
/*
* A trivial test which benchmarks the performance of a textblob with a single run.
@ -27,7 +27,7 @@ public:
SkTextBlobBench() {}
void onDelayedSetup() override {
fFont.setTypeface(sk_tool_utils::create_portable_typeface("serif", SkFontStyle()));
fFont.setTypeface(ToolUtils::create_portable_typeface("serif", SkFontStyle()));
fFont.setSubpixel(true);
// This text seems representative in both length and letter frequency.

View File

@ -10,7 +10,7 @@
#include "SkString.h"
#include "SkTTopoSort.h"
#include "sk_tool_utils.h"
#include "ToolUtils.h"
class TopoSortBench : public Benchmark {
public:
@ -30,7 +30,7 @@ protected:
// Delayed initialization only done if onDraw will be called.
void onDelayedSetup() override {
sk_tool_utils::TopoTestNode::AllocNodes(&fGraph, kNumElements);
ToolUtils::TopoTestNode::AllocNodes(&fGraph, kNumElements);
for (int i = kNumElements-1; i > 0; --i) {
int numEdges = fRand.nextU() % (kMaxEdges+1);
@ -49,9 +49,9 @@ protected:
fGraph[j]->reset();
}
sk_tool_utils::TopoTestNode::Shuffle(&fGraph, &fRand);
ToolUtils::TopoTestNode::Shuffle(&fGraph, &fRand);
SkDEBUGCODE(bool actualResult =) SkTTopoSort<sk_tool_utils::TopoTestNode>(&fGraph);
SkDEBUGCODE(bool actualResult =) SkTTopoSort<ToolUtils::TopoTestNode>(&fGraph);
SkASSERT(actualResult);
#ifdef SK_DEBUG
@ -66,7 +66,7 @@ private:
static const int kNumElements = 1000;
static const int kMaxEdges = 5;
SkTArray<sk_sp<sk_tool_utils::TopoTestNode>> fGraph;
SkTArray<sk_sp<ToolUtils::TopoTestNode>> fGraph;
SkRandom fRand;
typedef Benchmark INHERITED;

View File

@ -40,8 +40,8 @@
#include "SkTypeface_win.h"
#include "Test.h"
#include "TestFontMgr.h"
#include "ToolUtils.h"
#include "ios_utils.h"
#include "sk_tool_utils.h"
#include <vector>
@ -1401,8 +1401,8 @@ struct Task {
if (bitmap) {
result.gamut = identify_gamut (bitmap->colorSpace());
result.transferFn = identify_transfer_fn (bitmap->colorSpace());
result.colorType = sk_tool_utils::colortype_name(bitmap->colorType ());
result.alphaType = sk_tool_utils::alphatype_name(bitmap->alphaType ());
result.colorType = ToolUtils::colortype_name(bitmap->colorType());
result.alphaType = ToolUtils::alphatype_name(bitmap->alphaType());
result.colorDepth = color_depth (bitmap->colorType());
}
JsonWriter::AddBitmapResult(result);
@ -1518,7 +1518,7 @@ int main(int argc, char** argv) {
CommandLineFlags::Parse(argc, argv);
if (!FLAGS_nativeFonts) {
gSkFontMgr_DefaultFactory = &sk_tool_utils::MakePortableFontMgr;
gSkFontMgr_DefaultFactory = &ToolUtils::MakePortableFontMgr;
}
#if defined(SK_BUILD_FOR_WIN)

View File

@ -23,7 +23,7 @@
#include "SkSurface.h"
#include "SkTextBlob.h"
#include "sk_tool_utils.h"
#include "ToolUtils.h"
#include <iostream>
#include <map>
@ -354,7 +354,7 @@ static void fuzz_api(sk_sp<SkData> bytes, SkString name) {
static void dump_png(SkBitmap bitmap) {
if (!FLAGS_dump.isEmpty()) {
sk_tool_utils::EncodeImageToFile(FLAGS_dump[0], bitmap, SkEncodedImageFormat::kPNG, 100);
ToolUtils::EncodeImageToFile(FLAGS_dump[0], bitmap, SkEncodedImageFormat::kPNG, 100);
SkDebugf("Dumped to %s\n", FLAGS_dump[0]);
}
}

View File

@ -41,7 +41,7 @@ void FuzzImageFilterDeserialize(sk_sp<SkData> bytes) {
#if defined(IS_FUZZING_WITH_LIBFUZZER)
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
gSkFontMgr_DefaultFactory = &sk_tool_utils::MakePortableFontMgr;
gSkFontMgr_DefaultFactory = &ToolUtils::MakePortableFontMgr;
auto bytes = SkData::MakeWithoutCopy(data, size);
FuzzImageFilterDeserialize(bytes);
return 0;

View File

@ -20,7 +20,7 @@ extern "C" {
}
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
gSkFontMgr_DefaultFactory = &sk_tool_utils::MakePortableFontMgr;
gSkFontMgr_DefaultFactory = &ToolUtils::MakePortableFontMgr;
auto fuzz = Fuzz(SkData::MakeWithoutCopy(data, size));
fuzz_MockGPUCanvas(&fuzz);
return 0;

View File

@ -12,7 +12,7 @@
void fuzz_NullCanvas(Fuzz* f);
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
gSkFontMgr_DefaultFactory = &sk_tool_utils::MakePortableFontMgr;
gSkFontMgr_DefaultFactory = &ToolUtils::MakePortableFontMgr;
auto fuzz = Fuzz(SkData::MakeWithoutCopy(data, size));
fuzz_NullCanvas(&fuzz);
return 0;

View File

@ -12,7 +12,7 @@
void fuzz_RasterN32Canvas(Fuzz* f);
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
gSkFontMgr_DefaultFactory = &sk_tool_utils::MakePortableFontMgr;
gSkFontMgr_DefaultFactory = &ToolUtils::MakePortableFontMgr;
auto fuzz = Fuzz(SkData::MakeWithoutCopy(data, size));
fuzz_RasterN32Canvas(&fuzz);
return 0;

View File

@ -29,7 +29,7 @@ void FuzzTextBlobDeserialize(SkReadBuffer& buf) {
#if defined(IS_FUZZING_WITH_LIBFUZZER)
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
gSkFontMgr_DefaultFactory = &sk_tool_utils::MakePortableFontMgr;
gSkFontMgr_DefaultFactory = &ToolUtils::MakePortableFontMgr;
SkReadBuffer buf(data, size);
FuzzTextBlobDeserialize(buf);
return 0;

View File

@ -5,11 +5,11 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkCanvasPriv.h"
#include "SkPath.h"
#include "SkMakeUnique.h"
#include "SkPath.h"
#include "ToolUtils.h"
#include "gm.h"
static void do_draw(SkCanvas* canvas, const SkRect& r) {
SkPaint paint;
@ -257,7 +257,7 @@ protected:
SkRect r = SkRect::MakeXYWH(0, H/4, W, H/2);
SkPaint paint;
paint.setColor(sk_tool_utils::color_to_565(0xFF8888FF));
paint.setColor(ToolUtils::color_to_565(0xFF8888FF));
canvas->drawRect(r, paint);
this->doDraw(canvas, path);

View File

@ -5,12 +5,12 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkColorPriv.h"
#include "SkPath.h"
#include "SkShader.h"
#include "SkTextUtils.h"
#include "ToolUtils.h"
#include "gm.h"
enum {
kXfermodeCount = (int)SkBlendMode::kLastMode + 1 + 1, // extra for arith
@ -68,7 +68,7 @@ protected:
}
void onOnceBeforeDraw() override {
fLabelFont.setTypeface(sk_tool_utils::create_portable_typeface());
fLabelFont.setTypeface(ToolUtils::create_portable_typeface());
fLabelFont.setSize(5 * kShapeSize/8);
fLabelFont.setSubpixel(true);
@ -141,8 +141,7 @@ protected:
canvas->save();
canvas->clipRect(clipRect);
if (kCheckerboard_Pass == drawingPass) {
sk_tool_utils::draw_checkerboard(canvas, 0xffffffff, 0xffc6c3c6,
10);
ToolUtils::draw_checkerboard(canvas, 0xffffffff, 0xffc6c3c6, 10);
} else {
SkASSERT(kBackground_Pass == drawingPass);
canvas->drawColor(kBGColor, SkBlendMode::kSrc);

View File

@ -5,12 +5,12 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkAnimTimer.h"
#include "SkCanvas.h"
#include "SkPathMeasure.h"
#include "SkRandom.h"
#include "ToolUtils.h"
#include "gm.h"
class AddArcGM : public skiagm::GM {
public:
@ -37,7 +37,7 @@ protected:
SkScalar sign = 1;
while (r.width() > paint.getStrokeWidth() * 3) {
paint.setColor(sk_tool_utils::color_to_565(rand.nextU() | (0xFF << 24)));
paint.setColor(ToolUtils::color_to_565(rand.nextU() | (0xFF << 24)));
SkScalar startAngle = rand.nextUScalar1() * 360;
SkScalar speed = SkScalarSqrt(16 / r.width()) * 0.5f;
@ -131,7 +131,7 @@ protected:
SkAutoCanvasRestore acr(canvas, true);
canvas->rotate(fRotate * sign);
paint.setColor(sk_tool_utils::color_to_565(rand.nextU() | (0xFF << 24)));
paint.setColor(ToolUtils::color_to_565(rand.nextU() | (0xFF << 24)));
canvas->drawOval(r, paint);
r.inset(delta, delta);
sign = -sign;
@ -184,7 +184,7 @@ protected:
while (r.width() > strokeWidth * 2) {
SkAutoCanvasRestore acr(canvas, true);
canvas->rotate(fRotate * sign);
paint.setColor(sk_tool_utils::color_to_565(rand.nextU() | (0xFF << 24)));
paint.setColor(ToolUtils::color_to_565(rand.nextU() | (0xFF << 24)));
canvas->drawOval(r, paint);
r.inset(delta, delta);
sign = -sign;

View File

@ -5,10 +5,10 @@
* found in the LICENSE file.
*/
#include "SkSurface.h"
#include "Resources.h"
#include "SkSurface.h"
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkColorPriv.h"
#include "SkFont.h"
@ -23,7 +23,7 @@ static SkBitmap copy_bitmap(const SkBitmap& src, SkColorType colorType) {
}
SkBitmap copy;
sk_tool_utils::copy_to(&copy, colorType, *srcPtr);
ToolUtils::copy_to(&copy, colorType, *srcPtr);
copy.setImmutable();
return copy;
}
@ -83,7 +83,7 @@ static void color_wheel_native(SkCanvas* canvas) {
SkFont font;
font.setEdging(SkFont::Edging::kAlias);
font.setTypeface(sk_tool_utils::create_portable_typeface(nullptr, SkFontStyle::Bold()));
font.setTypeface(ToolUtils::create_portable_typeface(nullptr, SkFontStyle::Bold()));
font.setSize(0.28125f * SCALE);
draw_center_letter('K', font, SK_ColorBLACK, Z, Z, canvas);
draw_center_letter('R', font, SK_ColorRED, Z, D, canvas);
@ -121,9 +121,9 @@ DEF_SIMPLE_GM(all_bitmap_configs, canvas, SCALE, 6 * SCALE) {
p.setColor(SK_ColorBLACK);
p.setAntiAlias(true);
SkFont font(sk_tool_utils::create_portable_typeface());
SkFont font(ToolUtils::create_portable_typeface());
sk_tool_utils::draw_checkerboard(canvas, SK_ColorLTGRAY, SK_ColorWHITE, 8);
ToolUtils::draw_checkerboard(canvas, SK_ColorLTGRAY, SK_ColorWHITE, 8);
SkBitmap bitmap;
if (GetResourceAsBitmap("images/color_wheel.png", &bitmap)) {
@ -170,7 +170,7 @@ sk_sp<SkImage> make_not_native32_color_wheel() {
const SkColorType ct = kBGRA_8888_SkColorType;
#endif
static_assert(ct != kN32_SkColorType, "BRGA!=RGBA");
SkAssertResult(sk_tool_utils::copy_to(&notN32bitmap, ct, n32bitmap));
SkAssertResult(ToolUtils::copy_to(&notN32bitmap, ct, n32bitmap));
SkASSERT(notN32bitmap.colorType() == ct);
return SkImage::MakeFromBitmap(notN32bitmap);
}
@ -178,7 +178,7 @@ sk_sp<SkImage> make_not_native32_color_wheel() {
DEF_SIMPLE_GM(not_native32_bitmap_config, canvas, SCALE, SCALE) {
sk_sp<SkImage> notN32image(make_not_native32_color_wheel());
SkASSERT(notN32image);
sk_tool_utils::draw_checkerboard(canvas, SK_ColorLTGRAY, SK_ColorWHITE, 8);
ToolUtils::draw_checkerboard(canvas, SK_ColorLTGRAY, SK_ColorWHITE, 8);
canvas->drawImage(notN32image.get(), 0.0f, 0.0f);
}
@ -228,7 +228,7 @@ static void make_color_test_bitmap_variant(
}
DEF_SIMPLE_GM(all_variants_8888, canvas, 4 * SCALE + 30, 2 * SCALE + 10) {
sk_tool_utils::draw_checkerboard(canvas, SK_ColorLTGRAY, SK_ColorWHITE, 8);
ToolUtils::draw_checkerboard(canvas, SK_ColorLTGRAY, SK_ColorWHITE, 8);
sk_sp<SkColorSpace> colorSpaces[] {
SkColorSpace::MakeSRGB(),

View File

@ -5,10 +5,10 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkBitmap.h"
#include "SkTextUtils.h"
#include "ToolUtils.h"
#include "gm.h"
namespace skiagm {
@ -36,7 +36,7 @@ protected:
tmp.clear(SK_ColorTRANSPARENT);
SkPaint p;
p.setAntiAlias(true);
p.setColor(sk_tool_utils::color_to_565(kBlue));
p.setColor(ToolUtils::color_to_565(kBlue));
tmp.drawRect(SkRect::MakeLTRB(16, 96, 160, 240), p);
}
@ -46,7 +46,7 @@ protected:
tmp.clear(SK_ColorTRANSPARENT);
SkPaint p;
p.setAntiAlias(true);
p.setColor(sk_tool_utils::color_to_565(kRed));
p.setColor(ToolUtils::color_to_565(kRed));
tmp.drawCircle(160, 95, 80, p);
}
}
@ -65,12 +65,9 @@ protected:
}
void onDraw(SkCanvas* canvas) override {
SkFont font(sk_tool_utils::create_portable_typeface());
SkFont font(ToolUtils::create_portable_typeface());
sk_tool_utils::draw_checkerboard(canvas,
kWhite,
kGrey,
32);
ToolUtils::draw_checkerboard(canvas, kWhite, kGrey, 32);
int xOffset = 0, yOffset = 0;

View File

@ -14,8 +14,8 @@
#include "SkFont.h"
#include "SkPaint.h"
#include "SkString.h"
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
#include <vector>
@ -49,7 +49,7 @@ private:
SkBitmap& requiredBitmap = fFrames[requiredFrame];
// For simplicity, do not try to cache old frames
if (requiredBitmap.getPixels() &&
sk_tool_utils::copy_to(&bm, requiredBitmap.colorType(), requiredBitmap)) {
ToolUtils::copy_to(&bm, requiredBitmap.colorType(), requiredBitmap)) {
opts.fPriorFrame = requiredFrame;
}
}

View File

@ -6,8 +6,6 @@
*/
#include <SkFont.h>
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkArithmeticImageFilter.h"
#include "SkCanvas.h"
#include "SkColorPriv.h"
@ -16,6 +14,8 @@
#include "SkImageSource.h"
#include "SkShader.h"
#include "SkSurface.h"
#include "ToolUtils.h"
#include "gm.h"
#define WW 100
#define HH 32
@ -53,7 +53,7 @@ static sk_sp<SkImage> make_dst() {
}
static void show_k_text(SkCanvas* canvas, SkScalar x, SkScalar y, const SkScalar k[]) {
SkFont font(sk_tool_utils::create_portable_typeface(), 24);
SkFont font(ToolUtils::create_portable_typeface(), 24);
font.setEdging(SkFont::Edging::kAntiAlias);
SkPaint paint;
paint.setAntiAlias(true);
@ -149,7 +149,7 @@ protected:
canvas->translate(gap, 0);
// Label
SkFont font(sk_tool_utils::create_portable_typeface(), 24);
SkFont font(ToolUtils::create_portable_typeface(), 24);
SkString str(enforcePMColor ? "enforcePM" : "no enforcePM");
canvas->drawString(str, 0, font.getSize(), font, SkPaint());
}

View File

@ -18,10 +18,10 @@
#include "SkFont.h"
#include "SkTypeface.h"
#include "SkUTF.h"
#include "ToolUtils.h"
#include "gpu/TestContext.h"
#include "gpu/atlastext/GLTestAtlasTextRenderer.h"
#include "gpu/atlastext/TestAtlasTextRenderer.h"
#include "sk_tool_utils.h"
// GM that draws text using the Atlas Text interface offscreen and then blits that to the canvas.
@ -76,14 +76,12 @@ protected:
fTarget = SkAtlasTextTarget::Make(fContext, kSize, kSize, targetHandle);
fTypefaces[0] = sk_tool_utils::create_portable_typeface("serif", SkFontStyle::Italic());
fTypefaces[1] =
sk_tool_utils::create_portable_typeface("sans-serif", SkFontStyle::Italic());
fTypefaces[2] = sk_tool_utils::create_portable_typeface("serif", SkFontStyle::Normal());
fTypefaces[3] =
sk_tool_utils::create_portable_typeface("sans-serif", SkFontStyle::Normal());
fTypefaces[4] = sk_tool_utils::create_portable_typeface("serif", SkFontStyle::Bold());
fTypefaces[5] = sk_tool_utils::create_portable_typeface("sans-serif", SkFontStyle::Bold());
fTypefaces[0] = ToolUtils::create_portable_typeface("serif", SkFontStyle::Italic());
fTypefaces[1] = ToolUtils::create_portable_typeface("sans-serif", SkFontStyle::Italic());
fTypefaces[2] = ToolUtils::create_portable_typeface("serif", SkFontStyle::Normal());
fTypefaces[3] = ToolUtils::create_portable_typeface("sans-serif", SkFontStyle::Normal());
fTypefaces[4] = ToolUtils::create_portable_typeface("serif", SkFontStyle::Bold());
fTypefaces[5] = ToolUtils::create_portable_typeface("sans-serif", SkFontStyle::Bold());
}
DrawResult onDraw(SkCanvas* canvas, SkString* errorMsg) override {

View File

@ -7,8 +7,8 @@
// This test only works with the GPU backend.
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
#include "GrContext.h"
#include "GrContextPriv.h"

View File

@ -5,62 +5,59 @@
* found in the LICENSE file.
*/
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkColorPriv.h"
#include "SkPath.h"
#include "SkShader.h"
DEF_SIMPLE_GM_BG(bigmatrix, canvas, 50, 50,
sk_tool_utils::color_to_565(0xFF66AA99)) {
SkMatrix m;
m.reset();
m.setRotate(33 * SK_Scalar1);
m.postScale(3000 * SK_Scalar1, 3000 * SK_Scalar1);
m.postTranslate(6000 * SK_Scalar1, -5000 * SK_Scalar1);
canvas->concat(m);
DEF_SIMPLE_GM_BG(bigmatrix, canvas, 50, 50, ToolUtils::color_to_565(0xFF66AA99)) {
SkMatrix m;
m.reset();
m.setRotate(33 * SK_Scalar1);
m.postScale(3000 * SK_Scalar1, 3000 * SK_Scalar1);
m.postTranslate(6000 * SK_Scalar1, -5000 * SK_Scalar1);
canvas->concat(m);
SkPaint paint;
paint.setColor(SK_ColorRED);
paint.setAntiAlias(true);
SkPaint paint;
paint.setColor(SK_ColorRED);
paint.setAntiAlias(true);
bool success = m.invert(&m);
SkASSERT(success);
(void) success; // silence compiler :(
bool success = m.invert(&m);
SkASSERT(success);
(void)success; // silence compiler :(
SkPath path;
SkPath path;
SkPoint pt = {10 * SK_Scalar1, 10 * SK_Scalar1};
SkScalar small = 1 / (500 * SK_Scalar1);
SkPoint pt = {10 * SK_Scalar1, 10 * SK_Scalar1};
SkScalar small = 1 / (500 * SK_Scalar1);
m.mapPoints(&pt, 1);
path.addCircle(pt.fX, pt.fY, small);
canvas->drawPath(path, paint);
m.mapPoints(&pt, 1);
path.addCircle(pt.fX, pt.fY, small);
canvas->drawPath(path, paint);
pt.set(30 * SK_Scalar1, 10 * SK_Scalar1);
m.mapPoints(&pt, 1);
SkRect rect = {pt.fX - small, pt.fY - small,
pt.fX + small, pt.fY + small};
canvas->drawRect(rect, paint);
pt.set(30 * SK_Scalar1, 10 * SK_Scalar1);
m.mapPoints(&pt, 1);
SkRect rect = {pt.fX - small, pt.fY - small, pt.fX + small, pt.fY + small};
canvas->drawRect(rect, paint);
SkBitmap bmp;
bmp.allocN32Pixels(2, 2);
uint32_t* pixels = reinterpret_cast<uint32_t*>(bmp.getPixels());
pixels[0] = SkPackARGB32(0xFF, 0xFF, 0x00, 0x00);
pixels[1] = SkPackARGB32(0xFF, 0x00, 0xFF, 0x00);
pixels[2] = SkPackARGB32(0x80, 0x00, 0x00, 0x00);
pixels[3] = SkPackARGB32(0xFF, 0x00, 0x00, 0xFF);
pt.set(30 * SK_Scalar1, 30 * SK_Scalar1);
m.mapPoints(&pt, 1);
SkMatrix s;
s.reset();
s.setScale(SK_Scalar1 / 1000, SK_Scalar1 / 1000);
paint.setShader(SkShader::MakeBitmapShader(bmp, SkShader::kRepeat_TileMode,
SkShader::kRepeat_TileMode, &s));
paint.setAntiAlias(false);
paint.setFilterQuality(kLow_SkFilterQuality);
rect.setLTRB(pt.fX - small, pt.fY - small,
pt.fX + small, pt.fY + small);
canvas->drawRect(rect, paint);
SkBitmap bmp;
bmp.allocN32Pixels(2, 2);
uint32_t* pixels = reinterpret_cast<uint32_t*>(bmp.getPixels());
pixels[0] = SkPackARGB32(0xFF, 0xFF, 0x00, 0x00);
pixels[1] = SkPackARGB32(0xFF, 0x00, 0xFF, 0x00);
pixels[2] = SkPackARGB32(0x80, 0x00, 0x00, 0x00);
pixels[3] = SkPackARGB32(0xFF, 0x00, 0x00, 0xFF);
pt.set(30 * SK_Scalar1, 30 * SK_Scalar1);
m.mapPoints(&pt, 1);
SkMatrix s;
s.reset();
s.setScale(SK_Scalar1 / 1000, SK_Scalar1 / 1000);
paint.setShader(SkShader::MakeBitmapShader(
bmp, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, &s));
paint.setAntiAlias(false);
paint.setFilterQuality(kLow_SkFilterQuality);
rect.setLTRB(pt.fX - small, pt.fY - small, pt.fX + small, pt.fY + small);
canvas->drawRect(rect, paint);
}

View File

@ -5,13 +5,13 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "GrCaps.h"
#include "GrContext.h"
#include "GrRenderTargetContextPriv.h"
#include "SkRRect.h"
#include "ToolUtils.h"
#include "effects/GrRRectEffect.h"
#include "gm.h"
#include "ops/GrDrawOp.h"
#include "ops/GrFillRectOp.h"
@ -24,7 +24,7 @@ public:
BigRRectAAEffectGM(const SkRRect& rrect, const char* name)
: fRRect(rrect)
, fName(name) {
this->setBGColor(sk_tool_utils::color_to_565(SK_ColorBLUE));
this->setBGColor(ToolUtils::color_to_565(SK_ColorBLUE));
// Each test case draws the rrect with gaps around it.
fTestWidth = SkScalarCeilToInt(rrect.width()) + 2 * kGap;
fTestHeight = SkScalarCeilToInt(rrect.height()) + 2 * kGap;

View File

@ -5,11 +5,11 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkFont.h"
#include "SkPath.h"
#include "ToolUtils.h"
#include "gm.h"
/**
* Skia may draw from outlines when the size is very large, so we exercise that
@ -33,7 +33,7 @@ protected:
void onDraw(SkCanvas* canvas) override {
SkPaint paint;
paint.setAntiAlias(true);
SkFont font(sk_tool_utils::create_portable_typeface(), 1500);
SkFont font(ToolUtils::create_portable_typeface(), 1500);
SkRect r;
(void)font.measureText("/", 1, kUTF8_SkTextEncoding, &r);

View File

@ -5,9 +5,9 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkFont.h"
#include "ToolUtils.h"
#include "gm.h"
namespace skiagm {
@ -82,13 +82,13 @@ protected:
draw_checks(&canvasTmp, 40, 40);
for (unsigned i = 0; i < NUM_CONFIGS; ++i) {
sk_tool_utils::copy_to(&fDst[i], gColorTypes[i], src);
ToolUtils::copy_to(&fDst[i], gColorTypes[i], src);
}
canvas->clear(0xFFDDDDDD);
paint.setAntiAlias(true);
SkFont font(sk_tool_utils::create_portable_typeface());
SkFont font(ToolUtils::create_portable_typeface());
SkScalar width = SkIntToScalar(40);
SkScalar height = SkIntToScalar(40);

View File

@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
static void make_bm(SkBitmap* bm) {
const SkColor colors[4] = {
@ -49,8 +49,8 @@ static SkScalar draw_row(SkCanvas* canvas, const SkBitmap& bm) {
SkScalar x = 0;
const int scale = 32;
SkFont font(sk_tool_utils::create_portable_typeface());
const char* name = sk_tool_utils::colortype_name(bm.colorType());
SkFont font(ToolUtils::create_portable_typeface());
const char* name = ToolUtils::colortype_name(bm.colorType());
canvas->drawString(name, x, SkIntToScalar(bm.height())*scale*5/8,
font, paint);
canvas->translate(SkIntToScalar(48), 0);
@ -67,8 +67,8 @@ static SkScalar draw_row(SkCanvas* canvas, const SkBitmap& bm) {
class FilterGM : public skiagm::GM {
void onOnceBeforeDraw() override {
make_bm(&fBM32);
sk_tool_utils::copy_to(&fBM4444, kARGB_4444_SkColorType, fBM32);
sk_tool_utils::copy_to(&fBM16, kRGB_565_SkColorType, fBM32);
ToolUtils::copy_to(&fBM4444, kARGB_4444_SkColorType, fBM32);
ToolUtils::copy_to(&fBM16, kRGB_565_SkColorType, fBM32);
}
public:

View File

@ -5,7 +5,6 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "SkBlurMask.h"
#include "SkCanvas.h"
#include "SkGradientShader.h"
@ -13,7 +12,8 @@
#include "SkMaskFilter.h"
#include "SkTDArray.h"
#include "SkUTF.h"
#include "sk_tool_utils.h"
#include "ToolUtils.h"
#include "gm.h"
#include "GrContext.h"
#include "GrContextOptions.h"
@ -457,7 +457,7 @@ static sk_sp<SkImage> make_image(SkCanvas* canvas, SkRect* srcR) {
// produce different mipmap filtering when we have an odd sized texture.
const int N = 10 + 2 + 8 + 2 + 10;
SkImageInfo info = SkImageInfo::MakeN32Premul(N, N);
auto surface = sk_tool_utils::makeSurface(canvas, info);
auto surface = ToolUtils::makeSurface(canvas, info);
SkCanvas* c = surface->getCanvas();
SkRect r = SkRect::MakeIWH(info.width(), info.height());
SkPaint paint;
@ -489,7 +489,7 @@ DEF_SIMPLE_GM(bleed_downscale, canvas, 360, 240) {
canvas->save();
for (auto quality : qualities) {
paint.setFilterQuality(quality);
auto surf = sk_tool_utils::makeSurface(canvas, SkImageInfo::MakeN32Premul(1, 1));
auto surf = ToolUtils::makeSurface(canvas, SkImageInfo::MakeN32Premul(1, 1));
surf->getCanvas()->drawImageRect(img, src, SkRect::MakeWH(1, 1), &paint, constraint);
// now blow up the 1 pixel result
canvas->drawImageRect(surf->makeImageSnapshot(), SkRect::MakeWH(100, 100), nullptr);

View File

@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
DEF_SIMPLE_GM(blend, canvas, 300, 100) {
SkPaint p;
@ -30,8 +30,8 @@ DEF_SIMPLE_GM(blend, canvas, 300, 100) {
p.setColor(SK_ColorRED);
canvas->drawRect(SkRect::MakeXYWH(2,0,1,1), p);
canvas->saveLayerAlpha(nullptr, 0xFC);
p.setColor(sk_tool_utils::color_to_565(0xFF208000));
canvas->drawRect(SkRect::MakeXYWH(2,0,1,1), p);
p.setColor(ToolUtils::color_to_565(0xFF208000));
canvas->drawRect(SkRect::MakeXYWH(2, 0, 1, 1), p);
canvas->restore();
canvas->restore();
}

View File

@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkBlurMask.h"
#include "SkCanvas.h"
@ -95,7 +95,7 @@ protected:
void drawOverlay(SkCanvas* canvas) {
canvas->translate(10, 0);
SkFont font(sk_tool_utils::create_portable_typeface());
SkFont font(ToolUtils::create_portable_typeface());
canvas->save();
for (int i = 0; i < kNumBlurs; ++i) {
canvas->drawString(kBlurFlags[i].fName, 100, 0, font, SkPaint());

View File

@ -7,16 +7,15 @@
#include "SkBlurImageFilter.h"
#include "SkMaskFilter.h"
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
DEF_SIMPLE_GM(blurimagevmask, canvas, 700, 1200) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setColor(SK_ColorBLACK);
SkFont font(sk_tool_utils::create_portable_typeface(), 25);
SkFont font(ToolUtils::create_portable_typeface(), 25);
const double sigmas[] = {3.0, 8.0, 16.0, 24.0, 32.0};

View File

@ -5,13 +5,13 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "Resources.h"
#include "SkBlurMask.h"
#include "SkImage.h"
#include "SkMaskFilter.h"
#include "SkPath.h"
#include "ToolUtils.h"
#include "gm.h"
DEF_SIMPLE_GM_BG(blurs, canvas, 700, 500, 0xFFDDDDDD) {
SkBlurStyle NONE = SkBlurStyle(-999);
@ -46,7 +46,7 @@ DEF_SIMPLE_GM_BG(blurs, canvas, 700, 500, 0xFFDDDDDD) {
}
// draw text
{
SkFont font(sk_tool_utils::create_portable_typeface(), 25);
SkFont font(ToolUtils::create_portable_typeface(), 25);
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(4))));
SkScalar x = SkIntToScalar(70);

View File

@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkShader.h"
@ -15,7 +15,7 @@
// the bmp filter respects the repeat mode at the tile seams.
class BmpFilterQualityRepeat : public skiagm::GM {
public:
BmpFilterQualityRepeat() { this->setBGColor(sk_tool_utils::color_to_565(0xFFCCBBAA)); }
BmpFilterQualityRepeat() { this->setBGColor(ToolUtils::color_to_565(0xFFCCBBAA)); }
protected:
@ -26,11 +26,11 @@ protected:
colorBmp.allocN32Pixels(20, 20, true);
colorBmp.eraseColor(0xFFFF0000);
canvas.drawBitmap(colorBmp, 0, 0);
colorBmp.eraseColor(sk_tool_utils::color_to_565(0xFF008200));
colorBmp.eraseColor(ToolUtils::color_to_565(0xFF008200));
canvas.drawBitmap(colorBmp, 20, 0);
colorBmp.eraseColor(sk_tool_utils::color_to_565(0xFFFF9000));
colorBmp.eraseColor(ToolUtils::color_to_565(0xFFFF9000));
canvas.drawBitmap(colorBmp, 0, 20);
colorBmp.eraseColor(sk_tool_utils::color_to_565(0xFF2000FF));
colorBmp.eraseColor(ToolUtils::color_to_565(0xFF2000FF));
canvas.drawBitmap(colorBmp, 20, 20);
}
@ -68,7 +68,7 @@ private:
SkPaint bmpPaint(textPaint);
SkFont font(sk_tool_utils::create_portable_typeface());
SkFont font(ToolUtils::create_portable_typeface());
SkAutoCanvasRestore acr(canvas, true);

View File

@ -5,12 +5,12 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkBlurMask.h"
#include "SkCanvas.h"
#include "SkMaskFilter.h"
#include "SkTextBlob.h"
#include "ToolUtils.h"
#include "gm.h"
#define WIDTH 800
#define HEIGHT 800
@ -42,7 +42,7 @@ protected:
SkPaint paint;
paint.setAntiAlias(true);
SkFont font(sk_tool_utils::create_portable_typeface(), 256);
SkFont font(ToolUtils::create_portable_typeface(), 256);
// setup up maskfilter
const SkScalar kSigma = SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(50));

View File

@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
#include "Resources.h"
#include "SkBlurImageFilter.h"
@ -62,8 +62,8 @@ protected:
const char* text;
} emojiFont;
virtual void onOnceBeforeDraw() override {
emojiFont.typeface = sk_tool_utils::emoji_typeface();
emojiFont.text = sk_tool_utils::emoji_sample_text();
emojiFont.typeface = ToolUtils::emoji_typeface();
emojiFont.text = ToolUtils::emoji_sample_text();
}
SkString onShortName() override {

View File

@ -24,8 +24,8 @@
#include "SkTypeface.h"
#include "SkTypes.h"
#include "SkUTF.h"
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
namespace skiagm {
@ -50,12 +50,11 @@ protected:
paint.setShader(SkGradientShader::MakeSweep(0, 0, colors, nullptr, SK_ARRAY_COUNT(colors),
0, &local));
sk_sp<SkTypeface> orig(sk_tool_utils::create_portable_typeface("serif",
SkFontStyle::Bold()));
sk_sp<SkTypeface> orig(ToolUtils::create_portable_typeface("serif", SkFontStyle::Bold()));
if (nullptr == orig) {
orig = SkTypeface::MakeDefault();
}
fColorType = sk_tool_utils::emoji_typeface();
fColorType = ToolUtils::emoji_typeface();
fBG.installPixels(SkImageInfo::Make(2, 2, kARGB_4444_SkColorType,
kOpaque_SkAlphaType), gData, 4);
@ -112,7 +111,7 @@ protected:
auto s = SkShader::MakeBitmapShader(fBG, SkShader::kRepeat_TileMode,
SkShader::kRepeat_TileMode, &m);
SkFont labelFont(sk_tool_utils::create_portable_typeface());
SkFont labelFont(ToolUtils::create_portable_typeface());
SkPaint textP;
textP.setAntiAlias(true);
@ -141,7 +140,7 @@ protected:
SkAutoCanvasRestore arc(canvas, true);
canvas->clipRect(r);
textP.setBlendMode(gModes[i]);
const char* text = sk_tool_utils::emoji_sample_text();
const char* text = ToolUtils::emoji_sample_text();
SkUnichar unichar = SkUTF::NextUTF8(&text, text + strlen(text));
SkASSERT(unichar >= 0);
canvas->drawSimpleText(&unichar, 4, kUTF32_SkTextEncoding, x+ w/10.f, y + 7.f*h/8.f,

View File

@ -8,8 +8,8 @@
#include "Resources.h"
#include "SkData.h"
#include "SkImage.h"
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
static void draw_image(SkCanvas* canvas, const char* resource, int x, int y) {
sk_sp<SkImage> image(GetResourceAsImage(resource));
@ -31,7 +31,7 @@ static void draw_image(SkCanvas* canvas, const char* resource, int x, int y) {
background and compression artifacts.
*/
DEF_SIMPLE_GM(colorwheel, canvas, 256, 256) {
sk_tool_utils::draw_checkerboard(canvas);
ToolUtils::draw_checkerboard(canvas);
draw_image(canvas, "images/color_wheel.png", 0, 0); // top left
draw_image(canvas, "images/color_wheel.gif", 128, 0); // top right
draw_image(canvas, "images/color_wheel.webp", 0, 128); // bottom left
@ -40,7 +40,7 @@ DEF_SIMPLE_GM(colorwheel, canvas, 256, 256) {
DEF_SIMPLE_GM(colorwheelnative, canvas, 128, 28) {
SkPaint paint;
SkFont font(sk_tool_utils::create_portable_typeface("sans-serif", SkFontStyle::Bold()), 18);
SkFont font(ToolUtils::create_portable_typeface("sans-serif", SkFontStyle::Bold()), 18);
font.setEdging(SkFont::Edging::kAlias);
canvas->clear(SK_ColorLTGRAY);

View File

@ -5,11 +5,11 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkFont.h"
#include "SkPath.h"
#include "ToolUtils.h"
#include "gm.h"
namespace skiagm {
@ -69,7 +69,7 @@ protected:
SkPath clipB;
clipB.addPoly({{40, 10}, {190, 15}, {195, 190}, {40, 185}, {155, 100}}, false).close();
SkFont font(sk_tool_utils::create_portable_typeface(), 20);
SkFont font(ToolUtils::create_portable_typeface(), 20);
constexpr struct {
SkClipOp fOp;

View File

@ -4,10 +4,10 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkPath.h"
#include "ToolUtils.h"
#include "gm.h"
#include <utility>
@ -53,7 +53,7 @@ protected:
SkPaint paint;
paint.setAntiAlias(true);
SkFont font(sk_tool_utils::create_portable_typeface(), 20);
SkFont font(ToolUtils::create_portable_typeface(), 20);
constexpr struct {
SkClipOp fOp;

View File

@ -5,12 +5,12 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "SkBlurImageFilter.h"
#include "SkClipOpPriv.h"
#include "SkRRect.h"
#include "SkSurface.h"
#include "SkClipOpPriv.h"
#include "sk_tool_utils.h"
#include "ToolUtils.h"
#include "gm.h"
#define WIDTH 512
#define HEIGHT 512
@ -38,7 +38,7 @@ protected:
SkRect bounds = canvas->getLocalClipBounds();
int ts = SkScalarCeilToInt(tileSize);
SkImageInfo info = SkImageInfo::MakeN32Premul(ts, ts);
auto tileSurface(sk_tool_utils::makeSurface(canvas, info));
auto tileSurface(ToolUtils::makeSurface(canvas, info));
SkCanvas* tileCanvas = tileSurface->getCanvas();
for (SkScalar y = bounds.top(); y < bounds.bottom(); y += tileSize) {
for (SkScalar x = bounds.left(); x < bounds.right(); x += tileSize) {

View File

@ -7,8 +7,8 @@
// This test only works with the GPU backend.
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
#include "GrContext.h"
#include "GrRenderTargetContextPriv.h"
@ -103,7 +103,7 @@ protected:
// Draw labels for the input to the processor and the processor to the right of
// the test rect. The input label appears above the processor label.
SkFont labelFont;
labelFont.setTypeface(sk_tool_utils::create_portable_typeface());
labelFont.setTypeface(ToolUtils::create_portable_typeface());
labelFont.setEdging(SkFont::Edging::kAntiAlias);
labelFont.setSize(10.f);
SkPaint labelPaint;

View File

@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkBitmap.h"
#include "SkFont.h"
@ -26,12 +26,13 @@ static SkBitmap make_bmp(int w, int h) {
SkScalar radius = 3 * SkMaxScalar(wScalar, hScalar);
SkColor colors[] = { SK_ColorDKGRAY,
sk_tool_utils::color_to_565(0xFF222255),
sk_tool_utils::color_to_565(0xFF331133),
sk_tool_utils::color_to_565(0xFF884422),
sk_tool_utils::color_to_565(0xFF000022), SK_ColorWHITE,
sk_tool_utils::color_to_565(0xFFAABBCC) };
SkColor colors[] = {SK_ColorDKGRAY,
ToolUtils::color_to_565(0xFF222255),
ToolUtils::color_to_565(0xFF331133),
ToolUtils::color_to_565(0xFF884422),
ToolUtils::color_to_565(0xFF000022),
SK_ColorWHITE,
ToolUtils::color_to_565(0xFFAABBCC)};
SkScalar pos[] = {0,
SK_Scalar1 / 6,
@ -57,7 +58,7 @@ static SkBitmap make_bmp(int w, int h) {
mat.postScale(SK_Scalar1 / 3, SK_Scalar1 / 3);
}
SkFont font(sk_tool_utils::create_portable_typeface(), wScalar / 2.2f);
SkFont font(ToolUtils::create_portable_typeface(), wScalar / 2.2f);
paint.setShader(nullptr);
paint.setColor(SK_ColorLTGRAY);
@ -150,7 +151,7 @@ protected:
canvas->drawBitmapRect(fBmp, SkRect::MakeIWH(size.fWidth, size.fHeight), &bgPaint);
constexpr char kTxt[] = "Clip Me!";
SkFont font(sk_tool_utils::create_portable_typeface(), 23);
SkFont font(ToolUtils::create_portable_typeface(), 23);
SkScalar textW = font.measureText(kTxt, SK_ARRAY_COUNT(kTxt)-1, kUTF8_SkTextEncoding);
SkPaint txtPaint;
txtPaint.setColor(SK_ColorDKGRAY);

View File

@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
#include "Resources.h"
#include "SkCanvas.h"
@ -39,7 +39,7 @@ protected:
canvas->drawBitmap(bm, 0, 0);
// This should dither or we will see artifacts in the background of the image.
SkAssertResult(sk_tool_utils::copy_to(&bm4444, kARGB_4444_SkColorType, bm));
SkAssertResult(ToolUtils::copy_to(&bm4444, kARGB_4444_SkColorType, bm));
canvas->drawBitmap(bm4444, SkIntToScalar(bm.width()), 0);
return DrawResult::kOk;
}

View File

@ -5,12 +5,12 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkPaint.h"
#include "SkPath.h"
#include "SkRandom.h"
#include "ToolUtils.h"
#include "gm.h"
// https://bug.skia.org/1316 shows that this cubic, when slightly clipped, creates big
// (incorrect) changes to its control points.
@ -198,7 +198,7 @@ protected:
SkPaint titlePaint;
titlePaint.setColor(SK_ColorBLACK);
titlePaint.setAntiAlias(true);
SkFont font(sk_tool_utils::create_portable_typeface(), 15);
SkFont font(ToolUtils::create_portable_typeface(), 15);
const char title[] = "Cubic Drawn Into Rectangle Clips With "
"Indicated Style, Fill and Linecaps, with stroke width 10";
canvas->drawString(title, 20, 20, font, titlePaint);
@ -328,7 +328,7 @@ protected:
SkPaint titlePaint;
titlePaint.setColor(SK_ColorBLACK);
titlePaint.setAntiAlias(true);
SkFont font(sk_tool_utils::create_portable_typeface(), 15);
SkFont font(ToolUtils::create_portable_typeface(), 15);
const char title[] = "Cubic Closed Drawn Into Rectangle Clips With "
"Indicated Style, Fill and Linecaps, with stroke width 10";
canvas->drawString(title, 20, 20, font, titlePaint);

View File

@ -5,11 +5,11 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkPaint.h"
#include "SkDashPathEffect.h"
#include "SkPaint.h"
#include "ToolUtils.h"
#include "gm.h"
static void drawline(SkCanvas* canvas, int on, int off, const SkPaint& paint,
SkScalar finalX = SkIntToScalar(600), SkScalar finalY = SkIntToScalar(0),
@ -562,7 +562,7 @@ DEF_SIMPLE_GM(dashtextcaps, canvas, 512, 512) {
p.setStrokeJoin(SkPaint::kRound_Join);
p.setARGB(0xff, 0xbb, 0x00, 0x00);
SkFont font(sk_tool_utils::create_portable_typeface(), 100);
SkFont font(ToolUtils::create_portable_typeface(), 100);
const SkScalar intervals[] = { 12, 12 };
p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));

View File

@ -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 "gm.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkPaint.h"
#include "SkPath.h"
#include "SkRandom.h"
#include "ToolUtils.h"
#include "gm.h"
namespace skiagm {
@ -289,7 +289,7 @@ protected:
SkPaint titlePaint;
titlePaint.setColor(SK_ColorBLACK);
titlePaint.setAntiAlias(true);
SkFont font(sk_tool_utils::create_portable_typeface(), 15);
SkFont font(ToolUtils::create_portable_typeface(), 15);
const char title[] = "Random Paths Drawn Into Rectangle Clips With "
"Indicated Style, Fill and Linecaps, "
"with Stroke width 6";
@ -314,7 +314,7 @@ protected:
canvas->translate(rect.width() + 4*SK_Scalar1, 0);
}
SkColor color = sk_tool_utils::color_to_565(0xff007000);
SkColor color = ToolUtils::color_to_565(0xff007000);
StyleAndName style = gStyles[(rand.nextU() >> 16) % numStyles];
CapAndName cap = gCaps[(rand.nextU() >> 16) % numCaps];
FillAndName fill = gFills[(rand.nextU() >> 16) % numFills];

View File

@ -13,8 +13,8 @@
#include "SkTextBlob.h"
#include "SkTo.h"
#include "SkTypeface.h"
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
class DFTextGM : public skiagm::GM {
public:
@ -24,8 +24,8 @@ public:
protected:
void onOnceBeforeDraw() override {
fEmojiTypeface = sk_tool_utils::emoji_typeface();
fEmojiText = sk_tool_utils::emoji_sample_text();
fEmojiTypeface = ToolUtils::emoji_typeface();
fEmojiText = ToolUtils::emoji_sample_text();
}
SkString onShortName() override {
@ -58,7 +58,7 @@ protected:
SkPaint paint;
paint.setAntiAlias(true);
SkFont font(sk_tool_utils::create_portable_typeface("serif", SkFontStyle()));
SkFont font(ToolUtils::create_portable_typeface("serif", SkFontStyle()));
font.setSubpixel(true);
const char* text = "Hamburgefons";

View File

@ -5,13 +5,13 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "Resources.h"
#include "SkCanvas.h"
#include "SkSurface.h"
#include "SkTextBlob.h"
#include "SkTypeface.h"
#include "sk_tool_utils.h"
#include "ToolUtils.h"
#include "gm.h"
/**
* This GM tests reusing the same text blobs with distance fields rendering using various
@ -38,7 +38,7 @@ protected:
SkFont::Edging::kSubpixelAntiAlias));
font.setSubpixel(true);
SkTextBlobBuilder builder;
sk_tool_utils::add_to_text_blob(&builder, "SkiaText", font, 0, 0);
ToolUtils::add_to_text_blob(&builder, "SkiaText", font, 0, 0);
fBlobs.emplace_back(builder.make());
}
}

View File

@ -5,12 +5,12 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkPaint.h"
#include "SkRandom.h"
#include "SkSurface.h"
#include "ToolUtils.h"
#include "gm.h"
namespace skiagm {
@ -52,7 +52,7 @@ protected:
for (int y = 0; y < 10; ++y) {
surface->getCanvas()->discard();
// Make something that isn't too close to the background color, black.
SkColor color = sk_tool_utils::color_to_565(rand.nextU() | 0xFF404040);
SkColor color = ToolUtils::color_to_565(rand.nextU() | 0xFF404040);
switch (rand.nextULessThan(3)) {
case 0:
surface->getCanvas()->drawColor(color);

View File

@ -8,8 +8,8 @@
#include "SkDisplacementMapEffect.h"
#include "SkImage.h"
#include "SkImageSource.h"
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
namespace skiagm {
@ -25,21 +25,17 @@ protected:
}
void onOnceBeforeDraw() override {
fBitmap = sk_tool_utils::create_string_bitmap(80, 80, 0xFF884422, 15, 55, 96, "g");
fBitmap = ToolUtils::create_string_bitmap(80, 80, 0xFF884422, 15, 55, 96, "g");
SkColor c1 = sk_tool_utils::color_to_565(0xFF244484);
SkColor c2 = sk_tool_utils::color_to_565(0xFF804020);
SkColor c1 = ToolUtils::color_to_565(0xFF244484);
SkColor c2 = ToolUtils::color_to_565(0xFF804020);
fCheckerboard = SkImage::MakeFromBitmap(
sk_tool_utils::create_checkerboard_bitmap(80, 80, c1, c2, 8));
fSmall = SkImage::MakeFromBitmap(
sk_tool_utils::create_checkerboard_bitmap(64, 64, c1, c2, 8));
fLarge = SkImage::MakeFromBitmap(
sk_tool_utils::create_checkerboard_bitmap(96, 96, c1, c2, 8));
fLargeW =
SkImage::MakeFromBitmap(sk_tool_utils::create_checkerboard_bitmap(96, 64, c1, c2, 8));
fLargeH = SkImage::MakeFromBitmap(
sk_tool_utils::create_checkerboard_bitmap(64, 96, c1, c2, 8));
fCheckerboard =
SkImage::MakeFromBitmap(ToolUtils::create_checkerboard_bitmap(80, 80, c1, c2, 8));
fSmall = SkImage::MakeFromBitmap(ToolUtils::create_checkerboard_bitmap(64, 64, c1, c2, 8));
fLarge = SkImage::MakeFromBitmap(ToolUtils::create_checkerboard_bitmap(96, 96, c1, c2, 8));
fLargeW = SkImage::MakeFromBitmap(ToolUtils::create_checkerboard_bitmap(96, 64, c1, c2, 8));
fLargeH = SkImage::MakeFromBitmap(ToolUtils::create_checkerboard_bitmap(64, 96, c1, c2, 8));
}
SkISize onISize() override {

View File

@ -6,8 +6,8 @@
*/
#include "Resources.h"
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
static const char* kFilterQualityNames[] = { "none", "low", "medium", "high" };
@ -87,13 +87,13 @@ static SkBitmap make_text(SkImageInfo info) {
font.setSubpixel(true);
font.setSize(textSize);
font.setTypeface(sk_tool_utils::create_portable_typeface("serif", SkFontStyle()));
font.setTypeface(ToolUtils::create_portable_typeface("serif", SkFontStyle()));
canvas.drawString("Hamburgefons", textSize/2, 1.2f*textSize, font, paint);
font.setTypeface(sk_tool_utils::create_portable_typeface("serif", SkFontStyle::Bold()));
font.setTypeface(ToolUtils::create_portable_typeface("serif", SkFontStyle::Bold()));
canvas.drawString("Hamburgefons", textSize/2, 2.4f*textSize, font, paint);
font.setTypeface(sk_tool_utils::create_portable_typeface("serif", SkFontStyle::Italic()));
font.setTypeface(ToolUtils::create_portable_typeface("serif", SkFontStyle::Italic()));
canvas.drawString("Hamburgefons", textSize/2, 3.6f*textSize, font, paint);
font.setTypeface(sk_tool_utils::create_portable_typeface("serif", SkFontStyle::BoldItalic()));
font.setTypeface(ToolUtils::create_portable_typeface("serif", SkFontStyle::BoldItalic()));
canvas.drawString("Hamburgefons", textSize/2, 4.8f*textSize, font, paint);
return bm;

View File

@ -12,12 +12,12 @@
#include "SkRSXform.h"
#include "SkSurface.h"
#include "SkTextBlob.h"
#include "sk_tool_utils.h"
#include "ToolUtils.h"
class DrawAtlasGM : public skiagm::GM {
static sk_sp<SkImage> MakeAtlas(SkCanvas* caller, const SkRect& target) {
SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
auto surface(sk_tool_utils::makeSurface(caller, info));
auto surface(ToolUtils::makeSurface(caller, info));
SkCanvas* canvas = surface->getCanvas();
// draw red everywhere, but we don't expect to see it in the draw, testing the notion
// that drawAtlas draws a subset-region of the atlas.
@ -212,7 +212,7 @@ DEF_SIMPLE_GM(drawTextRSXform, canvas, 430, 860) {
// Exercise xform blob and its bounds
DEF_SIMPLE_GM(blob_rsxform, canvas, 500, 100) {
SkFont font;
font.setTypeface(sk_tool_utils::create_portable_typeface());
font.setTypeface(ToolUtils::create_portable_typeface());
font.setSize(50);
const char text[] = "CrazyXform";

View File

@ -5,11 +5,11 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkRSXform.h"
#include "SkSurface.h"
#include "ToolUtils.h"
#include "gm.h"
// Create a square atlas of:
// opaque white | opaque red
@ -20,7 +20,7 @@ static sk_sp<SkImage> make_atlas(SkCanvas* caller, int atlasSize) {
const int kBlockSize = atlasSize/2;
SkImageInfo info = SkImageInfo::MakeN32Premul(atlasSize, atlasSize);
auto surface(sk_tool_utils::makeSurface(caller, info));
auto surface(ToolUtils::makeSurface(caller, info));
SkCanvas* canvas = surface->getCanvas();
SkPaint paint;
@ -128,7 +128,7 @@ protected:
quadColors[i] = gColors[i];
}
SkFont font(sk_tool_utils::create_portable_typeface(), kTextPad);
SkFont font(ToolUtils::create_portable_typeface(), kTextPad);
for (int i = 0; i < numModes; ++i) {
const char* label = SkBlendMode_Name(gModes[i]);

View File

@ -5,8 +5,6 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkBlurMask.h"
#include "SkBlurMaskFilter.h"
#include "SkColorPriv.h"
@ -16,7 +14,8 @@
#include "SkMathPriv.h"
#include "SkShader.h"
#include "SkSurface.h"
#include "ToolUtils.h"
#include "gm.h"
static SkBitmap make_chessbm(int w, int h) {
SkBitmap bm;
@ -35,7 +34,7 @@ static SkBitmap make_chessbm(int w, int h) {
static sk_sp<SkImage> makebm(SkCanvas* origCanvas, SkBitmap* resultBM, int w, int h) {
SkImageInfo info = SkImageInfo::MakeN32Premul(w, h);
auto surface(sk_tool_utils::makeSurface(origCanvas, info));
auto surface(ToolUtils::makeSurface(origCanvas, info));
SkCanvas* canvas = surface->getCanvas();
canvas->clear(SK_ColorTRANSPARENT);
@ -172,7 +171,7 @@ protected:
blackPaint.setColor(SK_ColorBLACK);
blackPaint.setAntiAlias(true);
SkFont font(sk_tool_utils::create_portable_typeface(), titleHeight);
SkFont font(ToolUtils::create_portable_typeface(), titleHeight);
SkString title;
title.printf("Bitmap size: %d x %d", gBmpSize, gBmpSize);

View File

@ -10,7 +10,7 @@
#include <algorithm>
#include "SkGradientShader.h"
#include "SkSurface.h"
#include "sk_tool_utils.h"
#include "ToolUtils.h"
// Makes a set of m x n tiled images to be drawn with SkCanvas::experimental_drawImageSetV1().
static void make_image_tiles(int tileW, int tileH, int m, int n, const SkColor colors[4],
@ -183,7 +183,7 @@ private:
}
void onDraw(SkCanvas* canvas) override {
sk_tool_utils::draw_checkerboard(canvas, SK_ColorBLACK, SK_ColorWHITE, 50);
ToolUtils::draw_checkerboard(canvas, SK_ColorBLACK, SK_ColorWHITE, 50);
static constexpr SkScalar kW = kM * kTileW;
static constexpr SkScalar kH = kN * kTileH;
SkMatrix matrices[5];

View File

@ -5,14 +5,14 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkBlurMask.h"
#include "SkCanvas.h"
#include "SkGraphics.h"
#include "SkLayerDrawLooper.h"
#include "SkMaskFilter.h"
#include "SkRandom.h"
#include "ToolUtils.h"
#include "gm.h"
#define WIDTH 200
#define HEIGHT 200
@ -39,7 +39,7 @@ protected:
paint.setAntiAlias(true);
paint.setLooper(fLooper);
SkFont font(sk_tool_utils::create_portable_typeface(), 72);
SkFont font(ToolUtils::create_portable_typeface(), 72);
canvas->drawCircle(50, 50, 30, paint);
canvas->drawRect({ 150, 50, 200, 100 }, paint);

View File

@ -5,12 +5,12 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkColorFilter.h"
#include "SkColorFilterImageFilter.h"
#include "SkDropShadowImageFilter.h"
#include "SkTextUtils.h"
#include "ToolUtils.h"
#include "gm.h"
///////////////////////////////////////////////////////////////////////////////
@ -41,7 +41,7 @@ static void draw_text(SkCanvas* canvas, const SkRect& r, sk_sp<SkImageFilter> im
paint.setColor(SK_ColorGREEN);
paint.setAntiAlias(true);
SkFont font(sk_tool_utils::create_portable_typeface(), r.height()/2);
SkFont font(ToolUtils::create_portable_typeface(), r.height() / 2);
canvas->save();
canvas->clipRect(r);
SkTextUtils::DrawString(canvas, "Text", r.centerX(), r.centerY(), font, paint, SkTextUtils::kCenter_Align);

View File

@ -4,13 +4,13 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkBitmap.h"
#include "SkPath.h"
#include "SkRandom.h"
#include "SkShader.h"
#include "SkSurface.h"
#include "ToolUtils.h"
#include "gm.h"
namespace skiagm {
@ -82,7 +82,7 @@ protected:
break;
case kText_ShapeType: {
const char* text = "N";
SkFont font(sk_tool_utils::create_portable_typeface(), 100);
SkFont font(ToolUtils::create_portable_typeface(), 100);
font.setEmbolden(true);
canvas->drawString(text, 0.f, 100.f, font, *paint);
}
@ -92,7 +92,7 @@ protected:
}
static SkColor GetColor(SkRandom* random) {
SkColor color = sk_tool_utils::color_to_565(random->nextU() | 0xFF000000);
SkColor color = ToolUtils::color_to_565(random->nextU() | 0xFF000000);
return SkColorSetA(color, 0x80);
}

View File

@ -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 "gm.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkPaint.h"
#include "SkPath.h"
#include "SkRandom.h"
#include "ToolUtils.h"
#include "gm.h"
namespace skiagm {
@ -61,7 +61,7 @@ protected:
{SkPaint::kStrokeAndFill_Style, "Stroke And Fill"},
};
SkFont font(sk_tool_utils::create_portable_typeface(), 15);
SkFont font(ToolUtils::create_portable_typeface(), 15);
const char title[] = "Empty Paths Drawn Into Rectangle Clips With "
"Indicated Style and Fill";
canvas->drawString(title, 20.0f, 20.0f, font, SkPaint());
@ -86,7 +86,7 @@ protected:
SkColor color = rand.nextU();
color = 0xff000000 | color; // force solid
color = sk_tool_utils::color_to_565(color);
color = ToolUtils::color_to_565(color);
this->drawEmpty(canvas, color, rect,
gStyles[style].fStyle, gFills[fill].fFill);
@ -99,7 +99,7 @@ protected:
SkPaint labelPaint;
labelPaint.setColor(color);
SkFont labelFont(sk_tool_utils::create_portable_typeface(), 12);
SkFont labelFont(ToolUtils::create_portable_typeface(), 12);
canvas->drawString(gStyles[style].fName, 0, rect.height() + 15.0f,
labelFont, labelPaint);
canvas->drawString(gFills[fill].fName, 0, rect.height() + 28.0f,

View File

@ -5,10 +5,10 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkImage.h"
#include "SkRandom.h"
#include "ToolUtils.h"
#include "gm.h"
#if SK_SUPPORT_GPU && !defined(SK_BUILD_FOR_GOOGLE3)
#include "etc1.h"

View File

@ -5,11 +5,11 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkPath.h"
#include "SkSurface.h"
#include "ToolUtils.h"
#include "gm.h"
#define ZOOM 32
#define SMALL_W 9
@ -22,7 +22,7 @@ static sk_sp<SkSurface> new_surface(int width, int height) {
static void draw_pixel_centers(SkCanvas* canvas) {
SkPaint paint;
paint.setColor(sk_tool_utils::color_to_565(0xFF0088FF));
paint.setColor(ToolUtils::color_to_565(0xFF0088FF));
paint.setAntiAlias(true);
for (int y = 0; y < SMALL_H; ++y) {

View File

@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
#include "Resources.h"
#include "SkGradientShader.h"
@ -14,7 +14,7 @@
#include "SkTypeface.h"
static void setTypeface(SkFont* font, const char name[], SkFontStyle style) {
font->setTypeface(sk_tool_utils::create_portable_typeface(name, style));
font->setTypeface(ToolUtils::create_portable_typeface(name, style));
}
static SkSize computeSize(const SkBitmap& bm, const SkMatrix& mat) {
@ -170,7 +170,7 @@ public:
}
if (fConvertToG8) {
SkBitmap tmp;
sk_tool_utils::copy_to_g8(&tmp, fBM);
ToolUtils::copy_to_g8(&tmp, fBM);
fBM = tmp;
}
}
@ -205,7 +205,7 @@ protected:
if (fConvertToG8) {
SkBitmap tmp;
sk_tool_utils::copy_to_g8(&tmp, fBM);
ToolUtils::copy_to_g8(&tmp, fBM);
fBM = tmp;
}
}

View File

@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
#include "Resources.h"
#include "SkBitmapProcState.h"
@ -60,9 +60,7 @@ public:
SkMatrix fMatrix[2];
SkString fName;
FilterIndiaBoxGM() {
this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD));
}
FilterIndiaBoxGM() { this->setBGColor(ToolUtils::color_to_565(0xFFDDDDDD)); }
FilterIndiaBoxGM(const char filename[]) : fFilename(filename) {
fName.printf("filterindiabox");

View File

@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkSurface.h"
@ -64,7 +64,7 @@ static sk_sp<SkImage> make_text_image(GrContext* context, const char* text, SkCo
SkFont font;
font.setEdging(SkFont::Edging::kAntiAlias);
font.setTypeface(sk_tool_utils::create_portable_typeface());
font.setTypeface(ToolUtils::create_portable_typeface());
font.setSize(32);
SkRect bounds;

View File

@ -11,14 +11,14 @@
#include "gm.h"
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrContextOptions.h"
#include "GrContextPriv.h"
#include "SkCanvas.h"
#include "SkGraphics.h"
#include "SkImage.h"
#include "SkTypeface.h"
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
static SkScalar draw_string(SkCanvas* canvas, const SkString& text, SkScalar x,
SkScalar y, const SkFont& font) {
@ -51,13 +51,12 @@ protected:
SkISize onISize() override { return SkISize::Make(kSize, kSize); }
void onOnceBeforeDraw() override {
fTypefaces[0] = sk_tool_utils::create_portable_typeface("serif", SkFontStyle::Italic());
fTypefaces[1] = sk_tool_utils::create_portable_typeface("sans-serif",SkFontStyle::Italic());
fTypefaces[2] = sk_tool_utils::create_portable_typeface("serif", SkFontStyle::Normal());
fTypefaces[3] =
sk_tool_utils::create_portable_typeface("sans-serif", SkFontStyle::Normal());
fTypefaces[4] = sk_tool_utils::create_portable_typeface("serif", SkFontStyle::Bold());
fTypefaces[5] = sk_tool_utils::create_portable_typeface("sans-serif", SkFontStyle::Bold());
fTypefaces[0] = ToolUtils::create_portable_typeface("serif", SkFontStyle::Italic());
fTypefaces[1] = ToolUtils::create_portable_typeface("sans-serif", SkFontStyle::Italic());
fTypefaces[2] = ToolUtils::create_portable_typeface("serif", SkFontStyle::Normal());
fTypefaces[3] = ToolUtils::create_portable_typeface("sans-serif", SkFontStyle::Normal());
fTypefaces[4] = ToolUtils::create_portable_typeface("serif", SkFontStyle::Bold());
fTypefaces[5] = ToolUtils::create_portable_typeface("sans-serif", SkFontStyle::Bold());
}
void onDraw(GrContext*, GrRenderTargetContext*, SkCanvas* canvas) override {

View File

@ -13,8 +13,8 @@
#include "SkGraphics.h"
#include "SkPath.h"
#include "SkTypeface.h"
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
// limit this just so we don't take too long to draw
#define MAX_FAMILIES 30
@ -271,7 +271,7 @@ public:
SkFont labelFont;
labelFont.setEdging(SkFont::Edging::kAntiAlias);
labelFont.setTypeface(sk_tool_utils::create_portable_typeface());
labelFont.setTypeface(ToolUtils::create_portable_typeface());
if (FLAGS_veryVerbose) {
SkString name;

View File

@ -24,7 +24,7 @@
#include "SkTypeface.h"
#include "gm.h"
#include "sk_tool_utils.h"
#include "ToolUtils.h"
static sk_sp<SkTextBlob> make_blob(const SkString& text, const SkFont& font) {
size_t len = text.size();
@ -56,7 +56,7 @@ protected:
SkISize onISize() override { return SkISize::Make(kSize, kSize); }
void onOnceBeforeDraw() override {
auto tf = sk_tool_utils::create_portable_typeface("sans-serif", SkFontStyle::Normal());
auto tf = ToolUtils::create_portable_typeface("sans-serif", SkFontStyle::Normal());
static const SkString kTexts[] = {
SkString("abcdefghijklmnopqrstuvwxyz"),

View File

@ -5,9 +5,9 @@
* found in the LICENSE file.
*/
#include <SkFont.h>
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkTypeface.h"
#include "ToolUtils.h"
#include "gm.h"
namespace skiagm {

View File

@ -5,9 +5,9 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkTextUtils.h"
#include "ToolUtils.h"
#include "gm.h"
#if SK_SUPPORT_GPU

View File

@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
#include "Resources.h"
#include "SkBlendModePriv.h"
@ -49,7 +49,7 @@ DEF_SIMPLE_GM(gamma, canvas, 850, 200) {
mipmapPixels[0] = mipmapPixels[3] = SkPackARGB32(0xFF, s25, s25, s25);
mipmapPixels[1] = mipmapPixels[2] = SkPackARGB32(0xFF, s75, s75, s75);
SkFont font(sk_tool_utils::create_portable_typeface());
SkFont font(ToolUtils::create_portable_typeface());
SkPaint textPaint;
textPaint.setAntiAlias(true);

View File

@ -5,12 +5,12 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkPath.h"
#include "SkGradientShader.h"
#include "SkPath.h"
#include "SkTypeface.h"
#include "ToolUtils.h"
#include "gm.h"
static sk_sp<SkShader> make_heatGradient(const SkPoint pts[2]) {
const SkColor bw[] = { SK_ColorBLACK, SK_ColorWHITE };

View File

@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkFontPriv.h"
@ -30,7 +30,7 @@ DEF_SIMPLE_GM(getpostextpath, canvas, 480, 780) {
SkPath path;
SkFont font;
font.setTypeface(sk_tool_utils::create_portable_typeface());
font.setTypeface(ToolUtils::create_portable_typeface());
font.setSize(48);
SkPaint paint;
@ -39,7 +39,7 @@ DEF_SIMPLE_GM(getpostextpath, canvas, 480, 780) {
canvas->translate(SkIntToScalar(10), SkIntToScalar(64));
canvas->drawSimpleText(text, len, kUTF8_SkTextEncoding, 0, 0, font, paint);
sk_tool_utils::get_text_path(font, text, len, kUTF8_SkTextEncoding, &path, nullptr);
ToolUtils::get_text_path(font, text, len, kUTF8_SkTextEncoding, &path, nullptr);
strokePath(canvas, path);
path.reset();
@ -60,6 +60,6 @@ DEF_SIMPLE_GM(getpostextpath, canvas, 480, 780) {
canvas->translate(0, SkIntToScalar(64));
canvas->drawTextBlob(SkTextBlob::MakeFromPosText(text, len, &pos[0], font), 0, 0, paint);
sk_tool_utils::get_text_path(font, text, len, kUTF8_SkTextEncoding, &path, &pos[0]);
ToolUtils::get_text_path(font, text, len, kUTF8_SkTextEncoding, &path, &pos[0]);
strokePath(canvas, path);
}

View File

@ -5,11 +5,11 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkFont.h"
#include "SkTypeface.h"
#include "ToolUtils.h"
#include "gm.h"
/* This test tries to define the effect of using hairline strokes on text.
* Provides non-hairline images for reference and consistency checks.
@ -87,7 +87,7 @@ static void drawTestCase(SkCanvas* canvas,
paint.setStrokeWidth(strokeWidth);
paint.setStyle(strokeStyle);
SkFont font(sk_tool_utils::create_portable_typeface(), kTextHeight * textScale);
SkFont font(ToolUtils::create_portable_typeface(), kTextHeight * textScale);
// This demonstrates that we can not measure the text if
// there's a device transform. The canvas total matrix will

View File

@ -8,9 +8,9 @@
#include "gm.h"
#include "GrContext.h"
#include "sk_tool_utils.h"
#include "SkShader.h"
#include "SkTraceEvent.h"
#include "ToolUtils.h"
using namespace skiagm;
constexpr char GM::kErrorMsg_DrawSkippedGpuOnly[];
@ -38,7 +38,7 @@ static void draw_gpu_only_message(SkCanvas* canvas) {
bmp.allocN32Pixels(128, 64);
SkCanvas bmpCanvas(bmp);
bmpCanvas.drawColor(SK_ColorWHITE);
SkFont font(sk_tool_utils::create_portable_typeface(), 20);
SkFont font(ToolUtils::create_portable_typeface(), 20);
SkPaint paint;
paint.setColor(SK_ColorRED);
bmpCanvas.drawString("GPU Only", 20, 40, font, paint);

View File

@ -5,11 +5,11 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkGradientShader.h"
#include "SkTypeface.h"
#include "ToolUtils.h"
#include "gm.h"
// test shader w/ transparency
static sk_sp<SkShader> make_grad(SkScalar width) {
@ -55,7 +55,7 @@ protected:
// Minimal repro doesn't require AA, LCD, or a nondefault typeface
paint.setShader(make_chrome_solid());
SkFont font(sk_tool_utils::create_portable_typeface(), 500);
SkFont font(ToolUtils::create_portable_typeface(), 500);
font.setEdging(SkFont::Edging::kAlias);
canvas->drawString("I", 0, 100, font, paint);
@ -75,7 +75,7 @@ protected:
virtual SkISize onISize() { return SkISize::Make(500, 480); }
virtual void onDraw(SkCanvas* canvas) {
SkPaint paint;
SkFont font(sk_tool_utils::create_portable_typeface());
SkFont font(ToolUtils::create_portable_typeface());
font.setEdging(SkFont::Edging::kAlias);
paint.setStyle(SkPaint::kFill_Style);
@ -103,7 +103,7 @@ DEF_GM( return new ChromeGradTextGM2; )
DEF_SIMPLE_GM(gradtext, canvas, 500, 480) {
static constexpr float kTextSize = 26.0f;
SkFont font(sk_tool_utils::create_portable_typeface(), kTextSize);
SkFont font(ToolUtils::create_portable_typeface(), kTextSize);
canvas->drawRect({0, 0, 500, 240}, SkPaint());
canvas->translate(20.0f, kTextSize);

View File

@ -5,12 +5,12 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkFont.h"
#include "SkGradientShader.h"
#include "SkHighContrastFilter.h"
#include "ToolUtils.h"
#include "gm.h"
using InvertStyle = SkHighContrastConfig::InvertStyle;
@ -32,7 +32,7 @@ static void draw_label(SkCanvas* canvas, const SkHighContrastConfig& config) {
config.fContrast);
SkFont font;
font.setTypeface(sk_tool_utils::create_portable_typeface());
font.setTypeface(ToolUtils::create_portable_typeface());
font.setSize(0.05f);
font.setEdging(SkFont::Edging::kAlias);

View File

@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
// Hue, Saturation, Color, and Luminosity blend modes are oddballs.
// They nominally convert their inputs to unpremul, then to HSL, then
@ -146,7 +146,7 @@ static SkColor blend(SkColor dst, SkColor src,
DEF_SIMPLE_GM(hsl, canvas, 600, 100) {
SkPaint paint;
SkFont font(sk_tool_utils::create_portable_typeface());
SkFont font(ToolUtils::create_portable_typeface());
const char* comment = "HSL blend modes are correct when you see no circles in the squares.";
canvas->drawString(comment, 10,10, font, paint);

View File

@ -13,8 +13,8 @@
#include "SkRandom.h"
#include "SkStream.h"
#include "SkSurface.h"
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
#include <functional>
@ -113,7 +113,7 @@ protected:
void onDraw(SkCanvas* canvas) override {
canvas->scale(2, 2);
SkFont font(sk_tool_utils::create_portable_typeface(), 8);
SkFont font(ToolUtils::create_portable_typeface(), 8);
canvas->drawString("Original Img", 10, 60, font, SkPaint());
canvas->drawString("Modified Img", 10, 140, font, SkPaint());
@ -398,7 +398,7 @@ static sk_sp<SkImage> serial_deserial(SkImage* img) {
DEF_SIMPLE_GM_CAN_FAIL(image_subset, canvas, errorMsg, 440, 220) {
SkImageInfo info = SkImageInfo::MakeN32Premul(200, 200, nullptr);
auto surf = sk_tool_utils::makeSurface(canvas, info, nullptr);
auto surf = ToolUtils::makeSurface(canvas, info, nullptr);
auto img = make_lazy_image(surf.get());
if (!img) {
*errorMsg = "Failed to make lazy image.";

View File

@ -5,14 +5,14 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "SkAlphaThresholdFilter.h"
#include "SkImageSource.h"
#include "SkOffsetImageFilter.h"
#include "SkRandom.h"
#include "SkRegion.h"
#include "SkSurface.h"
#include "sk_tool_utils.h"
#include "ToolUtils.h"
#include "gm.h"
#define WIDTH 500
#define HEIGHT 500
@ -104,7 +104,7 @@ static sk_sp<SkSurface> make_color_matching_surface(SkCanvas* canvas, int width,
SkImageInfo info = SkImageInfo::Make(width, height, ct, at, std::move(cs));
return sk_tool_utils::makeSurface(canvas, info);
return ToolUtils::makeSurface(canvas, info);
}
class ImageAlphaThresholdSurfaceGM : public skiagm::GM {

View File

@ -5,10 +5,10 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkBlurImageFilter.h"
#include "SkRandom.h"
#include "ToolUtils.h"
#include "gm.h"
#define WIDTH 500
#define HEIGHT 500
@ -21,11 +21,11 @@ void imageblurgm_draw(SkScalar fSigmaX, SkScalar fSigmaY, SkCanvas* canvas) {
SkRandom rand;
SkPaint textPaint;
SkFont font(sk_tool_utils::create_portable_typeface());
SkFont font(ToolUtils::create_portable_typeface());
for (int i = 0; i < 25; ++i) {
int x = rand.nextULessThan(WIDTH);
int y = rand.nextULessThan(HEIGHT);
textPaint.setColor(sk_tool_utils::color_to_565(rand.nextBits(24) | 0xFF000000));
textPaint.setColor(ToolUtils::color_to_565(rand.nextBits(24) | 0xFF000000));
font.setSize(rand.nextRangeScalar(0, 300));
canvas->drawString(str, SkIntToScalar(x), SkIntToScalar(y), font, textPaint);
}

View File

@ -5,10 +5,10 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkBlurImageFilter.h"
#include "SkRandom.h"
#include "ToolUtils.h"
#include "gm.h"
// TODO deprecate imageblur
@ -31,7 +31,7 @@ DEF_SIMPLE_GM(imageblur2, canvas, kWidth, kHeight) {
constexpr SkScalar dy = kHeight / sigmaCount;
constexpr SkScalar textSize = 12;
SkFont font(sk_tool_utils::create_portable_typeface(), textSize);
SkFont font(ToolUtils::create_portable_typeface(), textSize);
font.setEdging(SkFont::Edging::kAlias);
for (int x = 0; x < sigmaCount; x++) {
@ -45,7 +45,7 @@ DEF_SIMPLE_GM(imageblur2, canvas, kWidth, kHeight) {
SkRandom rand;
SkPaint textPaint;
textPaint.setColor(sk_tool_utils::color_to_565(rand.nextBits(24) | 0xFF000000));
textPaint.setColor(ToolUtils::color_to_565(rand.nextBits(24) | 0xFF000000));
for (int i = 0; i < testStringCount; i++) {
canvas->drawString(kTestStrings[i],
SkIntToScalar(x * dx),

View File

@ -5,14 +5,14 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkSurface.h"
#include "SkBlurImageFilter.h"
#include "SkSurface.h"
#include "ToolUtils.h"
#include "gm.h"
static sk_sp<SkImage> make_image(SkCanvas* canvas) {
SkImageInfo info = SkImageInfo::MakeN32Premul(250, 200);
auto surface = sk_tool_utils::makeSurface(canvas, info);
auto surface = ToolUtils::makeSurface(canvas, info);
SkCanvas* c = surface->getCanvas();
SkPaint paint;
paint.setAntiAlias(true);

View File

@ -5,14 +5,14 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkSurface.h"
#include "SkBlurImageFilter.h"
#include "SkSurface.h"
#include "ToolUtils.h"
#include "gm.h"
static sk_sp<SkImage> make_image(SkCanvas* canvas, int direction) {
SkImageInfo info = SkImageInfo::MakeN32Premul(250, 200);
auto surface = sk_tool_utils::makeSurface(canvas, info);
auto surface = ToolUtils::makeSurface(canvas, info);
SkCanvas* c = surface->getCanvas();
SkPaint paint;
paint.setAntiAlias(true);

View File

@ -5,10 +5,10 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkBlurImageFilter.h"
#include "SkRandom.h"
#include "ToolUtils.h"
#include "gm.h"
#define WIDTH 640
#define HEIGHT 480
@ -46,7 +46,7 @@ protected:
"jumped over",
"the lazy dog.",
};
SkFont font(sk_tool_utils::create_portable_typeface(), 100);
SkFont font(ToolUtils::create_portable_typeface(), 100);
int posY = 0;
for (unsigned i = 0; i < SK_ARRAY_COUNT(str); i++) {
posY += 100;

View File

@ -5,13 +5,13 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "SkBlurImageFilter.h"
#include "SkColorMatrixFilter.h"
#include "SkImage.h"
#include "SkImageFilter.h"
#include "SkSurface.h"
#include "sk_tool_utils.h"
#include "ToolUtils.h"
#include "gm.h"
/**
* Test drawing a primitive w/ an imagefilter (in this case, just matrix w/ identity) to see
@ -70,7 +70,7 @@ DEF_SIMPLE_GM(imagefilters_xfermodes, canvas, 480, 480) {
static sk_sp<SkImage> make_image(SkCanvas* canvas) {
const SkImageInfo info = SkImageInfo::MakeS32(100, 100, kPremul_SkAlphaType);
auto surface(sk_tool_utils::makeSurface(canvas, info));
auto surface(ToolUtils::makeSurface(canvas, info));
surface->getCanvas()->drawRect(SkRect::MakeXYWH(25, 25, 50, 50), SkPaint());
return surface->makeImageSnapshot();
}

View File

@ -5,14 +5,14 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkColorFilter.h"
#include "SkColorPriv.h"
#include "SkImageFilterPriv.h"
#include "SkShader.h"
#include "SkTextUtils.h"
#include "ToolUtils.h"
#include "gm.h"
#include "SkBlurImageFilter.h"
#include "SkColorFilterImageFilter.h"
@ -127,7 +127,7 @@ static void draw_text(SkCanvas* canvas, const SkRect& r, sk_sp<SkImageFilter> im
SkPaint paint;
paint.setImageFilter(imf);
paint.setColor(SK_ColorCYAN);
SkFont font(sk_tool_utils::create_portable_typeface(), r.height()/2);
SkFont font(ToolUtils::create_portable_typeface(), r.height() / 2);
SkTextUtils::DrawString(canvas, "Text", r.centerX(), r.centerY(), font, paint,
SkTextUtils::kCenter_Align);
}
@ -241,7 +241,7 @@ protected:
SkFont::Edging::kAntiAlias,
SkFont::Edging::kSubpixelAntiAlias,
};
SkFont font(sk_tool_utils::create_portable_typeface(), 30);
SkFont font(ToolUtils::create_portable_typeface(), 30);
SkAutoCanvasRestore acr(canvas, true);
for (SkFont::Edging edging : kEdgings) {

View File

@ -20,8 +20,8 @@
#include "SkPoint3.h"
#include "SkScalar.h"
#include "SkSurface.h"
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
#define RESIZE_FACTOR_X SkIntToScalar(2)
#define RESIZE_FACTOR_Y SkIntToScalar(5)
@ -79,8 +79,8 @@ protected:
}
void onOnceBeforeDraw() override {
fCheckerboard = SkImage::MakeFromBitmap
(sk_tool_utils::create_checkerboard_bitmap(64, 64, 0xFFA0A0A0, 0xFF404040, 8));
fCheckerboard = SkImage::MakeFromBitmap(
ToolUtils::create_checkerboard_bitmap(64, 64, 0xFFA0A0A0, 0xFF404040, 8));
fGradientCircle = make_gradient_circle(64, 64);
}

View File

@ -5,13 +5,13 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkColorFilter.h"
#include "SkColorPriv.h"
#include "SkShader.h"
#include "SkTextUtils.h"
#include "ToolUtils.h"
#include "gm.h"
#include "SkBlurImageFilter.h"
#include "SkMorphologyImageFilter.h"
@ -44,7 +44,7 @@ static void draw_text(SkCanvas* canvas, const SkRect& r, sk_sp<SkImageFilter> im
paint.setImageFilter(std::move(imf));
paint.setColor(SK_ColorGREEN);
SkFont font(sk_tool_utils::create_portable_typeface(), r.height()/2);
SkFont font(ToolUtils::create_portable_typeface(), r.height() / 2);
SkTextUtils::DrawString(canvas, "Text", r.centerX(), r.centerY(), font, paint, SkTextUtils::kCenter_Align);
}

View File

@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkArithmeticImageFilter.h"
#include "SkBlurImageFilter.h"
@ -39,7 +39,7 @@ protected:
void onOnceBeforeDraw() override {
fImage = SkImage::MakeFromBitmap(
sk_tool_utils::create_string_bitmap(100, 100, SK_ColorWHITE, 20, 70, 96, "e"));
ToolUtils::create_string_bitmap(100, 100, SK_ColorWHITE, 20, 70, 96, "e"));
}
void onDraw(SkCanvas* canvas) override {

View File

@ -20,8 +20,8 @@
#include "SkPoint3.h"
#include "SkScalar.h"
#include "SkSurface.h"
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
#define RESIZE_FACTOR SkIntToScalar(4)
@ -64,7 +64,7 @@ protected:
void onOnceBeforeDraw() override {
fCheckerboard = SkImage::MakeFromBitmap(
sk_tool_utils::create_checkerboard_bitmap(64, 64, 0xFFA0A0A0, 0xFF404040, 8));
ToolUtils::create_checkerboard_bitmap(64, 64, 0xFFA0A0A0, 0xFF404040, 8));
fGradientCircle = make_gradient_circle(64, 64);
}

View File

@ -15,8 +15,8 @@
#include "SkMorphologyImageFilter.h"
#include "SkScalar.h"
#include "SkSurface.h"
#include "ToolUtils.h"
#include "gm.h"
#include "sk_tool_utils.h"
namespace skiagm {
@ -58,7 +58,7 @@ protected:
void onOnceBeforeDraw() override {
fCheckerboard = SkImage::MakeFromBitmap(
sk_tool_utils::create_checkerboard_bitmap(64, 64, 0xFFA0A0A0, 0xFF404040, 8));
ToolUtils::create_checkerboard_bitmap(64, 64, 0xFFA0A0A0, 0xFF404040, 8));
fGradientCircle = make_gradient_circle(64, 64);
}

View File

@ -5,13 +5,13 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkImageSource.h"
#include "SkMagnifierImageFilter.h"
#include "SkPixelRef.h"
#include "SkRandom.h"
#include "SkSurface.h"
#include "ToolUtils.h"
#include "gm.h"
#define WIDTH 500
#define HEIGHT 500
@ -27,12 +27,12 @@ DEF_SIMPLE_GM_BG(imagemagnifier, canvas, WIDTH, HEIGHT, SK_ColorBLACK) {
canvas->saveLayer(nullptr, &filterPaint);
const char* str = "The quick brown fox jumped over the lazy dog.";
SkRandom rand;
SkFont font(sk_tool_utils::create_portable_typeface());
SkFont font(ToolUtils::create_portable_typeface());
for (int i = 0; i < 25; ++i) {
int x = rand.nextULessThan(WIDTH);
int y = rand.nextULessThan(HEIGHT);
SkPaint paint;
paint.setColor(sk_tool_utils::color_to_565(rand.nextBits(24) | 0xFF000000));
paint.setColor(ToolUtils::color_to_565(rand.nextBits(24) | 0xFF000000));
font.setSize(rand.nextRangeScalar(0, 300));
canvas->drawString(str, SkIntToScalar(x), SkIntToScalar(y), font, paint);
}

View File

@ -5,14 +5,14 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkBlurImageFilter.h"
#include "SkCanvas.h"
#include "SkColorFilter.h"
#include "SkColorFilterImageFilter.h"
#include "SkDropShadowImageFilter.h"
#include "SkSurface.h"
#include "ToolUtils.h"
#include "gm.h"
///////////////////////////////////////////////////////////////////////////////
@ -70,8 +70,8 @@ protected:
canvas->translate(MARGIN, MARGIN);
sk_sp<SkSurface> surface = sk_tool_utils::makeSurface(canvas, info);
sk_tool_utils::draw_checkerboard(surface->getCanvas());
sk_sp<SkSurface> surface = ToolUtils::makeSurface(canvas, info);
ToolUtils::draw_checkerboard(surface->getCanvas());
sk_sp<SkImage> source = surface->makeImageSnapshot();
for (auto clipBound : clipBounds) {

View File

@ -5,13 +5,13 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkImage.h"
#include "SkImageGenerator.h"
#include "SkMakeUnique.h"
#include "SkSurface.h"
#include "ToolUtils.h"
#include "gm.h"
namespace {
@ -20,7 +20,7 @@ const SkIRect kSubset = SkIRect::MakeLTRB(25, 25, 75, 75);
const SkRect kDest = SkRect::MakeXYWH(10, 10, 100, 100);
sk_sp<SkImage> make_mask(const sk_sp<SkSurface>& surface) {
sk_tool_utils::draw_checkerboard(surface->getCanvas(), 0x80808080, 0x00000000, 5);
ToolUtils::draw_checkerboard(surface->getCanvas(), 0x80808080, 0x00000000, 5);
return surface->makeImageSnapshot();
}

View File

@ -5,10 +5,10 @@
* found in the LICENSE file.
*/
#include "gm.h"
#include "sk_tool_utils.h"
#include "SkImageFilter.h"
#include "SkRandom.h"
#include "ToolUtils.h"
#include "gm.h"
#define WIDTH 640
#define HEIGHT 480
@ -23,7 +23,7 @@ DEF_SIMPLE_GM(imageresizetiled, canvas, WIDTH, HEIGHT) {
kNone_SkFilterQuality,
nullptr));
SkFont font(sk_tool_utils::create_portable_typeface(), 100);
SkFont font(ToolUtils::create_portable_typeface(), 100);
const SkScalar tile_size = SkIntToScalar(100);
for (SkScalar y = 0; y < HEIGHT; y += tile_size) {
for (SkScalar x = 0; x < WIDTH; x += tile_size) {

Some files were not shown because too many files have changed in this diff Show More