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