/* * Copyright 2015 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkImage_Gpu_DEFINED #define SkImage_Gpu_DEFINED #include "include/gpu/GrContext.h" #include "src/core/SkImagePriv.h" #include "src/gpu/GrGpuResourcePriv.h" #include "src/gpu/GrSurfaceProxyPriv.h" #include "src/gpu/SkGr.h" #include "src/image/SkImage_GpuBase.h" class GrTexture; class SkBitmap; struct SkYUVAIndex; class SkImage_Gpu : public SkImage_GpuBase { public: SkImage_Gpu(sk_sp, uint32_t uniqueID, SkAlphaType, sk_sp, sk_sp); ~SkImage_Gpu() override; GrSemaphoresSubmitted onFlush(GrContext*, const GrFlushInfo&) override; GrTextureProxy* peekProxy() const override { return fProxy.get(); } sk_sp asTextureProxyRef(GrRecordingContext*) const override { return fProxy; } bool onIsTextureBacked() const override { return SkToBool(fProxy.get()); } sk_sp onMakeColorTypeAndColorSpace(GrRecordingContext*, SkColorType, sk_sp) const final; sk_sp onReinterpretColorSpace(sk_sp) const final; /** * This is the implementation of SkDeferredDisplayListRecorder::makePromiseImage. */ static sk_sp MakePromiseTexture(GrContext* context, const GrBackendFormat& backendFormat, int width, int height, GrMipMapped mipMapped, GrSurfaceOrigin origin, SkColorType colorType, SkAlphaType alphaType, sk_sp colorSpace, PromiseImageTextureFulfillProc textureFulfillProc, PromiseImageTextureReleaseProc textureReleaseProc, PromiseImageTextureDoneProc textureDoneProc, PromiseImageTextureContext textureContext, PromiseImageApiVersion); static sk_sp ConvertYUVATexturesToRGB(GrContext*, SkYUVColorSpace yuvColorSpace, const GrBackendTexture yuvaTextures[], const SkYUVAIndex yuvaIndices[4], SkISize imageSize, GrSurfaceOrigin imageOrigin, GrRenderTargetContext*); private: sk_sp fProxy; typedef SkImage_GpuBase INHERITED; }; #endif