62 auto canvas =
surface->getCanvas();
65 canvas->drawTextBlob(blob, 10, 250,
paint);
67 bitmap.allocN32Pixels(500, 500);
74 for (
int x = 0;
x < bm.
width();
x++) {
92 font.setSubpixel(
true);
95 const auto& runBuffer =
builder.allocRunPosH(
font, 30, 0,
nullptr);
97 for (
int i = 0;
i < 30;
i++) {
103 auto dContext = ctxInfo.directContext();
104 bool anyBlack =
false;
105 for (
int n = -13; n < 5; n++) {
123 font.setSubpixel(
true);
127 const auto& runBuffer =
builder.allocRunPos(
font, 30,
nullptr);
129 for (
int i = 0;
i < 30;
i++) {
136 auto dContext = ctxInfo.directContext();
142 auto canvas =
surface->getCanvas();
145 canvas->drawTextBlob(blob, 10 + origin.x(), 40 + origin.y(),
paint);
147 bitmap.allocN32Pixels(350, 80);
154 auto blob = makeBlob({0, 0});
155 benchMark = rasterizeBlob(blob.get(), {0,0},
SkMatrix::I());
162 for (
int y = 0;
y < benchMark.
height();
y++) {
163 for (
int x = 0;
x < benchMark.
width();
x++) {
172 SkScalar interestingNumbers[] = {-10'000'000, -1'000'000, -1, 0, +1, +1'000'000, +10'000'000};
173 for (
auto originX : interestingNumbers) {
174 for (
auto originY : interestingNumbers) {
175 for (
auto translateX : interestingNumbers) {
176 for (
auto translateY : interestingNumbers) {
178 SkScalar deltaPosX = -(originX + translateX);
179 SkScalar deltaPosY = -(originY + translateY);
180 auto blob = makeBlob({deltaPosX, deltaPosY});
182 auto bitmap = rasterizeBlob(blob.get(), {originX, originY}, t);
191 const int k4K = 1 << 12;
237 const int k64K = 1 << 16;
240 for (
int i = 0;
i < 10;
i++) {
247 static int created = 0;
248 static int destroyed = 0;
250 Foo() : fI{-2}, fX{-3} { created++; }
251 Foo(
int i,
float x) : fI{
i}, fX{
x} { created++; }
252 ~Foo() { destroyed++; }
257 struct alignas(8) OddAlignment {
265 int*
p = alloc->makePOD<
int>(3);
267 int* q = alloc->makePOD<
int>(7);
271 auto foo = alloc->makeUnique<Foo>(3, 4.0f);
277 alloc->makePODArray<
int>(10);
279 auto fooArray = alloc->makeUniqueArray<Foo>(10);
284 alloc->makePOD<OddAlignment>();
305 std::unique_ptr<char[]> block{
new char[1024]};
317 Node(std::unique_ptr<Node, SubRunAllocator::Destroyer>
next)
319 ~Node() { destroyed++; }
320 std::unique_ptr<Node, SubRunAllocator::Destroyer>
fNext;
323 std::unique_ptr<Node, SubRunAllocator::Destroyer> current =
nullptr;
324 for (
int i = 0;
i < 128;
i++) {
342 for (
size_t i = 0;
i < 8;
i++) {
359 auto runBuffer =
builder.allocRun(
font, 1, 0.0f, 0.0f);
360 runBuffer.glyphs[0] = 3;
368#if !defined(SK_DISABLE_SDF_TEXT)
375 matrix1.
setAll(1, 0, 0, 0, 1, 0, 1, 1, 1);
377 matrix2.
setAll(1, 0, 0, 0, 1, 0, 2, 2, 1);
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
sktext::gpu::SubRunAllocator SubRunAllocator
DEF_TEST(BagOfBytesBasic, r)
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(GrTextBlobScaleAnimation, reporter, ctxInfo, CtsEnforcement::kApiLevel_T)
sktext::gpu::BagOfBytes BagOfBytes
SkBitmap rasterize_blob(SkTextBlob *blob, const SkPaint &paint, GrRecordingContext *rContext, const SkMatrix &matrix)
bool check_for_black(const SkBitmap &bm)
sktext::gpu::TextBlob TextBlob
static float next(float f)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorWHITE
@ kNormal
glyph outlines modified to improve constrast
#define REPORTER_ASSERT(r, cond,...)
SkColor getColor(int x, int y) const
@ kAntiAlias
may have transparent pixels on glyph edges
static SkMatrix Scale(SkScalar sx, SkScalar sy)
static SkMatrix Translate(SkScalar dx, SkScalar dy)
SkMatrix & setAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar persp0, SkScalar persp1, SkScalar persp2)
static const SkMatrix & I()
const GlyphRunList & blobToGlyphRunList(const SkTextBlob &blob, SkPoint origin)
static constexpr int MinimumSizeWithOverhead(int requestedSize, int assumedAlignment, int blockSize, int maxAlignment)
void * alignedBytes(int unsafeSize, int unsafeAlignment)
static constexpr int PlatformMinimumSizeWithOverhead(int requestedSize, int assumedAlignment)
std::unique_ptr< T[], ArrayDestroyer > makeUniqueArray(int n)
std::unique_ptr< T, Destroyer > makeUnique(Args &&... args)
void * alignedBytes(int size, int alignment)
static float max(float r, float g, float b)
unsigned useCenter Optional< SkMatrix > matrix
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.
const myers::Point & get< 1 >(const myers::Segment &s)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static constexpr SkPoint Make(float x, float y)
static std::tuple< bool, Key > Make(const GlyphRunList &glyphRunList, const SkPaint &paint, const SkMatrix &drawMatrix, const SkStrikeDeviceInfo &strikeDevice)