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

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

Issue 1104343003: remove old text contexts and fontcache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweak Created 5 years, 7 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/GrContext.cpp ('k') | src/gpu/GrDistanceFieldTextContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 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 GrDistanceFieldTextContext_DEFINED
9 #define GrDistanceFieldTextContext_DEFINED
10
11 #include "GrTextContext.h"
12
13 class GrGeometryProcessor;
14 class GrTextStrike;
15
16 /*
17 * This class implements GrTextContext using distance field fonts
18 */
19 class GrDistanceFieldTextContext : public GrTextContext {
20 public:
21 static GrDistanceFieldTextContext* Create(GrContext*, SkGpuDevice*, const Sk DeviceProperties&,
22 bool enable);
23
24 virtual ~GrDistanceFieldTextContext();
25
26 private:
27 enum {
28 kMinRequestedGlyphs = 1,
29 kDefaultRequestedGlyphs = 64,
30 kMinRequestedVerts = kMinRequestedGlyphs * 4,
31 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4,
32 };
33
34 GrTextStrike* fStrike;
35 SkScalar fTextRatio;
36 bool fUseLCDText;
37 bool fEnableDFRendering;
38 SkAutoTUnref<GrGeometryProcessor> fCachedGeometryProcessor;
39 SkScalar* fDistanceAdjustTable;
40 // Used to check whether fCachedEffect is still valid.
41 uint32_t fEffectTextureUniqueID;
42 SkColor fEffectColor;
43 uint32_t fEffectFlags;
44 void* fVertices;
45 int fCurrVertex;
46 int fAllocVertexCount;
47 int fTotalVertexCount;
48 GrTexture* fCurrTexture;
49 SkRect fVertexBounds;
50 SkMatrix fViewMatrix;
51
52 GrDistanceFieldTextContext(GrContext*, SkGpuDevice*, const SkDevicePropertie s&, bool enable);
53 void buildDistanceAdjustTable();
54
55 bool canDraw(const GrRenderTarget*, const GrClip&, const GrPaint&,
56 const SkPaint&, const SkMatrix& viewMatrix) override;
57
58 void onDrawText(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPain t&,
59 const SkMatrix& viewMatrix,
60 const char text[], size_t byteLength,
61 SkScalar x, SkScalar y, const SkIRect& regionClipBounds) ove rride;
62 void onDrawPosText(GrRenderTarget*, const GrClip&, const GrPaint&, const SkP aint&,
63 const SkMatrix& viewMatrix,
64 const char text[], size_t byteLength,
65 const SkScalar pos[], int scalarsPerPosition,
66 const SkPoint& offset, const SkIRect& regionClipBounds) o verride;
67
68 void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&,
69 const SkIRect& regionClipBounds);
70 bool appendGlyph(GrGlyph::PackedID, SkScalar left, SkScalar top, GrFontScale r*);
71 bool uploadGlyph(GrGlyph*, GrFontScaler*);
72 void setupCoverageEffect(const SkColor& filteredColor);
73 void flush(); // automatically called by destructor
74 void finish();
75 };
76
77 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrDistanceFieldTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698