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

Side by Side Diff: include/gpu/GrDrawContext.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 | « include/gpu/GrContext.h ('k') | src/core/SkDevice.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 GrDrawContext_DEFINED 8 #ifndef GrDrawContext_DEFINED
9 #define GrDrawContext_DEFINED 9 #define GrDrawContext_DEFINED
10 10
11 #include "GrColor.h" 11 #include "GrColor.h"
12 #include "SkRefCnt.h" 12 #include "SkRefCnt.h"
13 13
14 class GrBatch; 14 class GrBatch;
15 class GrClip; 15 class GrClip;
16 class GrContext; 16 class GrContext;
17 class GrDrawTarget; 17 class GrDrawTarget;
18 class GrPaint; 18 class GrPaint;
19 class GrPathProcessor; 19 class GrPathProcessor;
20 class GrPathRange; 20 class GrPathRange;
21 class GrPipelineBuilder; 21 class GrPipelineBuilder;
22 class GrRenderTarget; 22 class GrRenderTarget;
23 class GrStrokeInfo; 23 class GrStrokeInfo;
24 class GrSurface; 24 class GrSurface;
25 class GrTextContext;
26 struct SkDeviceProperties;
27 class SkDrawFilter;
25 struct SkIPoint; 28 struct SkIPoint;
26 struct SkIRect; 29 struct SkIRect;
27 class SkMatrix; 30 class SkMatrix;
31 class SkPaint;
28 class SkPath; 32 class SkPath;
29 struct SkPoint; 33 struct SkPoint;
30 struct SkRect; 34 struct SkRect;
31 class SkRRect; 35 class SkRRect;
32 36 class SkTextBlob;
33 37
34 /* 38 /*
35 * A helper object to orchestrate draws 39 * A helper object to orchestrate draws
36 */ 40 */
37 class SK_API GrDrawContext : public SkRefCnt { 41 class SK_API GrDrawContext : public SkRefCnt {
38 public: 42 public:
39 SK_DECLARE_INST_COUNT(GrDrawContext) 43 SK_DECLARE_INST_COUNT(GrDrawContext)
40 44
45 ~GrDrawContext() override;
46
41 void copySurface(GrRenderTarget* dst, GrSurface* src, 47 void copySurface(GrRenderTarget* dst, GrSurface* src,
42 const SkIRect& srcRect, const SkIPoint& dstPoint); 48 const SkIRect& srcRect, const SkIPoint& dstPoint);
43 49
44 // drawText and drawPaths are thanks to the GrAtlasTextContext and the 50 // TODO: it is odd that we need both the SkPaint in the following 3 methods.
45 // GrStencilAndCoverTextContext respectively 51 // We should extract the text parameters from SkPaint and pass them separate ly
46 // TODO: remove these two 52 // akin to GrStrokeInfo (GrTextInfo?)
47 void drawText(GrPipelineBuilder* pipelineBuilder, GrBatch* batch); 53 void drawText(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint &,
54 const SkMatrix& viewMatrix, const char text[], size_t byteLeng th,
55 SkScalar x, SkScalar y, const SkIRect& clipBounds);
56 void drawPosText(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPai nt&,
57 const SkMatrix& viewMatrix, const char text[], size_t byteL ength,
58 const SkScalar pos[], int scalarsPerPosition,
59 const SkPoint& offset, const SkIRect& clipBounds);
60 void drawTextBlob(GrRenderTarget*, const GrClip&, const SkPaint&,
61 const SkMatrix& viewMatrix, const SkTextBlob*,
62 SkScalar x, SkScalar y,
63 SkDrawFilter*, const SkIRect& clipBounds);
48 64
65 // drawPaths is thanks to GrStencilAndCoverTextContext
66 // TODO: remove
49 void drawPaths(GrPipelineBuilder* pipelineBuilder, 67 void drawPaths(GrPipelineBuilder* pipelineBuilder,
50 const GrPathProcessor* pathProc, 68 const GrPathProcessor* pathProc,
51 const GrPathRange* pathRange, 69 const GrPathRange* pathRange,
52 const void* indices, 70 const void* indices,
53 int /*GrDrawTarget::PathIndexType*/ indexType, 71 int /*GrDrawTarget::PathIndexType*/ indexType,
54 const float transformValues[], 72 const float transformValues[],
55 int /*GrDrawTarget::PathTransformType*/ transformType, 73 int /*GrDrawTarget::PathTransformType*/ transformType,
56 int count, 74 int count,
57 int /*GrPathRendering::FillType*/ fill); 75 int /*GrPathRendering::FillType*/ fill);
58 76
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 */ 234 */
217 void drawOval(GrRenderTarget*, 235 void drawOval(GrRenderTarget*,
218 const GrClip&, 236 const GrClip&,
219 const GrPaint& paint, 237 const GrPaint& paint,
220 const SkMatrix& viewMatrix, 238 const SkMatrix& viewMatrix,
221 const SkRect& oval, 239 const SkRect& oval,
222 const GrStrokeInfo& strokeInfo); 240 const GrStrokeInfo& strokeInfo);
223 241
224 242
225 private: 243 private:
244 friend class GrAtlasTextContext; // for access to drawBatch
226 friend class GrContext; // for ctor 245 friend class GrContext; // for ctor
227 246
228 GrDrawContext(GrContext* context, GrDrawTarget* drawTarget); 247 GrDrawContext(GrContext*, GrDrawTarget*, const SkDeviceProperties&, bool use DFT);
229 ~GrDrawContext() override;
230 248
231 // Sets the paint. Returns true on success; false on failure. 249 // Sets the paint. Returns true on success; false on failure.
232 bool prepareToDraw(GrPipelineBuilder*, 250 bool prepareToDraw(GrPipelineBuilder*,
233 GrRenderTarget* rt, 251 GrRenderTarget* rt,
234 const GrClip&, 252 const GrClip&,
235 const GrPaint* paint); 253 const GrPaint* paint);
254 GrTextContext* createTextContext(GrRenderTarget*, const SkDeviceProperties&, bool useDFT);
236 255
237 // A simpler version of the above which just returns true on success; false on failure. 256 // A simpler version of the above which just returns true on success; false on failure.
238 // Clip is *NOT* set 257 // Clip is *NOT* set
239 bool prepareToDraw(GrRenderTarget* rt); 258 bool prepareToDraw(GrRenderTarget* rt);
240 259
241 void internalDrawPath(GrDrawTarget*, 260 void internalDrawPath(GrDrawTarget*,
242 GrPipelineBuilder*, 261 GrPipelineBuilder*,
243 const SkMatrix& viewMatrix, 262 const SkMatrix& viewMatrix,
244 GrColor, 263 GrColor,
245 bool useAA, 264 bool useAA,
246 const SkPath&, 265 const SkPath&,
247 const GrStrokeInfo&); 266 const GrStrokeInfo&);
248 267
249 GrContext* fContext; // owning context -> no ref 268 // This entry point allows the GrTextContext-derived classes to add their ba tches to
250 GrDrawTarget* fDrawTarget; 269 // the drawTarget.
270 void drawBatch(GrPipelineBuilder* pipelineBuilder, GrBatch* batch);
271
272 GrContext* fContext; // owning context -> no ref
273 GrDrawTarget* fDrawTarget;
274 GrTextContext* fTextContext; // lazily created
275
276 SkDeviceProperties* fDevProps; // ptr b.c. SkDeviceProperties isn't publi c
277 bool fUseDFT;
251 }; 278 };
252 279
253 #endif 280 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698