MCPcopy Create free account
hub / github.com/Snapchat/Valdi / resized

Method resized

snap_drawing/src/snap_drawing/cpp/Utils/Image.cpp:142–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142Ref<Image> Image::resized(int width, int height) const {
143 SkBitmap bitmap;
144
145 SkImageInfo imageInfo = SkImageInfo::Make(width, height, _skImage->colorType(), _skImage->alphaType());
146 bitmap.allocPixels(imageInfo, imageInfo.minRowBytes());
147
148 _skImage->scalePixels(bitmap.pixmap(), SkSamplingOptions(SkCubicResampler::Mitchell()));
149
150 bitmap.setImmutable();
151
152 auto skImage = SkImages::RasterFromBitmap(bitmap);
153 return Ref<Image>(Valdi::makeShared<Image>(skImage));
154}
155
156void Image::draw(const Valdi::BitmapInfo& bitmapInfo, void* bytes) {
157 SkPixmap pixmap(toSkiaImageInfo(bitmapInfo), bytes, bitmapInfo.rowBytes);

Callers 2

getResizedMethod · 0.80
convertImageFunction · 0.80

Calls 1

MakeFunction · 0.85

Tested by

no test coverage detected