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 "include/atlastext/SkAtlasTextRenderer.h" 12 #include "include/core/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 /** Clears the target to the specified color, encoded as RGBA (low to high byte order) */ 32 virtual void clearTarget(void* targetHandle, uint32_t color) = 0; 33 }; 34 35 } // namespace sk_gpu_test 36 37 #endif 38