blob: 1742f59e1b65be83146e118bb0287199115ccf1f [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;
Robert Phillips46a13382018-08-23 13:53:01 -040017class GrShape;
Herb Derby65956872018-08-21 16:55:04 -040018class SkGlyphRunListPainter;
Herb Derbyc1b482c2018-08-09 15:02:27 -040019class SkMatrix;
20struct SkIRect;
21
22class GrTextTarget {
23public:
24 virtual ~GrTextTarget() = default;
25
26 int width() const { return fWidth; }
27
28 int height() const { return fHeight; }
29
30 const GrColorSpaceInfo& colorSpaceInfo() const { return fColorSpaceInfo; }
31
32 virtual void addDrawOp(const GrClip&, std::unique_ptr<GrAtlasTextOp> op) = 0;
33
Robert Phillips46a13382018-08-23 13:53:01 -040034 virtual void drawShape(const GrClip&, const SkPaint&,
35 const SkMatrix& viewMatrix, const GrShape&) = 0;
Herb Derbyc1b482c2018-08-09 15:02:27 -040036
37 virtual void makeGrPaint(GrMaskFormat, const SkPaint&, const SkMatrix& viewMatrix,
38 GrPaint*) = 0;
39
40 virtual GrContext* getContext() = 0;
41
Herb Derby65956872018-08-21 16:55:04 -040042 virtual SkGlyphRunListPainter* glyphPainter() = 0;
Herb Derbyc1b482c2018-08-09 15:02:27 -040043
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