blob: a03b48bb4603ed6142922e24a108fe871723cc4a [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
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "include/core/SkPaint.h"
12#include "src/gpu/GrColorSpaceInfo.h"
Herb Derbyc1b482c2018-08-09 15:02:27 -040013
14class GrAtlasTextOp;
15class GrClip;
16class GrPaint;
Robert Phillips69893702019-02-22 11:16:30 -050017class GrRecordingContext;
Robert Phillips46a13382018-08-23 13:53:01 -040018class GrShape;
Herb Derby65956872018-08-21 16:55:04 -040019class SkGlyphRunListPainter;
Herb Derbyc1b482c2018-08-09 15:02:27 -040020class 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 GrColorSpaceInfo& colorSpaceInfo() const { return fColorSpaceInfo; }
32
33 virtual void addDrawOp(const GrClip&, std::unique_ptr<GrAtlasTextOp> op) = 0;
34
Robert Phillips46a13382018-08-23 13:53:01 -040035 virtual void drawShape(const GrClip&, const SkPaint&,
36 const SkMatrix& viewMatrix, const GrShape&) = 0;
Herb Derbyc1b482c2018-08-09 15:02:27 -040037
38 virtual void makeGrPaint(GrMaskFormat, const SkPaint&, const SkMatrix& viewMatrix,
39 GrPaint*) = 0;
40
Robert Phillips69893702019-02-22 11:16:30 -050041 virtual GrRecordingContext* getContext() = 0;
Herb Derbyc1b482c2018-08-09 15:02:27 -040042
Herb Derby65956872018-08-21 16:55:04 -040043 virtual SkGlyphRunListPainter* glyphPainter() = 0;
Herb Derbyc1b482c2018-08-09 15:02:27 -040044
45protected:
46 GrTextTarget(int width, int height, const GrColorSpaceInfo& colorSpaceInfo)
47 : fWidth(width), fHeight(height), fColorSpaceInfo(colorSpaceInfo) {}
48
49private:
50 int fWidth;
51 int fHeight;
52 const GrColorSpaceInfo& fColorSpaceInfo;
53};
54#endif // GrTextTarget_DEFINED