Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
TextureOp.h
Go to the documentation of this file.
1/*
2 * Copyright 2017 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#ifndef skgpu_ganesh_TextureOp_DEFINED
8#define skgpu_ganesh_TextureOp_DEFINED
9
16
17struct DrawQuad;
18class GrClip;
20class GrDrawOp;
21class GrTextureProxy;
23struct SkRect;
24class SkMatrix;
25class GrQuad;
26
27namespace skgpu::ganesh {
29}
30
31namespace skgpu::ganesh {
32
33/**
34 * Tests if filtering will have any effect in the drawing of the 'srcQuad' to the 'dstquad'.
35 * We return false when filtering has no impact drawing operations as they are effectively blits.
36 */
37std::tuple<bool /* filter */, bool /* mipmap */> FilterAndMipmapHaveNoEffect(const GrQuad& srcQuad,
38 const GrQuad& dstQuad);
39
41
42class TextureOp {
43public:
44 /**
45 * Controls whether saturate() is called after the texture is color-converted to ensure all
46 * color values are in 0..1 range.
47 */
48 enum class Saturate : bool { kNo = false, kYes = true };
49
50 /**
51 * Creates an op that draws a sub-quadrilateral of a texture. The passed color is modulated by
52 * the texture's color. 'deviceQuad' specifies the device-space coordinates to draw, using
53 * 'localQuad' to map into the proxy's texture space. If non-null, 'subset' represents the
54 * boundary for the strict src rect constraint. If GrAAType is kCoverage then AA is applied to
55 * the edges indicated by GrQuadAAFlags. Otherwise, GrQuadAAFlags is ignored.
56 *
57 * This is functionally very similar to FillRectOp::Make, except that the GrPaint has been
58 * deconstructed into the texture, filter, modulating color, and blend mode. When blend mode is
59 * src over, this will return a FillRectOp with a paint that samples the proxy.
60 */
63 SkAlphaType srcAlphaType,
67 const SkPMColor4f&,
71 DrawQuad*,
72 const SkRect* subset = nullptr);
73
74 // Automatically falls back to using one FillRectOp per entry if dynamic states are not
75 // supported, or if the blend mode is not src-over. 'cnt' is the size of the entry array.
76 // 'proxyCnt' <= 'cnt' and represents the number of proxy switches within the array.
78 const GrClip*,
81 int cnt,
82 int proxyRunCnt,
89 const SkMatrix& viewMatrix,
90 sk_sp<GrColorSpaceXform> textureXform);
91
92#if defined(GR_TEST_UTILS)
93 static uint32_t ClassID();
94#endif
95
96private:
97 class BatchSizeLimiter;
98};
99
100} // namespace skgpu::ganesh
101
102#endif // skgpu_ganesh_TextureOp_DEFINED
GrAAType
SkAlphaType
Definition SkAlphaType.h:26
SkBlendMode
Definition SkBlendMode.h:38
SkFilterMode
SkMipmapMode
std::unique_ptr< GrOp > Owner
Definition GrOp.h:72
SrcRectConstraint
Definition SkCanvas.h:1541
static void AddTextureSetOps(skgpu::ganesh::SurfaceDrawContext *, const GrClip *, GrRecordingContext *, GrTextureSetEntry[], int cnt, int proxyRunCnt, GrSamplerState::Filter, GrSamplerState::MipmapMode, Saturate, SkBlendMode, GrAAType, SkCanvas::SrcRectConstraint, const SkMatrix &viewMatrix, sk_sp< GrColorSpaceXform > textureXform)
static GrOp::Owner Make(GrRecordingContext *, GrSurfaceProxyView, SkAlphaType srcAlphaType, sk_sp< GrColorSpaceXform >, GrSamplerState::Filter, GrSamplerState::MipmapMode, const SkPMColor4f &, Saturate, SkBlendMode, GrAAType, DrawQuad *, const SkRect *subset=nullptr)
std::tuple< bool, bool > FilterAndMipmapHaveNoEffect(const GrQuad &srcQuad, const GrQuad &dstQuad)