TestAtlasTextRenderer.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright 2017 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 TestAtlasTextRenderer_DEFINED
  8. #define TestAtlasTextRenderer_DEFINED
  9. #include "include/atlastext/SkAtlasTextRenderer.h"
  10. #include "include/core/SkBitmap.h"
  11. namespace sk_gpu_test {
  12. class TestContext;
  13. /**
  14. * Base class for implementations of SkAtlasTextRenderer in order to test the SkAtlasText APIs.
  15. * Adds a helper for creating SkAtlasTextTargets and to read back the contents of a target as a
  16. * bitmap.
  17. */
  18. class TestAtlasTextRenderer : public SkAtlasTextRenderer {
  19. public:
  20. /** Returns a handle that can be used to construct a SkAtlasTextTarget instance. */
  21. virtual void* makeTargetHandle(int width, int height) = 0;
  22. /** Makes a SkBitmap of the target handle's contents. */
  23. virtual SkBitmap readTargetHandle(void* targetHandle) = 0;
  24. /** Clears the target to the specified color, encoded as RGBA (low to high byte order) */
  25. virtual void clearTarget(void* targetHandle, uint32_t color) = 0;
  26. };
  27. } // namespace sk_gpu_test
  28. #endif