Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: src/gpu/text/GrAtlasTextContext.h

Issue 1685653004: Move surface props off of GrTextContext (Closed) Base URL: https://skia.googlesource.com/skia.git@tc-cleanup-3
Patch Set: rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrDrawingManager.cpp ('k') | src/gpu/text/GrAtlasTextContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrAtlasTextContext_DEFINED 8 #ifndef GrAtlasTextContext_DEFINED
9 #define GrAtlasTextContext_DEFINED 9 #define GrAtlasTextContext_DEFINED
10 10
(...skipping 13 matching lines...) Expand all
24 class GrDrawTarget; 24 class GrDrawTarget;
25 class GrPipelineBuilder; 25 class GrPipelineBuilder;
26 class GrTextBlobCache; 26 class GrTextBlobCache;
27 class SkGlyph; 27 class SkGlyph;
28 28
29 /* 29 /*
30 * This class implements GrTextContext using standard bitmap fonts, and can also process textblobs. 30 * This class implements GrTextContext using standard bitmap fonts, and can also process textblobs.
31 */ 31 */
32 class GrAtlasTextContext : public GrTextContext { 32 class GrAtlasTextContext : public GrTextContext {
33 public: 33 public:
34 static GrAtlasTextContext* Create(GrContext*, const SkSurfaceProps&); 34 static GrAtlasTextContext* Create(GrContext*);
35 35
36 bool canDraw(const SkPaint&, const SkMatrix& viewMatrix); 36 bool canDraw(const SkPaint&, const SkMatrix& viewMatrix, const SkSurfaceProp s&);
37 void drawText(GrDrawContext*, const GrClip&, const GrPaint&, const SkPaint&, 37 void drawText(GrDrawContext*, const GrClip&, const GrPaint&, const SkPaint&,
38 const SkMatrix& viewMatrix, const char text[], size_t byteLeng th, 38 const SkMatrix& viewMatrix, const SkSurfaceProps&, const char text[],
39 SkScalar x, SkScalar y, const SkIRect& regionClipBounds) overr ide; 39 size_t byteLength, SkScalar x, SkScalar y,
40 const SkIRect& regionClipBounds) override;
40 void drawPosText(GrDrawContext*, const GrClip&, const GrPaint&, 41 void drawPosText(GrDrawContext*, const GrClip&, const GrPaint&,
41 const SkPaint&, const SkMatrix& viewMatrix, 42 const SkPaint&, const SkMatrix& viewMatrix, const SkSurface Props&,
42 const char text[], size_t byteLength, 43 const char text[], size_t byteLength,
43 const SkScalar pos[], int scalarsPerPosition, 44 const SkScalar pos[], int scalarsPerPosition,
44 const SkPoint& offset, const SkIRect& regionClipBounds) ove rride; 45 const SkPoint& offset, const SkIRect& regionClipBounds) ove rride;
45 void drawTextBlob(GrDrawContext*, const GrClip&, const SkPaint&, 46 void drawTextBlob(GrDrawContext*, const GrClip&, const SkPaint&,
46 const SkMatrix& viewMatrix, const SkTextBlob*, SkScalar x, SkScalar y, 47 const SkMatrix& viewMatrix, const SkSurfaceProps&, const S kTextBlob*,
48 SkScalar x, SkScalar y,
47 SkDrawFilter*, const SkIRect& clipBounds) override; 49 SkDrawFilter*, const SkIRect& clipBounds) override;
48 50
49 private: 51 private:
50 GrAtlasTextContext(GrContext*, const SkSurfaceProps&); 52 GrAtlasTextContext(GrContext*);
51 53
52 // sets up the descriptor on the blob and returns a detached cache. Client must attach 54 // sets up the descriptor on the blob and returns a detached cache. Client must attach
53 inline static GrColor ComputeCanonicalColor(const SkPaint&, bool lcd); 55 inline static GrColor ComputeCanonicalColor(const SkPaint&, bool lcd);
54 void regenerateTextBlob(GrAtlasTextBlob* bmp, const SkPaint& skPaint, GrColo r, 56 void regenerateTextBlob(GrAtlasTextBlob* bmp, const SkPaint& skPaint, GrColo r,
55 const SkMatrix& viewMatrix, 57 const SkMatrix& viewMatrix,
58 const SkSurfaceProps&,
56 const SkTextBlob* blob, SkScalar x, SkScalar y, 59 const SkTextBlob* blob, SkScalar x, SkScalar y,
57 SkDrawFilter* drawFilter); 60 SkDrawFilter* drawFilter);
58 inline static bool HasLCD(const SkTextBlob*); 61 inline static bool HasLCD(const SkTextBlob*);
59 62
60 // Test methods 63 // Test methods
61 inline GrAtlasTextBlob* createDrawTextBlob(const GrPaint&, 64 inline GrAtlasTextBlob* createDrawTextBlob(const GrPaint&,
62 const SkPaint&, const SkMatrix& v iewMatrix, 65 const SkPaint&, const SkMatrix& v iewMatrix,
66 const SkSurfaceProps&,
63 const char text[], size_t byteLen gth, 67 const char text[], size_t byteLen gth,
64 SkScalar x, SkScalar y); 68 SkScalar x, SkScalar y);
65 inline GrAtlasTextBlob* createDrawPosTextBlob(const GrPaint&, 69 inline GrAtlasTextBlob* createDrawPosTextBlob(const GrPaint&,
66 const SkPaint&, const SkMatrix & viewMatrix, 70 const SkPaint&, const SkMatrix & viewMatrix,
71 const SkSurfaceProps&,
67 const char text[], size_t byte Length, 72 const char text[], size_t byte Length,
68 const SkScalar pos[], int scal arsPerPosition, 73 const SkScalar pos[], int scal arsPerPosition,
69 const SkPoint& offset); 74 const SkPoint& offset);
70 const GrDistanceFieldAdjustTable* dfAdjustTable() const { return fDistanceAd justTable; } 75 const GrDistanceFieldAdjustTable* dfAdjustTable() const { return fDistanceAd justTable; }
71 76
72 GrTextBlobCache* fCache; 77 GrTextBlobCache* fCache;
73 SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable; 78 SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable;
74 79
75 #ifdef GR_TEST_UTILS 80 #ifdef GR_TEST_UTILS
76 DRAW_BATCH_TEST_FRIEND(TextBlobBatch); 81 DRAW_BATCH_TEST_FRIEND(TextBlobBatch);
77 #endif 82 #endif
78 83
79 typedef GrTextContext INHERITED; 84 typedef GrTextContext INHERITED;
80 }; 85 };
81 86
82 #endif 87 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDrawingManager.cpp ('k') | src/gpu/text/GrAtlasTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698