SkCanvasPriv.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 SkCanvasPriv_DEFINED
  8. #define SkCanvasPriv_DEFINED
  9. #include "include/core/SkCanvas.h"
  10. #include "include/private/SkNoncopyable.h"
  11. class SkReadBuffer;
  12. class SkWriteBuffer;
  13. class SkAutoCanvasMatrixPaint : SkNoncopyable {
  14. public:
  15. SkAutoCanvasMatrixPaint(SkCanvas*, const SkMatrix*, const SkPaint*, const SkRect& bounds);
  16. ~SkAutoCanvasMatrixPaint();
  17. private:
  18. SkCanvas* fCanvas;
  19. int fSaveCount;
  20. };
  21. class SkCanvasPriv {
  22. public:
  23. enum {
  24. kDontClipToLayer_SaveLayerFlag = SkCanvas::kDontClipToLayer_PrivateSaveLayerFlag,
  25. };
  26. // The lattice has pointers directly into the readbuffer
  27. static bool ReadLattice(SkReadBuffer&, SkCanvas::Lattice*);
  28. static void WriteLattice(SkWriteBuffer&, const SkCanvas::Lattice&);
  29. // return the byte-size of the lattice, even if the buffer is null
  30. // storage must be 4-byte aligned
  31. static size_t WriteLattice(void* storage, const SkCanvas::Lattice&);
  32. static SkCanvas::SaveLayerFlags LegacySaveFlagsToSaveLayerFlags(uint32_t legacySaveFlags);
  33. static int SaveBehind(SkCanvas* canvas, const SkRect* subset) {
  34. return canvas->only_axis_aligned_saveBehind(subset);
  35. }
  36. static void DrawBehind(SkCanvas* canvas, const SkPaint& paint) {
  37. canvas->drawClippedToSaveBehind(paint);
  38. }
  39. // The experimental_DrawEdgeAAImageSet API accepts separate dstClips and preViewMatrices arrays,
  40. // where entries refer into them, but no explicit size is provided. Given a set of entries,
  41. // computes the minimum length for these arrays that would provide index access errors.
  42. static void GetDstClipAndMatrixCounts(const SkCanvas::ImageSetEntry set[], int count,
  43. int* totalDstClipCount, int* totalMatrixCount);
  44. };
  45. #endif