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

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

Issue 1521633002: Move distance field text positioning into GrTextUtils (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanuptext15
Patch Set: tweaks Created 4 years, 11 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/text/GrAtlasTextBlob.h ('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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 const char text[], size_t byteLength, 47 const char text[], size_t byteLength,
48 const SkScalar pos[], int scalarsPerPosition, 48 const SkScalar pos[], int scalarsPerPosition,
49 const SkPoint& offset, const SkIRect& regionClipBounds) o verride; 49 const SkPoint& offset, const SkIRect& regionClipBounds) o verride;
50 void drawTextBlob(GrDrawContext*, const GrClip&, const SkPaint&, 50 void drawTextBlob(GrDrawContext*, const GrClip&, const SkPaint&,
51 const SkMatrix& viewMatrix, const SkTextBlob*, SkScalar x, SkScalar y, 51 const SkMatrix& viewMatrix, const SkTextBlob*, SkScalar x, SkScalar y,
52 SkDrawFilter*, const SkIRect& clipBounds) override; 52 SkDrawFilter*, const SkIRect& clipBounds) override;
53 53
54 typedef GrAtlasTextBlob::Run Run; 54 typedef GrAtlasTextBlob::Run Run;
55 typedef Run::SubRunInfo PerSubRunInfo; 55 typedef Run::SubRunInfo PerSubRunInfo;
56 56
57 inline bool canDrawAsDistanceFields(const SkPaint&, const SkMatrix& viewMatr ix);
58 bool dfAppendGlyph(GrAtlasTextBlob*, int runIndex, const SkGlyph&, SkScalar sx, SkScalar sy,
59 GrColor color, GrFontScaler*, SkScalar textRatio,
60 const SkMatrix& viewMatrix);
61
62 // A helper for drawing BitmapText in a run of distance fields
63 inline void fallbackDrawPosText(GrAtlasTextBlob*, int runIndex,
64 GrColor color,
65 const SkPaint&, const SkMatrix& viewMatrix,
66 const SkTDArray<char>& fallbackTxt,
67 const SkTDArray<SkScalar>& fallbackPos,
68 int scalarsPerPosition,
69 const SkPoint& offset);
70
71 void internalDrawDFText(GrAtlasTextBlob*, int runIndex,
72 const SkPaint&,
73 GrColor color, const SkMatrix& viewMatrix,
74 const char text[], size_t byteLength,
75 SkScalar x, SkScalar y);
76 void internalDrawDFPosText(GrAtlasTextBlob*, int runIndex,
77 const SkPaint&,
78 GrColor color, const SkMatrix& viewMatrix,
79 const char text[], size_t byteLength,
80 const SkScalar pos[], int scalarsPerPosition,
81 const SkPoint& offset);
82
83 // sets up the descriptor on the blob and returns a detached cache. Client must attach 57 // sets up the descriptor on the blob and returns a detached cache. Client must attach
84 inline static GrColor ComputeCanonicalColor(const SkPaint&, bool lcd); 58 inline static GrColor ComputeCanonicalColor(const SkPaint&, bool lcd);
85 void regenerateTextBlob(GrAtlasTextBlob* bmp, const SkPaint& skPaint, GrColo r, 59 void regenerateTextBlob(GrAtlasTextBlob* bmp, const SkPaint& skPaint, GrColo r,
86 const SkMatrix& viewMatrix, 60 const SkMatrix& viewMatrix,
87 const SkTextBlob* blob, SkScalar x, SkScalar y, 61 const SkTextBlob* blob, SkScalar x, SkScalar y,
88 SkDrawFilter* drawFilter); 62 SkDrawFilter* drawFilter);
89 inline static bool HasLCD(const SkTextBlob*); 63 inline static bool HasLCD(const SkTextBlob*);
90 inline void initDistanceFieldPaint(GrAtlasTextBlob*, SkPaint*, SkScalar* tex tRatio,
91 const SkMatrix&);
92 64
93 // Test methods 65 // Test methods
94 // TODO this is really ugly. It'd be much nicer if positioning could be mov ed to batch 66 // TODO this is really ugly. It'd be much nicer if positioning could be mov ed to batch
95 inline GrAtlasTextBlob* createDrawTextBlob(const GrPaint&, 67 inline GrAtlasTextBlob* createDrawTextBlob(const GrPaint&,
96 const SkPaint&, const SkMatrix& v iewMatrix, 68 const SkPaint&, const SkMatrix& v iewMatrix,
97 const char text[], size_t byteLen gth, 69 const char text[], size_t byteLen gth,
98 SkScalar x, SkScalar y); 70 SkScalar x, SkScalar y);
99 inline GrAtlasTextBlob* createDrawPosTextBlob(const GrPaint&, 71 inline GrAtlasTextBlob* createDrawPosTextBlob(const GrPaint&,
100 const SkPaint&, const SkMatrix & viewMatrix, 72 const SkPaint&, const SkMatrix & viewMatrix,
101 const char text[], size_t byte Length, 73 const char text[], size_t byte Length,
102 const SkScalar pos[], int scal arsPerPosition, 74 const SkScalar pos[], int scal arsPerPosition,
103 const SkPoint& offset); 75 const SkPoint& offset);
104 const GrDistanceFieldAdjustTable* dfAdjustTable() const { return fDistanceAd justTable; } 76 const GrDistanceFieldAdjustTable* dfAdjustTable() const { return fDistanceAd justTable; }
105 77
106 GrBatchTextStrike* fCurrStrike; 78 GrBatchTextStrike* fCurrStrike;
107 GrTextBlobCache* fCache; 79 GrTextBlobCache* fCache;
108 SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable; 80 SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable;
109 81
110 #ifdef GR_TEST_UTILS 82 #ifdef GR_TEST_UTILS
111 DRAW_BATCH_TEST_FRIEND(TextBlobBatch); 83 DRAW_BATCH_TEST_FRIEND(TextBlobBatch);
112 #endif 84 #endif
113 85
114 typedef GrTextContext INHERITED; 86 typedef GrTextContext INHERITED;
115 }; 87 };
116 88
117 #endif 89 #endif
OLDNEW
« no previous file with comments | « src/gpu/text/GrAtlasTextBlob.h ('k') | src/gpu/text/GrAtlasTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698