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 GrTextureOp_DEFINED 8 #define GrTextureOp_DEFINED 9 10 #include "include/core/SkCanvas.h" 11 #include "include/core/SkRefCnt.h" 12 #include "include/private/GrTypesPriv.h" 13 #include "src/gpu/GrColor.h" 14 #include "src/gpu/GrRenderTargetContext.h" 15 #include "src/gpu/GrSamplerState.h" 16 17 class GrColorSpaceXform; 18 class GrDrawOp; 19 class GrTextureProxy; 20 struct SkRect; 21 class SkMatrix; 22 23 namespace GrTextureOp { 24 25 /** 26 * Creates an op that draws a sub-quadrilateral of a texture. The passed color is modulated by the 27 * texture's color. 'deviceQuad' specifies the device-space coordinates to draw, using 'localQuad' 28 * to map into the proxy's texture space. If non-null, 'domain' represents the boundary for the 29 * strict src rect constraint. If GrAAType is kCoverage then AA is applied to the edges 30 * indicated by GrQuadAAFlags. Otherwise, GrQuadAAFlags is ignored. 31 * 32 * This is functionally very similar to GrFillRectOp::Make, except that the GrPaint has been 33 * deconstructed into the texture, filter, modulating color, and blend mode. When blend mode is 34 * src over, this will return a GrFillRectOp with a paint that samples the proxy. 35 */ 36 std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context, 37 sk_sp<GrTextureProxy> proxy, 38 sk_sp<GrColorSpaceXform> textureXform, 39 GrSamplerState::Filter filter, 40 const SkPMColor4f& color, 41 SkBlendMode blendMode, 42 GrAAType aaType, 43 GrQuadAAFlags aaFlags, 44 const GrQuad& deviceQuad, 45 const GrQuad& localQuad, 46 const SkRect* domain = nullptr); 47 48 // Unlike the single-proxy factory, this only supports src-over blending. 49 std::unique_ptr<GrDrawOp> MakeSet(GrRecordingContext*, 50 const GrRenderTargetContext::TextureSetEntry[], 51 int cnt, 52 GrSamplerState::Filter, 53 GrAAType, 54 SkCanvas::SrcRectConstraint, 55 const SkMatrix& viewMatrix, 56 sk_sp<GrColorSpaceXform> textureXform); 57 58 } 59 #endif // GrTextureOp_DEFINED 60