53#include <initializer_list>
64 SkAlphaType alphaType, uint32_t expectedPixelValues[]) {
71 sfc->fillWithFP(std::move(
fp));
73 "RectangleTexture-basic-draw");
87 int h = sfc->height();
92 uint32_t expectedColor0 = 0;
93 uint8_t* expectedBytes0 =
reinterpret_cast<uint8_t*
>(&expectedColor0);
98 for (
int i = 0;
i < sfc->width() * sfc->height(); ++
i) {
99 expectedPixels.get()[
i] = expectedColor0;
107 uint32_t expectedColor1 = 0;
108 uint8_t* expectedBytes1 =
reinterpret_cast<uint8_t*
>(&expectedColor1);
114 for (
int y = 0;
y <
h/2; ++
y) {
115 for (
int x = 0;
x <
w; ++
x) {
116 expectedPixels.get()[
y *
h +
x] = expectedColor1;
128 int pixelCnt = dstContext->
width() * dstContext->
height();
130 for (
int y = 0;
y < dstContext->
width(); ++
y) {
131 for (
int x = 0;
x < dstContext->
height(); ++
x) {
132 pixels.get()[
y * dstContext->
width() +
x] =
138 auto origin = dstContext->
origin();
156 auto dContext = ctxInfo.directContext();
159 static const int kWidth = 16;
216 "RectangleTexture-copy-from");
223 test_copy_to_surface(
reporter, dContext, rectContext.get(),
"RectangleTexture-copy-to");
227 test_clear(
reporter, dContext, rectContext.get());
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
#define GrColorUnpackA(color)
static GrColor GrColorPackRGBA(unsigned r, unsigned g, unsigned b, unsigned a)
#define GrColorUnpackR(color)
#define GrColorUnpackG(color)
#define GrColorUnpackB(color)
#define GR_GL_TEXTURE_RECTANGLE
@ kBorrow_GrWrapOwnership
@ kBottomLeft_GrSurfaceOrigin
@ kTopLeft_GrSurfaceOrigin
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
static GrColor SkColorToPremulGrColor(SkColor c)
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
void TestReadPixels(skiatest::Reporter *reporter, GrDirectContext *dContext, skgpu::ganesh::SurfaceContext *srcContext, uint32_t expectedPixelValues[], const char *testName)
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)
#define DEF_GANESH_TEST_FOR_GL_CONTEXT(name, reporter, context_info, ctsEnforcement)
GrBackendFormat getBackendFormat() const
const GrCaps * caps() const
skgpu::Swizzle getReadSwizzle(const GrBackendFormat &format, GrColorType colorType) const
bool updateBackendTexture(const GrBackendTexture &, const SkColor4f &color, GrGpuFinishedProc finishedProc, GrGpuFinishedContext finishedContext)
void deleteBackendTexture(const GrBackendTexture &)
GrBackendTexture createBackendTexture(int width, int height, const GrBackendFormat &, skgpu::Mipmapped, GrRenderable, GrProtected=GrProtected::kNo, std::string_view label={})
GrDirectContextPriv priv()
const GrColorInfo & colorInfo() const
GrColorType colorType() const
sk_sp< GrTextureProxy > wrapBackendTexture(const GrBackendTexture &, GrWrapOwnership, GrWrapCacheable, GrIOType, sk_sp< skgpu::RefCntedCallback >=nullptr)
GrProxyProvider * proxyProvider()
std::unique_ptr< skgpu::ganesh::SurfaceContext > makeSC(GrSurfaceProxyView readView, const GrColorInfo &)
std::unique_ptr< skgpu::ganesh::SurfaceFillContext > makeSFC(GrImageInfo, std::string_view label, SkBackingFit=SkBackingFit::kExact, int sampleCount=1, skgpu::Mipmapped=skgpu::Mipmapped::kNo, skgpu::Protected=skgpu::Protected::kNo, GrSurfaceOrigin=kTopLeft_GrSurfaceOrigin, skgpu::Budgeted=skgpu::Budgeted::kYes)
SkISize dimensions() const
GrTexture * peekTexture() const
static std::unique_ptr< GrFragmentProcessor > Make(GrSurfaceProxyView, SkAlphaType, const SkMatrix &=SkMatrix::I(), GrSamplerState::Filter=GrSamplerState::Filter::kNearest, GrSamplerState::MipmapMode mipmapMode=GrSamplerState::MipmapMode::kNone)
GrTextureType textureType() const
bool hasRestrictedSampling() const
skgpu::Mipmapped mipmapped() const
skgpu::Mipmapped mipmapped() const
bool hasRestrictedSampling() const
GrTextureType textureType() const
static const SkMatrix & I()
SkISize dimensions() const
virtual SurfaceFillContext * asFillContext()
GrSurfaceOrigin origin() const
uint32_t uint32_t * format
sk_sp< SkBlender > blender SkRect rect
GrSurfaceProxyView MakeTextureProxyViewFromData(GrDirectContext *dContext, GrRenderable renderable, GrSurfaceOrigin origin, GrCPixmap pixmap)
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static SkRGBA4f FromBytes_RGBA(uint32_t color)