25const SkISize kSurfaceSize = { 64, 64 };
51 canvas->
clear(kBackgroundColor);
52 std::unique_ptr<Recording> clearRecording = recorder->
snap();
53 if (!clearRecording) {
60 paint.setAntiAlias(
true);
63 font.setSubpixel(
true);
66 const char* text0 =
"Hamburge";
67 const size_t text0Len = strlen(text0);
70 std::unique_ptr<Recording> text0Recording = recorder->
snap();
73 const char* text1 =
"burgefons";
74 const size_t text1Len = strlen(text1);
77 std::unique_ptr<Recording> text1Recording = recorder->
snap();
81 info.fRecording = clearRecording.get();
83 info.fRecording = text0Recording.get();
85 info.fRecording = text1Recording.get();
89 if (!
surface->readPixels(pm0, 0, 0)) {
95 info.fRecording = clearRecording.get();
97 info.fRecording = text1Recording.get();
99 info.fRecording = text0Recording.get();
103 if (!
surface->readPixels(pm1, 0, 0)) {
110 const float tols[4] = {tol, tol, tol, tol};
111 auto error = std::function<ComparePixmapsErrorReporter>([&](
int x,
int y,
112 const float diffs[4]) {
115 "Error at %d, %d. Diff in floats: (%f, %f, %f, %f)",
116 x,
y, diffs[0], diffs[1], diffs[2], diffs[3]);
129 std::unique_ptr<Recorder> recorder = context->
makeRecorder();
static void run_test(GrDirectContext *dContext, skiatest::Reporter *reporter, BulkRectTest test)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
DEF_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS(RecordingOrderTest_Graphite, reporter, context, CtsEnforcement::kNextRelease)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
@ kUTF8
uses bytes to represent UTF-8 or ASCII
bool ComparePixels(const GrCPixmap &a, const GrCPixmap &b, const float tolRGBA[4], std::function< ComparePixmapsErrorReporter > &error)
void allocPixels(const SkImageInfo &info, size_t rowBytes)
bool peekPixels(SkPixmap *pixmap) const
void drawSimpleText(const void *text, size_t byteLength, SkTextEncoding encoding, SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
void clear(SkColor color)
std::unique_ptr< Recorder > makeRecorder(const RecorderOptions &={})
bool submit(SyncToCpu=SyncToCpu::kNo)
bool insertRecording(const InsertRecordingInfo &)
std::unique_ptr< Recording > snap()
const uint8_t uint32_t uint32_t GError ** error
constexpr SkColor4f kWhite
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)