#include "src/gpu/graphite/TextureUtils.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkPaint.h"
#include "include/core/SkSurface.h"
#include "include/effects/SkRuntimeEffect.h"
#include "src/core/SkBlurEngine.h"
#include "src/core/SkCompressedDataUtils.h"
#include "src/core/SkDevice.h"
#include "src/core/SkImageFilterCache.h"
#include "src/core/SkImageFilterTypes.h"
#include "src/core/SkMipmap.h"
#include "src/core/SkSamplingPriv.h"
#include "src/core/SkTraceEvent.h"
#include "src/image/SkImage_Base.h"
#include "include/gpu/graphite/BackendTexture.h"
#include "include/gpu/graphite/Context.h"
#include "include/gpu/graphite/GraphiteTypes.h"
#include "include/gpu/graphite/Image.h"
#include "include/gpu/graphite/ImageProvider.h"
#include "include/gpu/graphite/Recorder.h"
#include "include/gpu/graphite/Recording.h"
#include "include/gpu/graphite/Surface.h"
#include "src/gpu/BlurUtils.h"
#include "src/gpu/RefCntedCallback.h"
#include "src/gpu/SkBackingFit.h"
#include "src/gpu/graphite/Buffer.h"
#include "src/gpu/graphite/Caps.h"
#include "src/gpu/graphite/CommandBuffer.h"
#include "src/gpu/graphite/Device.h"
#include "src/gpu/graphite/Image_Graphite.h"
#include "src/gpu/graphite/Log.h"
#include "src/gpu/graphite/RecorderPriv.h"
#include "src/gpu/graphite/ResourceProvider.h"
#include "src/gpu/graphite/ResourceTypes.h"
#include "src/gpu/graphite/SpecialImage_Graphite.h"
#include "src/gpu/graphite/Surface_Graphite.h"
#include "src/gpu/graphite/Texture.h"
#include "src/gpu/graphite/task/CopyTask.h"
#include "src/gpu/graphite/task/SynchronizeToCpuTask.h"
#include "src/gpu/graphite/task/UploadTask.h"
#include <array>
GraphitePromiseTextureFulfillProc;
GraphitePromiseTextureFulfillContext;
GraphitePromiseTextureReleaseProc;
namespace skgpu::graphite {
namespace {
sk_sp<Surface> make_renderable_scratch_surface(
Recorder* recorder,
const SkImageInfo& info,
SkBackingFit backingFit,
std::string_view label,
const SkSurfaceProps* surfaceProps = nullptr) { … }
bool valid_client_provided_image(const SkImage* clientProvided,
const SkImage* original,
SkImage::RequiredProperties requiredProps) { … }
#if defined(SK_USE_LEGACY_BLUR_GRAPHITE)
sk_sp<SkSpecialImage> eval_blur(Recorder* recorder,
sk_sp<SkShader> blurEffect,
const SkIRect& dstRect,
SkColorType colorType,
sk_sp<SkColorSpace> outCS,
const SkSurfaceProps& outProps) { … }
sk_sp<SkSpecialImage> blur_2d(Recorder* recorder,
SkSize sigma,
SkISize radii,
sk_sp<SkSpecialImage> input,
const SkIRect& srcRect,
SkTileMode tileMode,
const SkIRect& dstRect,
sk_sp<SkColorSpace> outCS,
const SkSurfaceProps& outProps) { … }
sk_sp<SkSpecialImage> blur_1d(Recorder* recorder,
float sigma,
int radius,
SkV2 dir,
sk_sp<SkSpecialImage> input,
SkIRect srcRect,
SkTileMode tileMode,
SkIRect dstRect,
sk_sp<SkColorSpace> outCS,
const SkSurfaceProps& outProps) { … }
sk_sp<SkSpecialImage> blur_impl(Recorder* recorder,
SkSize sigma,
sk_sp<SkSpecialImage> input,
SkIRect srcRect,
SkTileMode tileMode,
SkIRect dstRect,
sk_sp<SkColorSpace> outCS,
const SkSurfaceProps& outProps) { … }
#endif
class PromiseLazyInstantiateCallback { … };
}
std::tuple<TextureProxyView, SkColorType> MakeBitmapProxyView(Recorder* recorder,
const SkBitmap& bitmap,
sk_sp<SkMipmap> mipmapsIn,
Mipmapped mipmapped,
Budgeted budgeted,
std::string_view label) { … }
sk_sp<TextureProxy> MakePromiseImageLazyProxy(
const Caps* caps,
SkISize dimensions,
TextureInfo textureInfo,
Volatile isVolatile,
sk_sp<RefCntedCallback> releaseHelper,
GraphitePromiseTextureFulfillProc fulfillProc,
GraphitePromiseTextureFulfillContext fulfillContext,
GraphitePromiseTextureReleaseProc textureReleaseProc,
std::string_view label) { … }
sk_sp<SkImage> MakeFromBitmap(Recorder* recorder,
const SkColorInfo& colorInfo,
const SkBitmap& bitmap,
sk_sp<SkMipmap> mipmaps,
Budgeted budgeted,
SkImage::RequiredProperties requiredProps,
std::string_view label) { … }
size_t ComputeSize(SkISize dimensions, const TextureInfo& info) { … }
sk_sp<Image> CopyAsDraw(Recorder* recorder,
const SkImage* image,
const SkIRect& subset,
const SkColorInfo& dstColorInfo,
Budgeted budgeted,
Mipmapped mipmapped,
SkBackingFit backingFit,
std::string_view label) { … }
sk_sp<SkImage> RescaleImage(Recorder* recorder,
const SkImage* srcImage,
SkIRect srcIRect,
const SkImageInfo& dstInfo,
SkImage::RescaleGamma rescaleGamma,
SkImage::RescaleMode rescaleMode) { … }
bool GenerateMipmaps(Recorder* recorder,
sk_sp<TextureProxy> texture,
const SkColorInfo& colorInfo) { … }
std::pair<sk_sp<SkImage>, SkSamplingOptions> GetGraphiteBacked(Recorder* recorder,
const SkImage* imageIn,
SkSamplingOptions sampling) { … }
TextureProxyView AsView(const SkImage* image) { … }
SkColorType ComputeShaderCoverageMaskTargetFormat(const Caps* caps) { … }
}
namespace skif {
namespace {
class GraphiteBackend :
public Backend,
#if defined(SK_USE_LEGACY_BLUR_GRAPHITE)
private SkBlurEngine::Algorithm,
#else
private SkShaderBlurAlgorithm,
#endif
private SkBlurEngine { … };
}
sk_sp<Backend> MakeGraphiteBackend(skgpu::graphite::Recorder* recorder,
const SkSurfaceProps& surfaceProps,
SkColorType colorType) { … }
}