blob: 6ba43260648b2cfb09c8518750b48ed543577e47 [file] [log] [blame]
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001/*
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
14namespace sk_gpu_test {
15
16class 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 */
23class TestAtlasTextRenderer : public SkAtlasTextRenderer {
24public:
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;
Brian Salomon40dc8a72017-11-20 11:01:54 -050030
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;
Brian Salomoncbcb0a12017-11-19 13:20:13 -050033};
34
35} // namespace sk_gpu_test
36
37#endif