#include "src/gpu/graphite/Image_Graphite.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkImage.h"
#include "include/core/SkSurface.h"
#include "include/gpu/graphite/Image.h"
#include "include/gpu/graphite/Recorder.h"
#include "include/gpu/graphite/Surface.h"
#include "src/gpu/SkBackingFit.h"
#include "src/gpu/graphite/Caps.h"
#include "src/gpu/graphite/Device.h"
#include "src/gpu/graphite/Log.h"
#include "src/gpu/graphite/RecorderPriv.h"
#include "src/gpu/graphite/ResourceProvider.h"
#include "src/gpu/graphite/Texture.h"
#include "src/gpu/graphite/TextureUtils.h"
#include "src/gpu/graphite/task/CopyTask.h"
#if defined(GPU_TEST_UTILS)
#include "include/gpu/graphite/Context.h"
#include "src/gpu/graphite/ContextPriv.h"
#endif
namespace skgpu::graphite {
Image::Image(TextureProxyView view,
const SkColorInfo& info)
: … { … }
Image::~Image() = default;
sk_sp<Image> Image::WrapDevice(sk_sp<Device> device) { … }
sk_sp<Image> Image::Copy(Recorder* recorder,
const TextureProxyView& srcView,
const SkColorInfo& srcColorInfo,
const SkIRect& subset,
Budgeted budgeted,
Mipmapped mipmapped,
SkBackingFit backingFit,
std::string_view label) { … }
size_t Image::textureSize() const { … }
sk_sp<Image> Image::copyImage(Recorder* recorder,
const SkIRect& subset,
Budgeted budgeted,
Mipmapped mipmapped,
SkBackingFit backingFit,
std::string_view label) const { … }
sk_sp<SkImage> Image::onReinterpretColorSpace(sk_sp<SkColorSpace> newCS) const { … }
#if defined(GPU_TEST_UTILS)
bool Image::readPixelsGraphite(Recorder* recorder, const SkPixmap& dst, int srcX, int srcY) const {
if (Context* context = recorder->priv().context()) {
std::unique_ptr<Recording> recording = recorder->snap();
if (!recording) {
return false;
}
InsertRecordingInfo info;
info.fRecording = recording.get();
if (!context->insertRecording(info)) {
return false;
}
return context->priv().readPixels(dst,
fTextureProxyView.proxy(),
this->imageInfo(),
srcX,
srcY);
}
return false;
}
#endif
}