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

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

Issue 1011403004: BitmapTextBatch and BitmapTextBlob (Closed) Base URL: https://skia.googlesource.com/skia.git@dfpr_take_2
Patch Set: fix for segfault Created 5 years, 8 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/GrStencilAndCoverTextContext.cpp ('k') | src/gpu/SkGpuDevice.h » ('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 2010 Google Inc. 2 * Copyright 2010 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 GrTextContext_DEFINED 8 #ifndef GrTextContext_DEFINED
9 #define GrTextContext_DEFINED 9 #define GrTextContext_DEFINED
10 10
11 #include "GrClip.h" 11 #include "GrClip.h"
12 #include "GrGlyph.h" 12 #include "GrGlyph.h"
13 #include "GrPaint.h" 13 #include "GrPaint.h"
14 #include "SkDeviceProperties.h" 14 #include "SkDeviceProperties.h"
15 15
16 #include "SkPostConfig.h" 16 #include "SkPostConfig.h"
17 17
18 class GrClip; 18 class GrClip;
19 class GrContext; 19 class GrContext;
20 class GrDrawTarget; 20 class GrDrawTarget;
21 class GrFontScaler; 21 class GrFontScaler;
22 class SkDrawFilter; 22 class SkDrawFilter;
23 class SkGpuDevice; 23 class SkGpuDevice;
24 class SkTextBlob; 24 class SkTextBlob;
25 25
26 // For testing textblobs on GPU.
27 //#define USE_BITMAP_TEXTBLOBS
28
26 /* 29 /*
27 * This class wraps the state for a single text render 30 * This class wraps the state for a single text render
28 */ 31 */
29 class GrTextContext { 32 class GrTextContext {
30 public: 33 public:
31 virtual ~GrTextContext(); 34 virtual ~GrTextContext();
32 35
33 void drawText(GrRenderTarget* rt, const GrClip&, const GrPaint&, const SkPa int&, 36 void drawText(GrRenderTarget* rt, const GrClip&, const GrPaint&, const SkPa int&,
34 const SkMatrix& viewMatrix, const char text[], size_t byteLeng th, SkScalar x, 37 const SkMatrix& viewMatrix, const char text[], size_t byteLeng th, SkScalar x,
35 SkScalar y, const SkIRect& clipBounds); 38 SkScalar y, const SkIRect& clipBounds);
36 void drawPosText(GrRenderTarget* rt, const GrClip&, const GrPaint&, const Sk Paint&, 39 void drawPosText(GrRenderTarget* rt, const GrClip&, const GrPaint&, const Sk Paint&,
37 const SkMatrix& viewMatrix, 40 const SkMatrix& viewMatrix,
38 const char text[], size_t byteLength, 41 const char text[], size_t byteLength,
39 const SkScalar pos[], int scalarsPerPosition, 42 const SkScalar pos[], int scalarsPerPosition,
40 const SkPoint& offset, const SkIRect& clipBounds); 43 const SkPoint& offset, const SkIRect& clipBounds);
41 void drawTextBlob(GrRenderTarget*, const GrClip&, const SkPaint&, 44 virtual void drawTextBlob(GrRenderTarget*, const GrClip&, const SkPaint&,
42 const SkMatrix& viewMatrix, const SkTextBlob*, SkScalar x, SkScalar y, 45 const SkMatrix& viewMatrix, const SkTextBlob*, SkS calar x, SkScalar y,
43 SkDrawFilter*, const SkIRect& clipBounds); 46 SkDrawFilter*, const SkIRect& clipBounds);
44 47
45 protected: 48 protected:
46 GrTextContext* fFallbackTextContext; 49 GrTextContext* fFallbackTextContext;
47 GrContext* fContext; 50 GrContext* fContext;
48 // TODO we probably don't really need to store a back pointer to the owning SkGpuDevice, except 51 // TODO we probably don't really need to store a back pointer to the owning SkGpuDevice, except
49 // we need to be able to call drawPath on it in the event no other text cont ext can draw the 52 // we need to be able to call drawPath on it in the event no other text cont ext can draw the
50 // text. We might be able to move this logic to context though. This is un reffed because 53 // text. We might be able to move this logic to context though. This is un reffed because
51 // GrTextContext is completely owned by SkGpuDevice 54 // GrTextContext is completely owned by SkGpuDevice
52 SkGpuDevice* fGpuDevice; 55 SkGpuDevice* fGpuDevice;
53 SkDeviceProperties fDeviceProperties; 56 SkDeviceProperties fDeviceProperties;
(...skipping 29 matching lines...) Expand all
83 const SkPoint& offset, const SkIRect& clipBounds); 86 const SkPoint& offset, const SkIRect& clipBounds);
84 87
85 void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&, 88 void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&,
86 const SkIRect& regionClipBounds); 89 const SkIRect& regionClipBounds);
87 void finish() { fDrawTarget = NULL; } 90 void finish() { fDrawTarget = NULL; }
88 91
89 static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache); 92 static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache);
90 // sets extent in stopVector and returns glyph count 93 // sets extent in stopVector and returns glyph count
91 static int MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc, 94 static int MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc,
92 const char text[], size_t byteLength, SkVector* stopV ector); 95 const char text[], size_t byteLength, SkVector* stopV ector);
96
97 friend class BitmapTextBatch;
93 }; 98 };
94 99
95 #endif 100 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrStencilAndCoverTextContext.cpp ('k') | src/gpu/SkGpuDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698