Flutter Engine
The Flutter Engine
SkImage_GaneshBase.h
Go to the documentation of this file.
1/*
2 * Copyright 2018 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkImage_GaneshBase_DEFINED
9#define SkImage_GaneshBase_DEFINED
10
17
18#include <memory>
19#include <tuple>
20#include <cstddef>
21#include <cstdint>
22
23class GrBackendFormat;
25class GrCaps;
27class GrDirectContext;
30class GrTextureProxy;
31class SkBitmap;
32class SkColorSpace;
33class SkImage;
34class SkMatrix;
35enum GrSurfaceOrigin : int;
36enum SkAlphaType : int;
37enum SkColorType : int;
38enum class GrColorType;
39enum class GrImageTexGenPolicy : int;
40enum class GrSemaphoresSubmitted : bool;
41enum class SkTileMode;
42struct GrFlushInfo;
43struct SkIRect;
44struct SkISize;
45struct SkImageInfo;
46struct SkRect;
47namespace skgpu {
48enum class Mipmapped : bool;
49class RefCntedCallback;
50} // namespace skgpu
51
52namespace skgpu { namespace graphite { class Recorder; } }
53
55public:
56 // From SkImage.h
57 bool isValid(GrRecordingContext*) const final;
59 SkColorType targetColorType,
60 sk_sp<SkColorSpace> targetCS) const final;
61 sk_sp<SkImage> makeSubset(GrDirectContext* direct, const SkIRect& subset) const final;
62
63 // From SkImage_Base.h
64 GrImageContext* context() const final { return fContext.get(); }
65 GrDirectContext* directContext() const final { return GrAsDirectContext(this->context()); }
66
67 bool getROPixels(GrDirectContext*, SkBitmap*, CachingHint) const final;
68
69 sk_sp<SkImage> onMakeSubset(GrDirectContext*, const SkIRect& subset) const final;
70
71 bool onReadPixels(GrDirectContext* dContext,
72 const SkImageInfo& dstInfo,
73 void* dstPixels,
74 size_t dstRB,
75 int srcX,
76 int srcY,
77 CachingHint) const override;
78
79 // From SkImage_GaneshBase.h
81
82 static bool ValidateBackendTexture(const GrCaps*,
83 const GrBackendTexture& tex,
84 GrColorType grCT,
85 SkColorType ct,
86 SkAlphaType at,
89 const GrBackendTexture& tex,
91
92 // Helper for making a lazy proxy for a promise image.
93 // PromiseImageTextureFulfillProc must not be null.
97 const GrBackendFormat&,
100 sk_sp<skgpu::RefCntedCallback> releaseHelper);
101
102 virtual std::tuple<GrSurfaceProxyView, GrColorType> asView(GrRecordingContext*,
104 GrImageTexGenPolicy) const = 0;
105
106 virtual std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(GrRecordingContext*,
108 const SkTileMode[2],
109 const SkMatrix&,
110 const SkRect*,
111 const SkRect*) const = 0;
112
113 virtual GrSurfaceOrigin origin() const = 0;
114
115protected:
117
119 const SkIRect& subset,
120 RequiredProperties) const final;
125 RequiredProperties) const final;
126
128};
129
130#endif
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
GrColorType
Definition: GrTypesPriv.h:540
GrSurfaceOrigin
Definition: GrTypes.h:147
GrSemaphoresSubmitted
Definition: GrTypes.h:229
SkAlphaType
Definition: SkAlphaType.h:26
SkColorType
Definition: SkColorType.h:19
GrImageTexGenPolicy
Definition: SkGr.h:141
SkTileMode
Definition: SkTileMode.h:13
Definition: GrCaps.h:57
virtual sk_sp< SkImage > onMakeColorTypeAndColorSpace(SkColorType, sk_sp< SkColorSpace >, GrDirectContext *) const =0
static bool ValidateBackendTexture(const GrCaps *, const GrBackendTexture &tex, GrColorType grCT, SkColorType ct, SkAlphaType at, sk_sp< SkColorSpace > cs)
GrDirectContext * directContext() const final
virtual std::tuple< GrSurfaceProxyView, GrColorType > asView(GrRecordingContext *, skgpu::Mipmapped, GrImageTexGenPolicy) const =0
virtual GrSemaphoresSubmitted flush(GrDirectContext *, const GrFlushInfo &) const =0
bool isValid(GrRecordingContext *) const final
sk_sp< SkImage > onMakeSubset(GrDirectContext *, const SkIRect &subset) const final
sk_sp< SkImage > makeSubset(GrDirectContext *direct, const SkIRect &subset) const final
SkImage_GaneshBase(sk_sp< GrImageContext >, SkImageInfo, uint32_t uniqueID)
static bool ValidateCompressedBackendTexture(const GrCaps *, const GrBackendTexture &tex, SkAlphaType)
virtual GrSurfaceOrigin origin() const =0
sk_sp< SkImage > makeColorTypeAndColorSpace(GrDirectContext *dContext, SkColorType targetColorType, sk_sp< SkColorSpace > targetCS) const final
sk_sp< GrImageContext > fContext
GrImageContext * context() const final
static sk_sp< GrTextureProxy > MakePromiseImageLazyProxy(GrContextThreadSafeProxy *, SkISize dimensions, const GrBackendFormat &, skgpu::Mipmapped, SkImages::PromiseImageTextureFulfillProc, sk_sp< skgpu::RefCntedCallback > releaseHelper)
bool getROPixels(GrDirectContext *, SkBitmap *, CachingHint) const final
virtual std::unique_ptr< GrFragmentProcessor > asFragmentProcessor(GrRecordingContext *, SkSamplingOptions, const SkTileMode[2], const SkMatrix &, const SkRect *, const SkRect *) const =0
bool onReadPixels(GrDirectContext *dContext, const SkImageInfo &dstInfo, void *dstPixels, size_t dstRB, int srcX, int srcY, CachingHint) const override
SkISize dimensions() const
Definition: SkImage.h:297
uint32_t uniqueID() const
Definition: SkImage.h:311
CachingHint
Definition: SkImage.h:463
T * get() const
Definition: SkRefCnt.h:303
Definition: GpuTools.h:21
Mipmapped
Definition: GpuTypes.h:53
Definition: SkRect.h:32
Definition: SkSize.h:16