CanvasStateHelpers.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright 2014 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 CanvasStateHelpers_DEFINED
  8. #define CanvasStateHelpers_DEFINED
  9. #include "include/core/SkTypes.h"
  10. #ifdef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
  11. class SkCanvas;
  12. class SkCanvasState;
  13. class SkRegion;
  14. /*
  15. * Helper function to perform drawing to an SkCanvas. Used by both
  16. * test_complex_layers and complex_layers_draw_from_canvas_state.
  17. */
  18. void complex_layers_draw(SkCanvas* canvas, float left, float top,
  19. float right, float bottom, int32_t spacer);
  20. /*
  21. * Create an SkCanvas from state and draw to it. Return true on success.
  22. *
  23. * Used by test_complex_layers test in CanvasStateTest. Marked as extern
  24. * so it can be called from a separate library.
  25. */
  26. extern "C" bool complex_layers_draw_from_canvas_state(SkCanvasState* state,
  27. float left, float top, float right, float bottom, int32_t spacer);
  28. /*
  29. * Helper function to perform drawing to an SkCanvas. Used both by test_complex_clips
  30. * and complex_clips_draw_from_canvas_state.
  31. */
  32. void complex_clips_draw(SkCanvas* canvas, int32_t left, int32_t top,
  33. int32_t right, int32_t bottom, int32_t clipOp, const SkRegion& localRegion);
  34. /*
  35. * Create an SkCanvas from state and draw to it. Return true on success.
  36. *
  37. * Used by test_complex_clips test in CanvasStateTest. Marked as extern
  38. * so it can be called from a separate library.
  39. */
  40. extern "C" bool complex_clips_draw_from_canvas_state(SkCanvasState* state,
  41. int32_t left, int32_t top, int32_t right, int32_t bottom, int32_t clipOp,
  42. int32_t regionRects, int32_t* rectCoords);
  43. #endif // SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
  44. #endif // CanvasStateHelpers_DEFINED