GrDrawOpTest.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright 2015 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 GrDrawOpTest_DEFINED
  8. #define GrDrawOpTest_DEFINED
  9. #include "include/core/SkRefCnt.h"
  10. #include "src/gpu/GrTestUtils.h"
  11. #if GR_TEST_UTILS
  12. class GrContext_Base;
  13. class GrDrawOp;
  14. class GrPaint;
  15. class GrRecordingContext;
  16. class GrRenderTargetContext;
  17. struct GrUserStencilSettings;
  18. class SkRandom;
  19. /** This function draws a randomly configured GrDrawOp for testing purposes. */
  20. void GrDrawRandomOp(SkRandom*, GrRenderTargetContext*, GrPaint&&);
  21. /** GrDrawOp subclasses should define test factory functions using this macro. */
  22. #define GR_DRAW_OP_TEST_DEFINE(Op) \
  23. std::unique_ptr<GrDrawOp> Op##__Test(GrPaint&& paint, SkRandom* random, \
  24. GrRecordingContext* context, int numSamples)
  25. #define GR_DRAW_OP_TEST_FRIEND(Op) \
  26. friend std::unique_ptr<GrDrawOp> Op##__Test(GrPaint&& paint, SkRandom* random, \
  27. GrRecordingContext* context, int numSamples)
  28. /** Helper for op test factories to pick a random stencil state. */
  29. const GrUserStencilSettings* GrGetRandomStencil(SkRandom* random, GrContext_Base*);
  30. #endif
  31. #endif