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

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: Added more dox 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
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 void drawText(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint &,
bsalomon 2015/06/11 01:47:57 Can we have a TODO (here or a bug) to remove the n
robertphillips 2015/06/16 16:52:37 Done.
45 // GrStencilAndCoverTextContext respectively 51 const SkMatrix& viewMatrix, const char text[], size_t byteLeng th,
46 // TODO: remove these two 52 SkScalar x, SkScalar y, const SkIRect& clipBounds);
47 void drawText(GrPipelineBuilder* pipelineBuilder, GrBatch* batch); 53 void drawPosText(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPai nt&,
54 const SkMatrix& viewMatrix, const char text[], size_t byteL ength,
55 const SkScalar pos[], int scalarsPerPosition,
56 const SkPoint& offset, const SkIRect& clipBounds);
57 void drawTextBlob(GrRenderTarget*, const GrClip&, const SkPaint&,
58 const SkMatrix& viewMatrix, const SkTextBlob*,
59 SkScalar x, SkScalar y,
60 SkDrawFilter*, const SkIRect& clipBounds);
48 61
62 // drawPaths is thanks to GrStencilAndCoverTextContext
63 // TODO: remove
49 void drawPaths(GrPipelineBuilder* pipelineBuilder, 64 void drawPaths(GrPipelineBuilder* pipelineBuilder,
50 const GrPathProcessor* pathProc, 65 const GrPathProcessor* pathProc,
51 const GrPathRange* pathRange, 66 const GrPathRange* pathRange,
52 const void* indices, 67 const void* indices,
53 int /*GrDrawTarget::PathIndexType*/ indexType, 68 int /*GrDrawTarget::PathIndexType*/ indexType,
54 const float transformValues[], 69 const float transformValues[],
55 int /*GrDrawTarget::PathTransformType*/ transformType, 70 int /*GrDrawTarget::PathTransformType*/ transformType,
56 int count, 71 int count,
57 int /*GrPathRendering::FillType*/ fill); 72 int /*GrPathRendering::FillType*/ fill);
58 73
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 */ 231 */
217 void drawOval(GrRenderTarget*, 232 void drawOval(GrRenderTarget*,
218 const GrClip&, 233 const GrClip&,
219 const GrPaint& paint, 234 const GrPaint& paint,
220 const SkMatrix& viewMatrix, 235 const SkMatrix& viewMatrix,
221 const SkRect& oval, 236 const SkRect& oval,
222 const GrStrokeInfo& strokeInfo); 237 const GrStrokeInfo& strokeInfo);
223 238
224 239
225 private: 240 private:
241 friend class GrAtlasTextContext; // for access to drawBatch
226 friend class GrContext; // for ctor 242 friend class GrContext; // for ctor
227 243
228 GrDrawContext(GrContext* context, GrDrawTarget* drawTarget); 244 GrDrawContext(GrContext*, GrDrawTarget*, const SkDeviceProperties&, bool use DFT);
229 ~GrDrawContext() override;
230 245
231 // Sets the paint. Returns true on success; false on failure. 246 // Sets the paint. Returns true on success; false on failure.
232 bool prepareToDraw(GrPipelineBuilder*, 247 bool prepareToDraw(GrPipelineBuilder*,
233 GrRenderTarget* rt, 248 GrRenderTarget* rt,
234 const GrClip&, 249 const GrClip&,
235 const GrPaint* paint); 250 const GrPaint* paint);
251 GrTextContext* createTextContext(GrRenderTarget*, const SkDeviceProperties&, bool useDFT);
236 252
237 // A simpler version of the above which just returns true on success; false on failure. 253 // A simpler version of the above which just returns true on success; false on failure.
238 // Clip is *NOT* set 254 // Clip is *NOT* set
239 bool prepareToDraw(GrRenderTarget* rt); 255 bool prepareToDraw(GrRenderTarget* rt);
240 256
241 void internalDrawPath(GrDrawTarget*, 257 void internalDrawPath(GrDrawTarget*,
242 GrPipelineBuilder*, 258 GrPipelineBuilder*,
243 const SkMatrix& viewMatrix, 259 const SkMatrix& viewMatrix,
244 GrColor, 260 GrColor,
245 bool useAA, 261 bool useAA,
246 const SkPath&, 262 const SkPath&,
247 const GrStrokeInfo&); 263 const GrStrokeInfo&);
248 264
249 GrContext* fContext; // owning context -> no ref 265 // This entry point allows the GrTextContext-derived classes to add their ba tches to
250 GrDrawTarget* fDrawTarget; 266 // the drawTarget.
267 void drawBatch(GrPipelineBuilder* pipelineBuilder, GrBatch* batch);
268
269 GrContext* fContext; // owning context -> no ref
270 GrDrawTarget* fDrawTarget;
271 GrTextContext* fTextContext; // lazily created
bsalomon 2015/06/11 01:47:57 would we share these in the future when there is a
robertphillips 2015/06/16 16:52:37 I think the TextContexts will have to morph a bit
272
273 SkDeviceProperties* fDevProps; // ptr b.c. SkDeviceProperties isn't publi c
274 bool fUseDFT;
251 }; 275 };
252 276
253 #endif 277 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698