49#ifdef SK_BUILD_FOR_WIN
64 for (
int r = 0; r < redraw; r++) {
65 for (
int i = 0; i < blobs.size(); i++) {
66 const auto& blob = blobs[i];
67 const SkRect& bounds = blob->bounds();
86 cache->fSizeBudget = budget;
87 cache->internalCheckPurge();
93 int maxTotalText,
int maxGlyphID,
int maxFamilies,
bool normal,
117 int count = std::min(fm->countFamilies(), maxFamilies);
121 for (
int i = 0; i < maxTotalText; i++) {
122 text[i] = i % maxGlyphID;
127 for (
int i = 0; i <
count; i++) {
132 fm->getFamilyName(i, &familyName);
134 for (
int j = 0; j < set->count(); ++j) {
136 set->getStyle(j, &fs,
nullptr);
141 font.setTypeface(orig);
143 font.setTypeface(sk_make_sp<SkRandomTypeface>(orig,
SkPaint(),
true));
147 for (
int aa = 0; aa < 2; aa++) {
148 for (
int subpixel = 0; subpixel < 2; subpixel++) {
149 for (
int lcd = 0; lcd < 2; lcd++) {
157 font.setSubpixel(
SkToBool(subpixel));
165 memcpy(
run.glyphs,
text.get(), maxTotalText *
sizeof(uint16_t));
182 SkCanvas* canvasNoLCD = surfaceNoLCD->getCanvas();
185 draw(canvas, 2, blobs);
186 draw(canvasNoLCD, 2, blobs);
190 draw(canvas, 1, blobs);
193 draw(canvasNoLCD, 1, blobs);
197 draw(canvas, 1, blobs);
237 for (
int i = 0; i < expected.
width(); ++i) {
238 for (
int j = 0; j < expected.
height(); ++j) {
241 if (expectedColor != actualColor) {
252 font.setTypeface(tf);
253 font.setSubpixel(
false);
257 static char text[] =
"HekpqB";
258 static const int maxGlyphLen =
sizeof(
text) * 4;
264 const auto& runBuffer = builder.allocRun(font, glyphCount, 0, 0);
265 for (
int i = 0; i < glyphCount; i++) {
266 runBuffer.glyphs[i] =
glyphs[i];
268 return builder.make();
276 font.setTypeface(tf);
277 font.setSubpixel(
false);
281 const int mallocSize = 0x3c3c3bd;
282 std::unique_ptr<char[]>
text{
new char[mallocSize + 1]};
283 if (
text ==
nullptr) {
286 for (
int i = 0; i < mallocSize; i++) {
289 text[mallocSize] = 0;
291 static const int maxGlyphLen = mallocSize;
297 const auto& runBuffer =
builder.allocRun(font, glyphCount, 0, 0);
298 for (
int i = 0; i < glyphCount; i++) {
299 runBuffer.glyphs[i] =
glyphs[i];
306 auto dContext = ctxInfo.directContext();
311 auto blob = make_large_blob();
331 auto direct = ctxInfo.directContext();
347 std::string filename =
"bad/half-y" + std::to_string(
y) +
".png";
351 std::string filename =
"good/half-y" + std::to_string(
y) +
".png";
372 std::string filename =
"bad/half-x" + std::to_string(
x) +
".png";
376 std::string filename =
"good/half-x" + std::to_string(
x) +
".png";
390 auto direct = ctxInfo.directContext();
399 auto expectedBitMap =
draw_blob(expectedBlob.get(),
surface.get(), {40, y});
406 std::string filename =
"bad/scroll-y" + std::to_string(
y) +
".png";
410 std::string filename =
"good/scroll-y" + std::to_string(
y) +
".png";
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
#define SkASSERT_RELEASE(cond)
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
constexpr SkColor SK_ColorWHITE
@ kUTF8
uses bytes to represent UTF-8 or ASCII
#define SkScalarCeilToInt(x)
@ kUnknown_SkPixelGeometry
static constexpr bool SkToBool(const T &x)
#define DEF_GANESH_TEST_FOR_MOCK_CONTEXT(name, reporter, context_info)
#define REPORTER_ASSERT(r, cond,...)
#define DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(name, reporter, context_info, ctsEnforcement)
static void draw(SkCanvas *canvas, int redraw, const TArray< sk_sp< SkTextBlob > > &blobs)
static void setup_always_evict_atlas(GrDirectContext *dContext)
static sk_sp< SkTextBlob > make_blob()
static bool compare_bitmaps(const SkBitmap &expected, const SkBitmap &actual)
static const int kScreenDim
static const bool kDumpPngs
static void text_blob_cache_inner(skiatest::Reporter *reporter, GrDirectContext *dContext, int maxTotalText, int maxGlyphID, int maxFamilies, bool normal, bool stressTest)
static SkBitmap draw_blob(SkTextBlob *blob, SkSurface *surface, SkPoint offset)
void write_png(const std::string &filename, const SkBitmap &bitmap)
GrAtlasManager * getAtlasManager()
GrDirectContextPriv priv()
void abandonContext() override
sktext::gpu::TextBlobRedrawCoordinator * getTextBlobCache()
static void SetBudget(sktext::gpu::TextBlobRedrawCoordinator *cache, size_t budget)
SkColor getColor(int x, int y) const
void translate(SkScalar dx, SkScalar dy)
sk_sp< SkSurface > makeSurface(const SkImageInfo &info, const SkSurfaceProps *props=nullptr)
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
void drawTextBlob(const SkTextBlob *blob, SkScalar x, SkScalar y, const SkPaint &paint)
@ kAntiAlias
may have transparent pixels on glyph edges
@ kAlias
no transparent pixels on glyph edges
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
T & emplace_back(Args &&... args)
FlutterSemanticsFlag flags
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
font
Font Metadata and Metrics.
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)