I'm drawing on a raster surface. I want to take the image on a surface and shrink it by a factor. I have code that looks like this:
SkImageInfo info = SkImageInfo::MakeN32( width, height, kUnpremul_SkAlphaType );
_surface = SkSurface::MakeRaster( info );
_canvas = _surface->getCanvas();
(draw some stuff on _canvas)
sk_sp<SkImage> image = _surface->makeImageSnapshot();
SkImageInfo info2 = SkImageInfo::MakeN32( width / 2, height / 2, kUnpremul_SkAlphaType );
_surface2 = SkSurface::MakeRaster( info2 );
_canvas2 = _surface2->getCanvas();
_canvas2->scale( 0.5, 0.5 );
_canvas2->drawImage( image, 0, 0 );
What I get out looks like the left column below. The right column shows what I expect. Is there a way to get that better quality out of Skia? Am I doing the whole process wrong? I played around with SkSamplingOptions to use a SkCubicResampler, but I think that's just for upsizing, not downsizing?
