1/*
2 * Copyright 2015 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 GrTextTarget_DEFINED
9#define GrTextTarget_DEFINED
10
11#include "include/core/SkPaint.h"
12#include "src/gpu/GrColorInfo.h"
13
14class GrAtlasTextOp;
15class GrClip;
16class GrPaint;
17class GrRecordingContext;
18class GrShape;
19class SkGlyphRunListPainter;
20class SkMatrix;
21struct SkIRect;
22
23class GrTextTarget {
24public:
25 virtual ~GrTextTarget() = default;
26
27 int width() const { return fWidth; }
28
29 int height() const { return fHeight; }
30
31 const GrColorInfo& colorInfo() const { return fColorInfo; }
32
33 virtual void addDrawOp(const GrClip&, std::unique_ptr<GrAtlasTextOp> op) = 0;
34
35 virtual void drawShape(const GrClip&, const SkPaint&,
36 const SkMatrix& viewMatrix, const GrShape&) = 0;
37
38 virtual void makeGrPaint(GrMaskFormat, const SkPaint&, const SkMatrix& viewMatrix,
39 GrPaint*) = 0;
40
41 virtual GrRecordingContext* getContext() = 0;
42
43 virtual SkGlyphRunListPainter* glyphPainter() = 0;
44
45protected:
46 GrTextTarget(int width, int height, const GrColorInfo& colorInfo)
47 : fWidth(width), fHeight(height), fColorInfo(colorInfo) {
48 SkASSERT(kPremul_SkAlphaType == colorInfo.alphaType());
49 }
50
51private:
52 int fWidth;
53 int fHeight;
54 const GrColorInfo& fColorInfo;
55};
56#endif // GrTextTarget_DEFINED
57