GrTextureOp.h 2.5 KB

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