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];
86 cache->fSizeBudget = budget;
87 cache->internalCheckPurge();
93 int maxTotalText,
int maxGlyphID,
int maxFamilies,
bool normal,
121 for (
int i = 0;
i < maxTotalText;
i++) {
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++) {
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++) {
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++) {
306 auto dContext = ctxInfo.directContext();
311 auto blob = make_large_blob();
331 auto direct = ctxInfo.directContext();
390 auto direct = ctxInfo.directContext();
399 auto expectedBitMap =
draw_blob(expectedBlob.get(),
surface.get(), {40, y});
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 REPORTER_ASSERT(r, cond,...)
static void draw(SkCanvas *canvas, int redraw, const TArray< sk_sp< SkTextBlob > > &blobs)
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(TextBlobJaggedGlyph, reporter, ctxInfo, CtsEnforcement::kApiLevel_T)
static void setup_always_evict_atlas(GrDirectContext *dContext)
static sk_sp< SkTextBlob > make_blob()
static bool compare_bitmaps(const SkBitmap &expected, const SkBitmap &actual)
DEF_GANESH_TEST_FOR_MOCK_CONTEXT(TextBlobCache, reporter, ctxInfo)
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)
sk_sp< SkFontStyleSet > createStyleSet(int index) const
void getFamilyName(int index, SkString *familyName) const
int countFamilies() const
@ 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
static float min(float r, float g, float b)
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
Optional< SkRect > bounds
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)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent cache
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set
font
Font Metadata and Metrics.
static SkString to_string(int n)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)