[graphite] Add budgeted param to SkImage::asView(Recorder,...)
Bug: skia:12845 Change-Id: Iebaacfbb341554886fee1415aaf44fb0e44df723 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/521524 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
parent
6916d3e90e
commit
56ec512c78
@ -22,7 +22,9 @@ Image::Image(TextureProxyView view,
|
||||
|
||||
Image::~Image() {}
|
||||
|
||||
std::tuple<TextureProxyView, SkColorType> Image::onAsView(Recorder*, Mipmapped mipmapped) const {
|
||||
std::tuple<TextureProxyView, SkColorType> Image::onAsView(Recorder*,
|
||||
Mipmapped mipmapped,
|
||||
SkBudgeted) const {
|
||||
if (fTextureProxyView.proxy()->mipmapped() != mipmapped) {
|
||||
// We will not generate miplevels
|
||||
return {};
|
||||
@ -35,7 +37,7 @@ std::tuple<TextureProxyView, SkColorType> Image::onAsView(Recorder*, Mipmapped m
|
||||
|
||||
sk_sp<SkImage> SkImage::makeTextureImage(skgpu::Recorder* recorder,
|
||||
skgpu::Mipmapped mipmapped,
|
||||
SkBudgeted) const {
|
||||
SkBudgeted budgeted) const {
|
||||
if (!recorder) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -49,7 +51,7 @@ sk_sp<SkImage> SkImage::makeTextureImage(skgpu::Recorder* recorder,
|
||||
return sk_ref_sp(const_cast<SkImage*>(image));
|
||||
}
|
||||
}
|
||||
auto [view, ct] = as_IB(this)->asView(recorder, mipmapped);
|
||||
auto [view, ct] = as_IB(this)->asView(recorder, mipmapped, budgeted);
|
||||
if (!view) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -70,7 +70,9 @@ private:
|
||||
}
|
||||
#endif
|
||||
|
||||
std::tuple<TextureProxyView, SkColorType> onAsView(Recorder*, Mipmapped) const override;
|
||||
std::tuple<TextureProxyView, SkColorType> onAsView(Recorder*,
|
||||
Mipmapped,
|
||||
SkBudgeted) const override;
|
||||
|
||||
TextureProxyView fTextureProxyView;
|
||||
};
|
||||
|
@ -457,14 +457,14 @@ GrBackendTexture SkImage_Base::onGetBackendTexture(bool flushPendingGrContextIO,
|
||||
|
||||
#ifdef SK_GRAPHITE_ENABLED
|
||||
std::tuple<skgpu::TextureProxyView, SkColorType> SkImage_Base::asView(
|
||||
skgpu::Recorder* recorder, skgpu::Mipmapped mipmapped) const {
|
||||
skgpu::Recorder* recorder, skgpu::Mipmapped mipmapped, SkBudgeted budgeted) const {
|
||||
if (!recorder) {
|
||||
return {};
|
||||
}
|
||||
if (this->dimensions().area() <= 1) {
|
||||
mipmapped = skgpu::Mipmapped::kNo;
|
||||
}
|
||||
return this->onAsView(recorder, mipmapped);
|
||||
return this->onAsView(recorder, mipmapped, budgeted);
|
||||
}
|
||||
#endif // SK_GRAPHITE_ENABLED
|
||||
|
||||
|
@ -133,7 +133,8 @@ public:
|
||||
// the data in a texture.
|
||||
std::tuple<skgpu::TextureProxyView, SkColorType> asView(
|
||||
skgpu::Recorder*,
|
||||
skgpu::Mipmapped mipmapped) const;
|
||||
skgpu::Mipmapped mipmapped,
|
||||
SkBudgeted) const;
|
||||
#endif
|
||||
|
||||
virtual bool onPinAsTexture(GrRecordingContext*) const { return false; }
|
||||
@ -230,7 +231,8 @@ private:
|
||||
#ifdef SK_GRAPHITE_ENABLED
|
||||
virtual std::tuple<skgpu::TextureProxyView, SkColorType> onAsView(
|
||||
skgpu::Recorder*,
|
||||
skgpu::Mipmapped mipmapped) const {
|
||||
skgpu::Mipmapped mipmapped,
|
||||
SkBudgeted) const {
|
||||
return {}; // TODO: once incompatible derived classes are removed make this pure virtual
|
||||
}
|
||||
#endif
|
||||
|
@ -153,12 +153,11 @@ private:
|
||||
const SkMatrix&,
|
||||
const SkRect*,
|
||||
const SkRect*) const override;
|
||||
#endif
|
||||
#ifdef SK_GRAPHITE_ENABLED
|
||||
std::tuple<skgpu::TextureProxyView, SkColorType> onAsView(skgpu::Recorder*,
|
||||
skgpu::Mipmapped) const override {
|
||||
return {}; // TODO
|
||||
}
|
||||
#endif
|
||||
skgpu::Mipmapped,
|
||||
SkBudgeted) const override;
|
||||
#endif
|
||||
|
||||
SkBitmap fBitmap;
|
||||
@ -474,3 +473,12 @@ std::unique_ptr<GrFragmentProcessor> SkImage_Raster::onAsFragmentProcessor(
|
||||
domain);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SK_GRAPHITE_ENABLED
|
||||
std::tuple<skgpu::TextureProxyView, SkColorType> SkImage_Raster::onAsView(
|
||||
skgpu::Recorder*,
|
||||
skgpu::Mipmapped,
|
||||
SkBudgeted) const {
|
||||
return {}; // TODO
|
||||
}
|
||||
#endif
|
||||
|
@ -396,7 +396,9 @@ void SkImageShader::addToKey(const SkKeyContext& keyContext,
|
||||
|
||||
auto mipmapped = (fSampling.mipmap != SkMipmapMode::kNone) ? skgpu::Mipmapped::kYes
|
||||
: skgpu::Mipmapped::kNo;
|
||||
auto[view, ct] = grImage->asView(keyContext.recorder(), mipmapped);
|
||||
// TODO: In practice which SkBudgeted value used shouldn't matter because we're not going
|
||||
// to create a new texture here. But should the SkImage know its SkBudgeted state?
|
||||
auto[view, ct] = grImage->asView(keyContext.recorder(), mipmapped, SkBudgeted::kNo);
|
||||
imgData.fTextureProxy = view.refProxy();
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user