blob: 18e45d2ff8a0a2fd68c898d483f28a7ae6deecd6 [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;
Herb Derby65956872018-08-21 16:55:04 -040017class SkGlyphRunListPainter;
Herb Derbyc1b482c2018-08-09 15:02:27 -040018class 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 Phillips137ca522018-08-15 10:14:33 -040034 const SkMatrix& viewMatrix, bool pathIsMutable) = 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
Herb Derby65956872018-08-21 16:55:04 -040041 virtual SkGlyphRunListPainter* glyphPainter() = 0;
Herb Derbyc1b482c2018-08-09 15:02:27 -040042
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