setColor very slow when there is a transparency color

27 views
Skip to first unread message

l1 shu

unread,
May 16, 2021, 7:23:47 AMMay 16
to skia-discuss

When I setColor a color with transparency, the rendering becomes very slow

SkColor c = 2147548928; // rgba(0, 255, 0, 0.5), very slow, about 400ms

SkColor c = 4278255360; // rgba(0, 255, 0, 1), slow, about 20ms

SkColor color = SkColorSetARGB(SkColorGetA(c), SkColorGetR(c), SkColorGetG(c), SkColorGetB(c));

paint.setColor(color);

This is how I create surface, it is based on cpu

SkImageInfo imageInfo = SkImageInfo::Make(
   1440,
   2773,
   kRGBA_8888_SkColorType,
   kUnpremul_SkAlphaType,
   SkColorSpace::MakeSRGB()
);
auto surface =  SkSurface::MakeRaster(imageInfo);

It’s worth mentioning that I don’t have this problem in an older version of skia

Reply all
Reply to author
Forward
0 new messages