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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "include/core/SkPaint.h" |
| 12 | #include "src/gpu/GrColorSpaceInfo.h" |
Herb Derby | c1b482c | 2018-08-09 15:02:27 -0400 | [diff] [blame] | 13 | |
| 14 | class GrAtlasTextOp; |
| 15 | class GrClip; |
| 16 | class GrPaint; |
Robert Phillips | 6989370 | 2019-02-22 11:16:30 -0500 | [diff] [blame] | 17 | class GrRecordingContext; |
Robert Phillips | 46a1338 | 2018-08-23 13:53:01 -0400 | [diff] [blame] | 18 | class GrShape; |
Herb Derby | 6595687 | 2018-08-21 16:55:04 -0400 | [diff] [blame] | 19 | class SkGlyphRunListPainter; |
Herb Derby | c1b482c | 2018-08-09 15:02:27 -0400 | [diff] [blame] | 20 | class SkMatrix; |
| 21 | struct SkIRect; |
| 22 | |
| 23 | class GrTextTarget { |
| 24 | public: |
| 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 Phillips | 46a1338 | 2018-08-23 13:53:01 -0400 | [diff] [blame] | 35 | virtual void drawShape(const GrClip&, const SkPaint&, |
| 36 | const SkMatrix& viewMatrix, const GrShape&) = 0; |
Herb Derby | c1b482c | 2018-08-09 15:02:27 -0400 | [diff] [blame] | 37 | |
| 38 | virtual void makeGrPaint(GrMaskFormat, const SkPaint&, const SkMatrix& viewMatrix, |
| 39 | GrPaint*) = 0; |
| 40 | |
Robert Phillips | 6989370 | 2019-02-22 11:16:30 -0500 | [diff] [blame] | 41 | virtual GrRecordingContext* getContext() = 0; |
Herb Derby | c1b482c | 2018-08-09 15:02:27 -0400 | [diff] [blame] | 42 | |
Herb Derby | 6595687 | 2018-08-21 16:55:04 -0400 | [diff] [blame] | 43 | virtual SkGlyphRunListPainter* glyphPainter() = 0; |
Herb Derby | c1b482c | 2018-08-09 15:02:27 -0400 | [diff] [blame] | 44 | |
| 45 | protected: |
| 46 | GrTextTarget(int width, int height, const GrColorSpaceInfo& colorSpaceInfo) |
Brian Salomon | e7499c7 | 2019-06-24 12:12:36 -0400 | [diff] [blame] | 47 | : fWidth(width), fHeight(height), fColorSpaceInfo(colorSpaceInfo) { |
| 48 | SkASSERT(kPremul_SkAlphaType == colorSpaceInfo.alphaType()); |
| 49 | } |
Herb Derby | c1b482c | 2018-08-09 15:02:27 -0400 | [diff] [blame] | 50 | |
| 51 | private: |
| 52 | int fWidth; |
| 53 | int fHeight; |
| 54 | const GrColorSpaceInfo& fColorSpaceInfo; |
| 55 | }; |
| 56 | #endif // GrTextTarget_DEFINED |