Brian Salomon | cbcb0a1 | 2017-11-19 13:20:13 -0500 | [diff] [blame] | 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 | |
| 8 | #ifndef TestAtlasTextRenderer_DEFINED |
| 9 | #define TestAtlasTextRenderer_DEFINED |
| 10 | |
| 11 | #include "SkAtlasTextRenderer.h" |
| 12 | #include "SkBitmap.h" |
| 13 | |
| 14 | namespace sk_gpu_test { |
| 15 | |
| 16 | class TestContext; |
| 17 | |
| 18 | /** |
| 19 | * Base class for implementations of SkAtlasTextRenderer in order to test the SkAtlasText APIs. |
| 20 | * Adds a helper for creating SkAtlasTextTargets and to read back the contents of a target as a |
| 21 | * bitmap. |
| 22 | */ |
| 23 | class TestAtlasTextRenderer : public SkAtlasTextRenderer { |
| 24 | public: |
| 25 | /** Returns a handle that can be used to construct a SkAtlasTextTarget instance. */ |
| 26 | virtual void* makeTargetHandle(int width, int height) = 0; |
| 27 | |
| 28 | /** Makes a SkBitmap of the target handle's contents. */ |
| 29 | virtual SkBitmap readTargetHandle(void* targetHandle) = 0; |
| 30 | }; |
| 31 | |
| 32 | } // namespace sk_gpu_test |
| 33 | |
| 34 | #endif |