1 /*
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 
14 class GrAtlasTextOp;
15 class GrClip;
16 class GrPaint;
17 class GrRecordingContext;
18 class GrShape;
19 class SkGlyphRunListPainter;
20 class SkMatrix;
21 struct SkIRect;
22 
23 class GrTextTarget {
24 public:
25     virtual ~GrTextTarget() = default;
26 
width()27     int width() const { return fWidth; }
28 
height()29     int height() const { return fHeight; }
30 
colorSpaceInfo()31     const GrColorSpaceInfo& colorSpaceInfo() const { return fColorSpaceInfo; }
32 
33     virtual void addDrawOp(const GrClip&, std::unique_ptr<GrAtlasTextOp> op) = 0;
34 
35     virtual void drawShape(const GrClip&, const SkPaint&,
36                            const SkMatrix& viewMatrix, const GrShape&) = 0;
37 
38     virtual void makeGrPaint(GrMaskFormat, const SkPaint&, const SkMatrix& viewMatrix,
39                              GrPaint*) = 0;
40 
41     virtual GrRecordingContext* getContext() = 0;
42 
43     virtual SkGlyphRunListPainter* glyphPainter() = 0;
44 
45 protected:
GrTextTarget(int width,int height,const GrColorSpaceInfo & colorSpaceInfo)46     GrTextTarget(int width, int height, const GrColorSpaceInfo& colorSpaceInfo)
47             : fWidth(width), fHeight(height), fColorSpaceInfo(colorSpaceInfo) {}
48 
49 private:
50     int fWidth;
51     int fHeight;
52     const GrColorSpaceInfo& fColorSpaceInfo;
53 };
54 #endif  // GrTextTarget_DEFINED
55