GrBitmapTextureMaker.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright 2016 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 GrBitmapTextureMaker_DEFINED
  8. #define GrBitmapTextureMaker_DEFINED
  9. #include "include/core/SkBitmap.h"
  10. #include "src/gpu/GrTextureMaker.h"
  11. /** This class manages the conversion of SW-backed bitmaps to GrTextures. If the input bitmap is
  12. non-volatile the texture is cached using a key created from the pixels' image id and the
  13. subset of the pixelref specified by the bitmap. */
  14. class GrBitmapTextureMaker : public GrTextureMaker {
  15. public:
  16. GrBitmapTextureMaker(GrRecordingContext* context, const SkBitmap& bitmap,
  17. bool useDecal = false);
  18. protected:
  19. sk_sp<GrTextureProxy> refOriginalTextureProxy(bool willBeMipped,
  20. AllowedTexGenType onlyIfFast) override;
  21. void makeCopyKey(const CopyParams& copyParams, GrUniqueKey* copyKey) override;
  22. void didCacheCopy(const GrUniqueKey& copyKey, uint32_t contextUniqueID) override;
  23. private:
  24. const SkBitmap fBitmap;
  25. GrUniqueKey fOriginalKey;
  26. typedef GrTextureMaker INHERITED;
  27. };
  28. #endif