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

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

Issue 947443003: Move clip off of draw target (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: feedback inc Created 5 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/GrTest.cpp ('k') | src/gpu/GrTextContext.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 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 "GrGlyph.h" 12 #include "GrGlyph.h"
12 #include "GrPaint.h" 13 #include "GrPaint.h"
13 #include "SkDeviceProperties.h" 14 #include "SkDeviceProperties.h"
14 15
15 #include "SkPostConfig.h" 16 #include "SkPostConfig.h"
16 17
17 class GrContext; 18 class GrContext;
18 class GrDrawTarget; 19 class GrDrawTarget;
19 class GrFontScaler; 20 class GrFontScaler;
20 21
21 /* 22 /*
22 * This class wraps the state for a single text render 23 * This class wraps the state for a single text render
23 */ 24 */
24 class GrTextContext { 25 class GrTextContext {
25 public: 26 public:
26 virtual ~GrTextContext(); 27 virtual ~GrTextContext();
27 28
28 bool drawText(GrRenderTarget* rt, const GrPaint&, const SkPaint&, const SkMa trix& viewMatrix, 29 bool drawText(GrRenderTarget* rt, const GrPaint&, const SkPaint&, const SkMa trix& viewMatrix,
29 const char text[], size_t byteLength, SkScalar x, SkScalar y); 30 const char text[], size_t byteLength, SkScalar x, SkScalar y);
30 bool drawPosText(GrRenderTarget* rt, const GrPaint&, const SkPaint&, const S kMatrix& viewMatrix, 31 bool drawPosText(GrRenderTarget* rt, const GrPaint&, const SkPaint&, const S kMatrix& viewMatrix,
31 const char text[], size_t byteLength, 32 const char text[], size_t byteLength,
32 const SkScalar pos[], int scalarsPerPosition, 33 const SkScalar pos[], int scalarsPerPosition,
33 const SkPoint& offset); 34 const SkPoint& offset);
34 35
35 protected: 36 protected:
36 GrTextContext* fFallbackTextContext; 37 GrTextContext* fFallbackTextContext;
37 GrContext* fContext; 38 GrContext* fContext;
38 SkDeviceProperties fDeviceProperties; 39 SkDeviceProperties fDeviceProperties;
39 40
40 SkAutoTUnref<GrRenderTarget> fRenderTarget; 41 SkAutoTUnref<GrRenderTarget> fRenderTarget;
41 GrDrawTarget* fDrawTarget; 42 const GrClip* fClip;
42 SkIRect fClipRect; 43 GrDrawTarget* fDrawTarget;
43 GrPaint fPaint; 44 SkIRect fClipRect;
44 SkPaint fSkPaint; 45 GrPaint fPaint;
46 SkPaint fSkPaint;
45 47
46 GrTextContext(GrContext*, const SkDeviceProperties&); 48 GrTextContext(GrContext*, const SkDeviceProperties&);
47 49
48 virtual bool canDraw(const SkPaint& paint, const SkMatrix& viewMatrix) = 0; 50 virtual bool canDraw(const SkPaint& paint, const SkMatrix& viewMatrix) = 0;
49 51
50 virtual void onDrawText(GrRenderTarget*, const GrPaint&, const SkPaint&, 52 virtual void onDrawText(GrRenderTarget*, const GrPaint&, const SkPaint&,
51 const SkMatrix& viewMatrix, const char text[], size_ t byteLength, 53 const SkMatrix& viewMatrix, const char text[], size_ t byteLength,
52 SkScalar x, SkScalar y) = 0; 54 SkScalar x, SkScalar y) = 0;
53 virtual void onDrawPosText(GrRenderTarget*, const GrPaint&, const SkPaint&, 55 virtual void onDrawPosText(GrRenderTarget*, const GrPaint&, const SkPaint&,
54 const SkMatrix& viewMatrix, 56 const SkMatrix& viewMatrix,
55 const char text[], size_t byteLength, 57 const char text[], size_t byteLength,
56 const SkScalar pos[], int scalarsPerPosition, 58 const SkScalar pos[], int scalarsPerPosition,
57 const SkPoint& offset) = 0; 59 const SkPoint& offset) = 0;
58 60
59 void init(GrRenderTarget*, const GrPaint&, const SkPaint&); 61 void init(GrRenderTarget*, const GrPaint&, const SkPaint&);
60 void finish() { fDrawTarget = NULL; } 62 void finish() { fDrawTarget = NULL; }
61 63
62 static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache); 64 static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache);
63 // sets extent in stopVector and returns glyph count 65 // sets extent in stopVector and returns glyph count
64 static int MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc, 66 static int MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc,
65 const char text[], size_t byteLength, SkVector* stopV ector); 67 const char text[], size_t byteLength, SkVector* stopV ector);
66 }; 68 };
67 69
68 #endif 70 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrTest.cpp ('k') | src/gpu/GrTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698