SkMaskCache.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 SkMaskCache_DEFINED
  8. #define SkMaskCache_DEFINED
  9. #include "include/core/SkBlurTypes.h"
  10. #include "include/core/SkRRect.h"
  11. #include "include/core/SkRect.h"
  12. #include "src/core/SkCachedData.h"
  13. #include "src/core/SkMask.h"
  14. #include "src/core/SkResourceCache.h"
  15. class SkMaskCache {
  16. public:
  17. /**
  18. * On success, return a ref to the SkCachedData that holds the pixels, and have mask
  19. * already point to that memory.
  20. *
  21. * On failure, return nullptr.
  22. */
  23. static SkCachedData* FindAndRef(SkScalar sigma, SkBlurStyle style,
  24. const SkRRect& rrect, SkMask* mask,
  25. SkResourceCache* localCache = nullptr);
  26. static SkCachedData* FindAndRef(SkScalar sigma, SkBlurStyle style,
  27. const SkRect rects[], int count, SkMask* mask,
  28. SkResourceCache* localCache = nullptr);
  29. /**
  30. * Add a mask and its pixel-data to the cache.
  31. */
  32. static void Add(SkScalar sigma, SkBlurStyle style,
  33. const SkRRect& rrect, const SkMask& mask, SkCachedData* data,
  34. SkResourceCache* localCache = nullptr);
  35. static void Add(SkScalar sigma, SkBlurStyle style,
  36. const SkRect rects[], int count, const SkMask& mask, SkCachedData* data,
  37. SkResourceCache* localCache = nullptr);
  38. };
  39. #endif