OLD | NEW |
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 |
(...skipping 26 matching lines...) Expand all Loading... |
37 struct SkIPoint; | 37 struct SkIPoint; |
38 struct SkIRect; | 38 struct SkIRect; |
39 class SkMatrix; | 39 class SkMatrix; |
40 class SkPaint; | 40 class SkPaint; |
41 class SkPath; | 41 class SkPath; |
42 struct SkPoint; | 42 struct SkPoint; |
43 struct SkRect; | 43 struct SkRect; |
44 class SkRRect; | 44 class SkRRect; |
45 struct SkRSXform; | 45 struct SkRSXform; |
46 class SkTextBlob; | 46 class SkTextBlob; |
| 47 struct GrUserStencilSettings; |
47 | 48 |
48 /* | 49 /* |
49 * A helper object to orchestrate draws | 50 * A helper object to orchestrate draws |
50 */ | 51 */ |
51 class SK_API GrDrawContext : public SkRefCnt { | 52 class SK_API GrDrawContext : public SkRefCnt { |
52 public: | 53 public: |
53 ~GrDrawContext() override; | 54 ~GrDrawContext() override; |
54 | 55 |
55 bool copySurface(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dst
Point); | 56 bool copySurface(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dst
Point); |
56 | 57 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 const SkIRect& center, | 254 const SkIRect& center, |
254 const SkRect& dst); | 255 const SkRect& dst); |
255 | 256 |
256 bool isStencilBufferMultisampled() const { | 257 bool isStencilBufferMultisampled() const { |
257 return fRenderTarget->isStencilBufferMultisampled(); | 258 return fRenderTarget->isStencilBufferMultisampled(); |
258 } | 259 } |
259 bool isUnifiedMultisampled() const { return fRenderTarget->isUnifiedMultisam
pled(); } | 260 bool isUnifiedMultisampled() const { return fRenderTarget->isUnifiedMultisam
pled(); } |
260 bool hasMixedSamples() const { return fRenderTarget->hasMixedSamples(); } | 261 bool hasMixedSamples() const { return fRenderTarget->hasMixedSamples(); } |
261 | 262 |
262 bool mustUseHWAA(const GrPaint& paint) const { | 263 bool mustUseHWAA(const GrPaint& paint) const { |
263 return paint.isAntiAlias() && fRenderTarget->isUnifiedMultisampled(); | 264 return paint.isAntiAlias() && |
| 265 (fRenderTarget->isUnifiedMultisampled() || fRenderTarget->hasMixe
dSamples()); |
264 } | 266 } |
265 | 267 |
266 const GrSurfaceDesc& desc() const { return fRenderTarget->desc(); } | 268 const GrSurfaceDesc& desc() const { return fRenderTarget->desc(); } |
267 int width() const { return fRenderTarget->width(); } | 269 int width() const { return fRenderTarget->width(); } |
268 int height() const { return fRenderTarget->height(); } | 270 int height() const { return fRenderTarget->height(); } |
269 GrPixelConfig config() const { return fRenderTarget->config(); } | 271 GrPixelConfig config() const { return fRenderTarget->config(); } |
270 int numColorSamples() const { return fRenderTarget->numColorSamples(); } | 272 int numColorSamples() const { return fRenderTarget->numColorSamples(); } |
271 bool isGammaCorrect() const { return fSurfaceProps.isGammaCorrect(); } | 273 bool isGammaCorrect() const { return fSurfaceProps.isGammaCorrect(); } |
272 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } | 274 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } |
273 | 275 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 const GrUserStencilSettings* ss); | 340 const GrUserStencilSettings* ss); |
339 | 341 |
340 void internalDrawPath(const GrClip& clip, | 342 void internalDrawPath(const GrClip& clip, |
341 const GrPaint& paint, | 343 const GrPaint& paint, |
342 const SkMatrix& viewMatrix, | 344 const SkMatrix& viewMatrix, |
343 const SkPath& path, | 345 const SkPath& path, |
344 const GrStyle& style); | 346 const GrStyle& style); |
345 | 347 |
346 // This entry point allows the GrTextContext-derived classes to add their ba
tches to | 348 // This entry point allows the GrTextContext-derived classes to add their ba
tches to |
347 // the drawTarget. | 349 // the drawTarget. |
348 void drawBatch(const GrPipelineBuilder& pipelineBuilder, const GrClip&, GrDr
awBatch* batch); | 350 void drawBatch(const GrPaint&, const GrClip&, const GrUserStencilSettings&,
GrDrawBatch* batch, |
| 351 GrDrawFace = GrDrawFace::kBoth); |
349 | 352 |
350 GrDrawTarget* getDrawTarget(); | 353 GrDrawTarget* getDrawTarget(); |
351 | 354 |
352 GrDrawingManager* fDrawingManager; | 355 GrDrawingManager* fDrawingManager; |
353 sk_sp<GrRenderTarget> fRenderTarget; | 356 sk_sp<GrRenderTarget> fRenderTarget; |
354 | 357 |
355 // In MDB-mode the drawTarget can be closed by some other drawContext that h
as picked | 358 // In MDB-mode the drawTarget can be closed by some other drawContext that h
as picked |
356 // it up. For this reason, the drawTarget should only ever be accessed via '
getDrawTarget'. | 359 // it up. For this reason, the drawTarget should only ever be accessed via '
getDrawTarget'. |
357 GrDrawTarget* fDrawTarget; | 360 GrDrawTarget* fDrawTarget; |
358 SkAutoTDelete<GrAtlasTextContext> fAtlasTextContext; | 361 SkAutoTDelete<GrAtlasTextContext> fAtlasTextContext; |
359 GrContext* fContext; | 362 GrContext* fContext; |
360 GrInstancedPipelineInfo fInstancedPipelineInfo; | 363 GrInstancedPipelineInfo fInstancedPipelineInfo; |
361 | 364 |
362 SkSurfaceProps fSurfaceProps; | 365 SkSurfaceProps fSurfaceProps; |
363 GrAuditTrail* fAuditTrail; | 366 GrAuditTrail* fAuditTrail; |
364 | 367 |
365 // In debug builds we guard against improper thread handling | 368 // In debug builds we guard against improper thread handling |
366 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) | 369 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) |
367 }; | 370 }; |
368 | 371 |
369 #endif | 372 #endif |
OLD | NEW |