42 uint32_t expectedPixelValues[],
44 int pixelCnt = srcContext->
width() * srcContext->
height();
57 for (
int i = 0;
i < pixelCnt; ++
i) {
58 if (pm.
addr32()[
i] != expectedPixelValues[
i]) {
59 ERRORF(
reporter,
"%s: Error, pixel value %d should be 0x%08x, got 0x%08x.",
76 for (
int y = 0;
y < dstContext->
height(); ++
y) {
77 for (
int x = 0;
x < dstContext->
width(); ++
x) {
90 if (
write && !expectedToWork) {
103 uint32_t expectedPixelValues[],
111 "CopyFromSurface_Test");
115 auto dstContext = dContext->
priv().
makeSC(std::move(view),
125 const float tolRGBA[4],
126 std::function<ComparePixmapsErrorReporter>&
error) {
129 for (
int i = 0;
i < 4; ++
i) {
130 diffs[
i] = rgbaB[
i] - rgbaA[
i];
144 const float tolRGBA[4],
145 std::function<ComparePixmapsErrorReporter>&
error) {
146 if (
a.dimensions() !=
b.dimensions()) {
147 static constexpr float kEmptyDiffs[4] = {};
148 error(-1, -1, kEmptyDiffs);
160 floatCS =
a.refColorSpace();
175 auto at = [rb = floatA.
rowBytes()](
const void*
base,
int x,
int y) {
176 return SkTAddOffset<const float>(
base,
y*rb +
x*
sizeof(
float)*4);
179 for (
int y = 0;
y < floatA.
height(); ++
y) {
180 for (
int x = 0;
x < floatA.
width(); ++
x) {
181 const float* rgbaA = at(floatA.
addr(),
x,
y);
182 const float* rgbaB = at(floatB.
addr(),
x,
y);
193 const float tolRGBA[4],
194 std::function<ComparePixmapsErrorReporter>&
error) {
205 GrCPixmap srcPixmap(srcInfo, col.vec(), floatBpp);
212 size_t floatRowBytes = floatBpp * pixmap.
width();
213 std::unique_ptr<char[]> floatB(
new char[floatRowBytes * pixmap.
height()]);
218 for (
int y = 0;
y < f32Pixmap.
height(); ++
y) {
219 for (
int x = 0;
x < f32Pixmap.
width(); ++
x) {
220 auto rgbaA = SkTAddOffset<const float>(f32Pixmap.
addr(),
222 auto rgbaB =
static_cast<const float*
>(colorPixmap.
addr());
233 int32_t expectedProxyRefs,
234 int32_t expectedBackingRefs) {
235 int32_t actualBackingRefs = proxy->testingOnly_getBackingRefCnt();
274 UnicharGen(
int step) : fU(0), fStep(
step) {}
288 for (
int i = 0;
i < 500; ++
i) {
292 int index =
cache.findGlyphIndex(c);
294 index =
cache.findGlyphIndex(c);
297 cache.insertCharAndGlyph(~index, c, glyph);
299 UnicharGen gen2(
step);
300 for (
int j = 0; j <=
i; ++j) {
303 index =
cache.findGlyphIndex(c);
304 if ((
unsigned)index != glyph) {
305 index =
cache.findGlyphIndex(c);
static int step(int x, SkScalar min, SkScalar max)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
bool GrConvertPixels(const GrPixmap &dst, const GrCPixmap &src, bool flipY)
static constexpr size_t GrColorTypeBytesPerPixel(GrColorType ct)
static float next(float f)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
@ kRGBA_F32_SkColorType
pixel using C float for red, green, blue, alpha; in 128-bit word
constexpr SkColor SK_ColorTRANSPARENT
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
static bool read(SkStream *stream, void *buffer, size_t amount)
static GrColor SkColorToPremulGrColor(SkColor c)
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
constexpr uint16_t SkToU16(S x)
std::unique_ptr< skgpu::ganesh::SurfaceContext > CreateSurfaceContext(GrRecordingContext *rContext, const GrImageInfo &info, SkBackingFit fit, GrSurfaceOrigin origin, GrRenderable renderable, int sampleCount, skgpu::Mipmapped mipmapped, GrProtected isProtected, skgpu::Budgeted budgeted)
DEF_TEST(chartoglyph_cache, reporter)
static bool compare_colors(int x, int y, const float rgbaA[], const float rgbaB[], const float tolRGBA[4], std::function< ComparePixmapsErrorReporter > &error)
void CheckSingleThreadedProxyRefs(skiatest::Reporter *reporter, GrSurfaceProxy *proxy, int32_t expectedProxyRefs, int32_t expectedBackingRefs)
void TestReadPixels(skiatest::Reporter *reporter, GrDirectContext *dContext, skgpu::ganesh::SurfaceContext *srcContext, uint32_t expectedPixelValues[], const char *testName)
static SkGlyphID hash_to_glyph(uint32_t value)
void TestWritePixels(skiatest::Reporter *reporter, GrDirectContext *dContext, skgpu::ganesh::SurfaceContext *dstContext, bool expectedToWork, const char *testName)
void TestCopyFromSurface(skiatest::Reporter *reporter, GrDirectContext *dContext, sk_sp< GrSurfaceProxy > proxy, GrSurfaceOrigin origin, GrColorType colorType, uint32_t expectedPixelValues[], const char *testName)
bool ComparePixels(const GrCPixmap &a, const GrCPixmap &b, const float tolRGBA[4], std::function< ComparePixmapsErrorReporter > &error)
bool CheckSolidPixels(const SkColor4f &col, const SkPixmap &pixmap, const float tolRGBA[4], std::function< ComparePixmapsErrorReporter > &error)
#define REPORTER_ASSERT(r, cond,...)
const GrCaps * caps() const
GrBackendFormat getDefaultBackendFormat(GrColorType, GrRenderable) const
skgpu::Swizzle getReadSwizzle(const GrBackendFormat &format, GrColorType colorType) const
GrDirectContextPriv priv()
GrImageInfo makeColorSpace(sk_sp< SkColorSpace > cs) const
GrImageInfo makeAlphaType(SkAlphaType at) const
static GrPixmap Allocate(const GrImageInfo &info)
std::unique_ptr< skgpu::ganesh::SurfaceContext > makeSC(GrSurfaceProxyView readView, const GrColorInfo &)
GrRecordingContextPriv priv()
static sk_sp< GrSurfaceProxy > Copy(GrRecordingContext *, sk_sp< GrSurfaceProxy > src, GrSurfaceOrigin, skgpu::Mipmapped, SkIRect srcRect, SkBackingFit, skgpu::Budgeted, std::string_view label, RectsMustMatch=RectsMustMatch::kNo, sk_sp< GrRenderTask > *outTask=nullptr)
void alloc(const SkImageInfo &)
static bool Equals(const SkColorSpace *, const SkColorSpace *)
static sk_sp< SkColorSpace > MakeSRGBLinear()
bool refCntGreaterThan(int32_t threadIsolatedTestCnt) const
const uint32_t * addr32() const
bool erase(SkColor color, const SkIRect &subset) const
const SkImageInfo & info() const
uint32_t * writable_addr32(int x, int y) const
sk_sp< SkColorSpace > refColorSpace() const
SkAlphaType alphaType() const
bool readPixels(GrDirectContext *dContext, GrPixmap dst, SkIPoint srcPt)
SkISize dimensions() const
bool writePixels(GrDirectContext *dContext, GrCPixmap src, SkIPoint dstPt)
const uint8_t uint32_t uint32_t GError ** error
uint32_t uint32_t * format
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
SIN Vec< N, float > abs(const Vec< N, float > &x)
void write(SkWStream *wStream, const T &text)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
SkImageInfo makeColorType(SkColorType newColorType) const