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

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

Issue 1175553002: Make GrTextContext be owned by the GrDrawContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix nvpr config Created 5 years, 6 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/core/SkDeviceProperties.h ('k') | src/gpu/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
11 #include "GrTextContext.h" 11 #include "GrTextContext.h"
12 12
13 #include "GrBatchAtlas.h" 13 #include "GrBatchAtlas.h"
14 #include "GrBatchFontCache.h" 14 #include "GrBatchFontCache.h"
15 #include "GrGeometryProcessor.h" 15 #include "GrGeometryProcessor.h"
16 #include "SkDescriptor.h" 16 #include "SkDescriptor.h"
17 #include "GrMemoryPool.h" 17 #include "GrMemoryPool.h"
18 #include "SkMaskFilter.h" 18 #include "SkMaskFilter.h"
19 #include "SkTextBlob.h" 19 #include "SkTextBlob.h"
20 #include "SkTInternalLList.h" 20 #include "SkTInternalLList.h"
21 21
22 #ifdef GR_TEST_UTILS 22 #ifdef GR_TEST_UTILS
23 #include "GrBatchTest.h" 23 #include "GrBatchTest.h"
24 #endif 24 #endif
25 25
26 class BitmapTextBatch; 26 class BitmapTextBatch;
27 class GrDrawContext; 27 class GrDrawContext;
28 class GrDrawTarget;
28 class GrPipelineBuilder; 29 class GrPipelineBuilder;
29 class GrTextBlobCache; 30 class GrTextBlobCache;
30 31
31 /* 32 /*
32 * This class implements GrTextContext using standard bitmap fonts, and can also process textblobs. 33 * This class implements GrTextContext using standard bitmap fonts, and can also process textblobs.
33 * TODO replace GrBitmapTextContext 34 * TODO replace GrBitmapTextContext
34 */ 35 */
35 class GrAtlasTextContext : public GrTextContext { 36 class GrAtlasTextContext : public GrTextContext {
36 public: 37 public:
37 static GrAtlasTextContext* Create(GrContext*, const SkDeviceProperties&, 38 static GrAtlasTextContext* Create(GrContext*, GrDrawContext*,
38 bool enableDistanceFields); 39 const SkDeviceProperties&, bool enableDist anceFields);
39 40
40 private: 41 private:
41 GrAtlasTextContext(GrContext*, const SkDeviceProperties&, bool enableDistanc eFields); 42 GrAtlasTextContext(GrContext*, GrDrawContext*, const SkDeviceProperties&, bo ol useDFT);
42 ~GrAtlasTextContext() override {} 43 ~GrAtlasTextContext() override {}
43 44
44 bool canDraw(const GrRenderTarget*, const GrClip&, const GrPaint&, 45 bool canDraw(const GrRenderTarget*, const GrClip&, const GrPaint&,
45 const SkPaint&, const SkMatrix& viewMatrix) override; 46 const SkPaint&, const SkMatrix& viewMatrix) override;
46 47
47 void onDrawText(GrDrawContext*, GrRenderTarget*, const GrClip&, const GrPain t&, const SkPaint&, 48 void onDrawText(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPain t&,
48 const SkMatrix& viewMatrix, const char text[], size_t byteLe ngth, 49 const SkMatrix& viewMatrix, const char text[], size_t byteLe ngth,
49 SkScalar x, SkScalar y, const SkIRect& regionClipBounds) ove rride; 50 SkScalar x, SkScalar y, const SkIRect& regionClipBounds) ove rride;
50 void onDrawPosText(GrDrawContext*, GrRenderTarget*, const GrClip&, const GrP aint&, 51 void onDrawPosText(GrRenderTarget*, const GrClip&, const GrPaint&,
51 const SkPaint&, const SkMatrix& viewMatrix, 52 const SkPaint&, const SkMatrix& viewMatrix,
52 const char text[], size_t byteLength, 53 const char text[], size_t byteLength,
53 const SkScalar pos[], int scalarsPerPosition, 54 const SkScalar pos[], int scalarsPerPosition,
54 const SkPoint& offset, const SkIRect& regionClipBounds) o verride; 55 const SkPoint& offset, const SkIRect& regionClipBounds) o verride;
55 void drawTextBlob(GrRenderTarget*, const GrClip&, const SkPaint&, 56 void drawTextBlob(GrRenderTarget*, const GrClip&, const SkPaint&,
56 const SkMatrix& viewMatrix, const SkTextBlob*, SkScalar x, SkScalar y, 57 const SkMatrix& viewMatrix, const SkTextBlob*, SkScalar x, SkScalar y,
57 SkDrawFilter*, const SkIRect& clipBounds) override; 58 SkDrawFilter*, const SkIRect& clipBounds) override;
58 59
59 /* 60 /*
60 * A BitmapTextBlob contains a fully processed SkTextBlob, suitable for near ly immediate drawing 61 * A BitmapTextBlob contains a fully processed SkTextBlob, suitable for near ly immediate drawing
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 bool dfAppendGlyph(BitmapTextBlob*, int runIndex, GrGlyph::PackedID, SkScala r sx, SkScalar sy, 265 bool dfAppendGlyph(BitmapTextBlob*, int runIndex, GrGlyph::PackedID, SkScala r sx, SkScalar sy,
265 GrColor color, GrFontScaler*, const SkIRect& clipRect, Sk Scalar textRatio, 266 GrColor color, GrFontScaler*, const SkIRect& clipRect, Sk Scalar textRatio,
266 const SkMatrix& viewMatrix); 267 const SkMatrix& viewMatrix);
267 inline void appendGlyphPath(BitmapTextBlob* blob, GrGlyph* glyph, 268 inline void appendGlyphPath(BitmapTextBlob* blob, GrGlyph* glyph,
268 GrFontScaler* scaler, SkScalar x, SkScalar y); 269 GrFontScaler* scaler, SkScalar x, SkScalar y);
269 inline void appendGlyphCommon(BitmapTextBlob*, Run*, Run::SubRunInfo*, 270 inline void appendGlyphCommon(BitmapTextBlob*, Run*, Run::SubRunInfo*,
270 const SkRect& positions, GrColor color, 271 const SkRect& positions, GrColor color,
271 size_t vertexStride, bool useVertexColor, 272 size_t vertexStride, bool useVertexColor,
272 GrGlyph*); 273 GrGlyph*);
273 274
274 inline void flushRunAsPaths(GrDrawContext*, GrRenderTarget*, 275 inline void flushRunAsPaths(GrRenderTarget*,
275 const SkTextBlob::RunIterator&, const GrClip& cl ip, 276 const SkTextBlob::RunIterator&, const GrClip& cl ip,
276 const SkPaint&, SkDrawFilter*, 277 const SkPaint&, SkDrawFilter*,
277 const SkMatrix& viewMatrix, const SkIRect& clipB ounds, SkScalar x, 278 const SkMatrix& viewMatrix, const SkIRect& clipB ounds, SkScalar x,
278 SkScalar y); 279 SkScalar y);
279 inline BitmapTextBatch* createBatch(BitmapTextBlob*, const PerSubRunInfo&, 280 inline BitmapTextBatch* createBatch(BitmapTextBlob*, const PerSubRunInfo&,
280 int glyphCount, int run, int subRun, 281 int glyphCount, int run, int subRun,
281 GrColor, SkScalar transX, SkScalar trans Y, 282 GrColor, SkScalar transX, SkScalar trans Y,
282 const SkPaint&); 283 const SkPaint&);
283 inline void flushRun(GrDrawContext*, GrPipelineBuilder*, BitmapTextBlob*, in t run, GrColor, 284 inline void flushRun(GrPipelineBuilder*, BitmapTextBlob*, int run, GrColor,
284 SkScalar transX, SkScalar transY, const SkPaint&); 285 SkScalar transX, SkScalar transY, const SkPaint&);
285 inline void flushBigGlyphs(BitmapTextBlob* cacheBlob, GrDrawContext*, GrRend erTarget*, 286 inline void flushBigGlyphs(BitmapTextBlob* cacheBlob, GrRenderTarget*,
286 const GrClip& clip, const SkPaint& skPaint, 287 const GrClip& clip, const SkPaint& skPaint,
287 SkScalar transX, SkScalar transY, const SkIRect& clipBounds); 288 SkScalar transX, SkScalar transY, const SkIRect& clipBounds);
288 289
289 // We have to flush SkTextBlobs differently from drawText / drawPosText 290 // We have to flush SkTextBlobs differently from drawText / drawPosText
290 void flush(GrDrawContext*, const SkTextBlob*, BitmapTextBlob*, GrRenderTarge t*, 291 void flush(const SkTextBlob*, BitmapTextBlob*, GrRenderTarget*,
291 const SkPaint&, const GrPaint&, SkDrawFilter*, const GrClip&, 292 const SkPaint&, const GrPaint&, SkDrawFilter*, const GrClip&,
292 const SkMatrix& viewMatrix, const SkIRect& clipBounds, SkScalar x , SkScalar y, 293 const SkMatrix& viewMatrix, const SkIRect& clipBounds, SkScalar x , SkScalar y,
293 SkScalar transX, SkScalar transY); 294 SkScalar transX, SkScalar transY);
294 void flush(GrDrawContext*, BitmapTextBlob*, GrRenderTarget*, const SkPaint&, 295 void flush(BitmapTextBlob*, GrRenderTarget*, const SkPaint&,
295 const GrPaint&, const GrClip&, const SkIRect& clipBounds); 296 const GrPaint&, const GrClip&, const SkIRect& clipBounds);
296 297
297 // A helper for drawing BitmapText in a run of distance fields 298 // A helper for drawing BitmapText in a run of distance fields
298 inline void fallbackDrawPosText(BitmapTextBlob*, int runIndex, 299 inline void fallbackDrawPosText(BitmapTextBlob*, int runIndex,
299 GrRenderTarget*, const GrClip&, 300 GrRenderTarget*, const GrClip&,
300 const GrPaint&, 301 const GrPaint&,
301 const SkPaint&, const SkMatrix& viewMatrix, 302 const SkPaint&, const SkMatrix& viewMatrix,
302 const SkTDArray<char>& fallbackTxt, 303 const SkTDArray<char>& fallbackTxt,
303 const SkTDArray<SkScalar>& fallbackPos, 304 const SkTDArray<SkScalar>& fallbackPos,
304 int scalarsPerPosition, 305 int scalarsPerPosition,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 friend class BitmapTextBatch; 392 friend class BitmapTextBatch;
392 393
393 #ifdef GR_TEST_UTILS 394 #ifdef GR_TEST_UTILS
394 BATCH_TEST_FRIEND(TextBlobBatch); 395 BATCH_TEST_FRIEND(TextBlobBatch);
395 #endif 396 #endif
396 397
397 typedef GrTextContext INHERITED; 398 typedef GrTextContext INHERITED;
398 }; 399 };
399 400
400 #endif 401 #endif
OLDNEW
« no previous file with comments | « src/core/SkDeviceProperties.h ('k') | src/gpu/GrAtlasTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698