blob: 3bcbe9a29c18e1c799bd2c7cac73170ec8c4fc66 [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&,
Robert Phillipse4643cc2018-08-14 13:01:29 -040034 const SkMatrix& viewMatrix, const SkMatrix* pathMatrix) = 0;
Herb Derbyc1b482c2018-08-09 15:02:27 -040035
36 virtual void makeGrPaint(GrMaskFormat, const SkPaint&, const SkMatrix& viewMatrix,
37 GrPaint*) = 0;
38
39 virtual GrContext* getContext() = 0;
40
41 virtual SkGlyphRunListDrawer* glyphDrawer() = 0;
42
43protected:
44 GrTextTarget(int width, int height, const GrColorSpaceInfo& colorSpaceInfo)
45 : fWidth(width), fHeight(height), fColorSpaceInfo(colorSpaceInfo) {}
46
47private:
48 int fWidth;
49 int fHeight;
50 const GrColorSpaceInfo& fColorSpaceInfo;
51};
52#endif // GrTextTarget_DEFINED