blob: f5a7efa49d2604c8f4b77e8f07bb9356d5f15eac [file] [log] [blame]
Herb Derbyc1b482c2018-08-09 15:02:27 -04001/*
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 "GrColorSpaceInfo.h"
12#include "SkPaint.h"
13
14class GrAtlasTextOp;
15class GrClip;
16class GrPaint;
17class SkGlyphRunListDrawer;
18class SkMatrix;
19struct SkIRect;
20
21class GrTextTarget {
22public:
23 virtual ~GrTextTarget() = default;
24
25 int width() const { return fWidth; }
26
27 int height() const { return fHeight; }
28
29 const GrColorSpaceInfo& colorSpaceInfo() const { return fColorSpaceInfo; }
30
31 virtual void addDrawOp(const GrClip&, std::unique_ptr<GrAtlasTextOp> op) = 0;
32
33 virtual void drawPath(const GrClip&, const SkPath&, const SkPaint&,
34 const SkMatrix& viewMatrix, const SkMatrix* pathMatrix,
35 const SkIRect& clipBounds) = 0;
36
37 virtual void makeGrPaint(GrMaskFormat, const SkPaint&, const SkMatrix& viewMatrix,
38 GrPaint*) = 0;
39
40 virtual GrContext* getContext() = 0;
41
42 virtual SkGlyphRunListDrawer* glyphDrawer() = 0;
43
44protected:
45 GrTextTarget(int width, int height, const GrColorSpaceInfo& colorSpaceInfo)
46 : fWidth(width), fHeight(height), fColorSpaceInfo(colorSpaceInfo) {}
47
48private:
49 int fWidth;
50 int fHeight;
51 const GrColorSpaceInfo& fColorSpaceInfo;
52};
53#endif // GrTextTarget_DEFINED