31#include <initializer_list>
39 SkDebugf(
"%d diffs, %d at 0x00, %d at 0xff, %d off by 1, all out of 65536\n",
50 for (
int x = 0;
x < 256;
x++) {
51 for (
int y = 0;
y < 256;
y++) {
53 ideal = (
x*
y+127)/255;
67 [](
int x,
int y) {
return (
x*
y)>>8; },
68 [](
int x,
int y) {
return (
x*
y+128)>>8; },
69 [](
int x,
int y) {
y +=
y>>7;
return (
x*
y)>>8; },
75 [](
int x,
int y) {
return (
x*
y+
x)>>8; },
76 [](
int x,
int y) {
return (
x*
y+
y)>>8; },
77 [](
int x,
int y) {
return (
x*
y+255)>>8; },
78 [](
int x,
int y) {
y +=
y>>7;
return (
x*
y+128)>>8; },
84 [](
int x,
int y) {
return (
x*
y+127)/255; },
85 [](
int x,
int y) {
int p = (
x*
y+128);
return (
p+(
p>>8))>>8; },
86 [](
int x,
int y) {
return ((
x*
y+128)*257)>>16; },
96 auto context = ctxInfo.directContext();
97 static constexpr SkISize kDimensions{10, 10};
101 struct RectAndSamplePoint {
105 } allRectsAndPoints[3] = {
112 RectAndSamplePoint fRectAndPoints;
120 for (
int sampleCnt : {1, 4}) {
121 for (
auto rectAndPoints : allRectsAndPoints) {
123 testCases.push_back({rectAndPoints,
clip, sampleCnt, origin});
131 int sampleCnt = testCase.fSampleCnt;
132 SkRect paintRect = testCase.fRectAndPoints.rect;
133 SkIPoint outPoint = testCase.fRectAndPoints.outPoint;
134 SkIPoint inPoint = testCase.fRectAndPoints.inPoint;
144 if (!
surface && sampleCnt > 1) {
152 canvas->
clipRect(testCase.fClip,
false);
162 canvas->
drawRect(paintRect, white_paint);
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(BlendRequiringDstReadWithLargeCoordinates, reporter, contextInfo, CtsEnforcement::kNextRelease)
static bool acceptable(const Results &r)
DEF_TEST(Blend_byte_multiply, r)
static Results test(Fn &&multiply)
DEF_GANESH_TEST_FOR_GL_CONTEXT(ES2BlendWithNoTexture, reporter, ctxInfo, CtsEnforcement::kApiLevel_T)
@ kBottomLeft_GrSurfaceOrigin
@ kTopLeft_GrSurfaceOrigin
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kMultiply
r = s*(1-da) + d*(1-sa) + s*d
@ kSoftLight
lighten or darken, depending on source
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
#define SkColorSetRGB(r, g, b)
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorBLACK
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
#define REPORTER_ASSERT(r, cond,...)
static constexpr auto kColorType
void drawRect(const SkRect &rect, const SkPaint &paint)
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void drawIRect(const SkIRect &rect, const SkPaint &paint)
void clear(SkColor color)
void setColor(SkColor color)
void setBlendMode(SkBlendMode mode)
sk_sp< SkBlender > blender SkRect rect
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)
Int96 multiply(int64_t a, int32_t b)
sk_sp< SkSurface > MakeBackendRenderTargetSurface(GrDirectContext *dContext, const SkImageInfo &ii, GrSurfaceOrigin origin, int sampleCnt, GrProtected isProtected, const SkSurfaceProps *props)
constexpr int32_t y() const
static constexpr SkIPoint Make(int32_t x, int32_t y)
constexpr int32_t x() const
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static SkRect Make(const SkISize &size)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)