| Index: src/gpu/GrDrawContext.cpp
|
| diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
|
| index 497af7ce9b764fa0b64c21b2759db1e68e1753c7..c471dca1be6d99e7b1c5149dbb12b4c8f60b027f 100644
|
| --- a/src/gpu/GrDrawContext.cpp
|
| +++ b/src/gpu/GrDrawContext.cpp
|
| @@ -26,6 +26,8 @@
|
| #include "text/GrAtlasTextContext.h"
|
| #include "text/GrStencilAndCoverTextContext.h"
|
|
|
| +#include "../private/GrAuditTrail.h"
|
| +
|
| #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == fDrawingManager->getContext())
|
| #define ASSERT_SINGLE_OWNER \
|
| SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);)
|
| @@ -51,12 +53,14 @@ private:
|
| GrDrawContext::GrDrawContext(GrDrawingManager* drawingMgr,
|
| GrRenderTarget* rt,
|
| const SkSurfaceProps* surfaceProps,
|
| + GrAuditTrail* auditTrail,
|
| GrSingleOwner* singleOwner)
|
| : fDrawingManager(drawingMgr)
|
| , fRenderTarget(rt)
|
| , fDrawTarget(SkSafeRef(rt->getLastDrawTarget()))
|
| , fTextContext(nullptr)
|
| , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps))
|
| + , fAuditTrail(auditTrail)
|
| #ifdef SK_DEBUG
|
| , fSingleOwner(singleOwner)
|
| #endif
|
| @@ -95,6 +99,7 @@ void GrDrawContext::copySurface(GrSurface* src, const SkIRect& srcRect, const Sk
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::copySurface");
|
|
|
| this->getDrawTarget()->copySurface(fRenderTarget, src, srcRect, dstPoint);
|
| }
|
| @@ -107,6 +112,7 @@ void GrDrawContext::drawText(const GrClip& clip, const GrPaint& grPaint,
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawText");
|
|
|
| if (!fTextContext) {
|
| fTextContext = fDrawingManager->textContext(fSurfaceProps, fRenderTarget);
|
| @@ -125,6 +131,7 @@ void GrDrawContext::drawPosText(const GrClip& clip, const GrPaint& grPaint,
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawPosText");
|
|
|
| if (!fTextContext) {
|
| fTextContext = fDrawingManager->textContext(fSurfaceProps, fRenderTarget);
|
| @@ -142,6 +149,7 @@ void GrDrawContext::drawTextBlob(const GrClip& clip, const SkPaint& skPaint,
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawTextBlob");
|
|
|
| if (!fTextContext) {
|
| fTextContext = fDrawingManager->textContext(fSurfaceProps, fRenderTarget);
|
| @@ -154,6 +162,7 @@ void GrDrawContext::discard() {
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::discard");
|
|
|
| AutoCheckFlush acf(fDrawingManager);
|
| this->getDrawTarget()->discard(fRenderTarget);
|
| @@ -165,6 +174,7 @@ void GrDrawContext::clear(const SkIRect* rect,
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::clear");
|
|
|
| AutoCheckFlush acf(fDrawingManager);
|
| this->getDrawTarget()->clear(rect, color, canIgnoreRect, fRenderTarget);
|
| @@ -177,6 +187,7 @@ void GrDrawContext::drawPaint(const GrClip& clip,
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawPaint");
|
|
|
| // set rect to be big enough to fill the space, but not super-huge, so we
|
| // don't overflow fixed-point implementations
|
| @@ -243,6 +254,7 @@ void GrDrawContext::drawRect(const GrClip& clip,
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawRect");
|
|
|
| // Dashing should've been devolved to a path in SkGpuDevice
|
| SkASSERT(!strokeInfo || !strokeInfo->isDashed());
|
| @@ -343,6 +355,7 @@ void GrDrawContext::fillRectToRect(const GrClip& clip,
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::fillRectToRect");
|
|
|
| AutoCheckFlush acf(fDrawingManager);
|
|
|
| @@ -371,6 +384,7 @@ void GrDrawContext::fillRectWithLocalMatrix(const GrClip& clip,
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::fillRectWithLocalMatrix");
|
|
|
| AutoCheckFlush acf(fDrawingManager);
|
|
|
| @@ -403,6 +417,7 @@ void GrDrawContext::drawVertices(const GrClip& clip,
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawVertices");
|
|
|
| AutoCheckFlush acf(fDrawingManager);
|
|
|
| @@ -447,6 +462,7 @@ void GrDrawContext::drawAtlas(const GrClip& clip,
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawAtlas");
|
|
|
| AutoCheckFlush acf(fDrawingManager);
|
|
|
| @@ -470,6 +486,7 @@ void GrDrawContext::drawRRect(const GrClip& clip,
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawRRect");
|
|
|
| if (rrect.isEmpty()) {
|
| return;
|
| @@ -507,6 +524,7 @@ void GrDrawContext::drawDRRect(const GrClip& clip,
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawDRRect");
|
|
|
| if (outer.isEmpty()) {
|
| return;
|
| @@ -545,6 +563,7 @@ void GrDrawContext::drawOval(const GrClip& clip,
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawOval");
|
|
|
| if (oval.isEmpty()) {
|
| return;
|
| @@ -582,6 +601,7 @@ void GrDrawContext::drawImageNine(const GrClip& clip,
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawImageNine");
|
|
|
| AutoCheckFlush acf(fDrawingManager);
|
|
|
| @@ -649,6 +669,7 @@ void GrDrawContext::drawBatch(const GrClip& clip,
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch");
|
|
|
| AutoCheckFlush acf(fDrawingManager);
|
|
|
| @@ -661,6 +682,7 @@ void GrDrawContext::drawPathBatch(const GrPipelineBuilder& pipelineBuilder,
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawPathBatch");
|
|
|
| AutoCheckFlush acf(fDrawingManager);
|
|
|
| @@ -675,6 +697,7 @@ void GrDrawContext::drawPath(const GrClip& clip,
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawPath");
|
|
|
| if (path.isEmpty()) {
|
| if (path.isInverseFillType()) {
|
| @@ -832,6 +855,7 @@ void GrDrawContext::drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* b
|
| ASSERT_SINGLE_OWNER
|
| RETURN_IF_ABANDONED
|
| SkDEBUGCODE(this->validate();)
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch");
|
|
|
| this->getDrawTarget()->drawBatch(*pipelineBuilder, batch);
|
| }
|
|
|