SkBitmapController.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 SkBitmapController_DEFINED
  8. #define SkBitmapController_DEFINED
  9. #include "include/core/SkBitmap.h"
  10. #include "include/core/SkFilterQuality.h"
  11. #include "include/core/SkMatrix.h"
  12. #include "src/core/SkBitmapCache.h"
  13. #include "src/core/SkMipMap.h"
  14. class SkBitmapProvider;
  15. /**
  16. * Handles request to scale, filter, and lock a bitmap to be rasterized.
  17. */
  18. class SkBitmapController : ::SkNoncopyable {
  19. public:
  20. class State : ::SkNoncopyable {
  21. public:
  22. State(const SkBitmapProvider&, const SkMatrix& inv, SkFilterQuality);
  23. const SkPixmap& pixmap() const { return fPixmap; }
  24. const SkMatrix& invMatrix() const { return fInvMatrix; }
  25. SkFilterQuality quality() const { return fQuality; }
  26. private:
  27. bool processHighRequest(const SkBitmapProvider&);
  28. bool processMediumRequest(const SkBitmapProvider&);
  29. SkPixmap fPixmap;
  30. SkMatrix fInvMatrix;
  31. SkFilterQuality fQuality;
  32. // Pixmap storage.
  33. SkBitmap fResultBitmap;
  34. sk_sp<const SkMipMap> fCurrMip;
  35. };
  36. static State* RequestBitmap(const SkBitmapProvider&, const SkMatrix& inverse, SkFilterQuality,
  37. SkArenaAlloc*);
  38. private:
  39. SkBitmapController() = delete;
  40. };
  41. #endif