Herb Derby | c1b482c | 2018-08-09 15:02:27 -0400 | [diff] [blame] | 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; |
Robert Phillips | 46a1338 | 2018-08-23 13:53:01 -0400 | [diff] [blame^] | 17 | class GrShape; |
Herb Derby | 6595687 | 2018-08-21 16:55:04 -0400 | [diff] [blame] | 18 | class SkGlyphRunListPainter; |
Herb Derby | c1b482c | 2018-08-09 15:02:27 -0400 | [diff] [blame] | 19 | class SkMatrix; |
| 20 | struct SkIRect; |
| 21 | |
| 22 | class GrTextTarget { |
| 23 | public: |
| 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 Phillips | 46a1338 | 2018-08-23 13:53:01 -0400 | [diff] [blame^] | 34 | virtual void drawShape(const GrClip&, const SkPaint&, |
| 35 | const SkMatrix& viewMatrix, const GrShape&) = 0; |
Herb Derby | c1b482c | 2018-08-09 15:02:27 -0400 | [diff] [blame] | 36 | |
| 37 | virtual void makeGrPaint(GrMaskFormat, const SkPaint&, const SkMatrix& viewMatrix, |
| 38 | GrPaint*) = 0; |
| 39 | |
| 40 | virtual GrContext* getContext() = 0; |
| 41 | |
Herb Derby | 6595687 | 2018-08-21 16:55:04 -0400 | [diff] [blame] | 42 | virtual SkGlyphRunListPainter* glyphPainter() = 0; |
Herb Derby | c1b482c | 2018-08-09 15:02:27 -0400 | [diff] [blame] | 43 | |
| 44 | protected: |
| 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 |