35 int srcW = srcRect.
width();
36 int srcH = srcRect.
height();
44 stepsX =
static_cast<int>((sx > 1.f) ?
std::ceil(std::log2f(sx))
46 stepsY =
static_cast<int>((sy > 1.f) ?
std::ceil(std::log2f(sy))
55 if (stepsX < 0 || stepsY < 0) {
78 int srcX = srcRect.
fLeft;
79 int srcY = srcRect.
fTop;
95 tempSurf = std::move(linearSurf);
104 while (stepsX || stepsY) {
105 int nextW = resultInfo.
width();
106 int nextH = resultInfo.
height();
108 nextW = resultInfo.
width() << (-stepsX - 1);
110 }
else if (stepsX != 0) {
117 nextH = resultInfo.
height() << (-stepsY - 1);
119 }
else if (stepsY != 0) {
126 if (!stepsX && !stepsY) {
135 next->getCanvas()->drawImageRect(
138 tempSurf = std::move(
next);
147 std::unique_ptr<char[]>
data(
new char[resultInfo.
height() * rowBytes]);
149 if (srcImage->
readPixels(
nullptr, pm, srcX, srcY)) {
152 Result(std::unique_ptr<
const char[]>
data,
size_t rowBytes)
153 : fData(std::move(
data)), fRowBytes(rowBytes) {}
154 int count()
const override {
return 1; }
155 const void*
data(
int i)
const override {
return fData.get(); }
156 size_t rowBytes(
int i)
const override {
return fRowBytes; }
159 std::unique_ptr<const char[]> fData;
162 callback(context, std::make_unique<Result>(std::move(
data), rowBytes));
static float next(float f)
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
void SkRescaleAndReadPixels(SkBitmap bmp, const SkImageInfo &resultInfo, const SkIRect &srcRect, SkImage::RescaleGamma rescaleGamma, SkImage::RescaleMode rescaleMode, SkImage::ReadPixelsCallback callback, SkImage::ReadPixelsContext context)
sk_sp< SkImage > asImage() const
const SkPixmap & pixmap() const
const SkImageInfo & info() const
@ kStrict_SrcRectConstraint
sample only inside bounds; slower
@ kFast_SrcRectConstraint
sample outside bounds; faster
bool gammaIsLinear() const
sk_sp< SkColorSpace > makeLinearGamma() const
virtual size_t rowBytes(int i) const =0
virtual int count() const =0
virtual const void * data(int i) const =0
const SkImageInfo & imageInfo() const
bool readPixels(GrDirectContext *context, const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY, CachingHint cachingHint=kAllow_CachingHint) const
void(ReadPixelsContext, std::unique_ptr< const AsyncReadResult >) ReadPixelsCallback
sk_sp< SkImage > makeImageSnapshot()
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
SK_API sk_sp< SkImage > RasterFromPixmap(const SkPixmap &pixmap, RasterReleaseProc rasterReleaseProc, ReleaseContext releaseContext)
SkSamplingOptions sampling
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
SkSamplingOptions(SkFilterMode::kLinear))
SIN Vec< N, float > floor(const Vec< N, float > &x)
SIN Vec< N, float > ceil(const Vec< N, float > &x)
constexpr int32_t height() const
int32_t fTop
smaller y-axis bounds
constexpr int32_t width() const
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
int32_t fLeft
smaller x-axis bounds
SkImageInfo makeWH(int newWidth, int newHeight) const
size_t minRowBytes() const
SkColorSpace * colorSpace() const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
SkAlphaType alphaType() const
static SkRect Make(const SkISize &size)
static SkRect MakeIWH(int w, int h)
std::shared_ptr< const fml::Mapping > data