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

Side by Side Diff: src/gpu/GrDrawContext.cpp

Issue 1979913002: Rename GrDrawingMgr::abandon to wasAbandoned & add a matching entry point to GrDrawingContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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/GrContext.cpp ('k') | src/gpu/GrDrawingManager.h » ('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 #include "GrBatchTest.h" 8 #include "GrBatchTest.h"
9 #include "GrColor.h" 9 #include "GrColor.h"
10 #include "GrDrawContext.h" 10 #include "GrDrawContext.h"
(...skipping 17 matching lines...) Expand all
28 #include "text/GrAtlasTextContext.h" 28 #include "text/GrAtlasTextContext.h"
29 #include "text/GrStencilAndCoverTextContext.h" 29 #include "text/GrStencilAndCoverTextContext.h"
30 30
31 #include "../private/GrAuditTrail.h" 31 #include "../private/GrAuditTrail.h"
32 32
33 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == fDrawingM anager->getContext()) 33 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == fDrawingM anager->getContext())
34 #define ASSERT_SINGLE_OWNER \ 34 #define ASSERT_SINGLE_OWNER \
35 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);) 35 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);)
36 #define ASSERT_SINGLE_OWNER_PRIV \ 36 #define ASSERT_SINGLE_OWNER_PRIV \
37 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fDrawContext->fSing leOwner);) 37 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fDrawContext->fSing leOwner);)
38 #define RETURN_IF_ABANDONED if (fDrawingManager->abandoned()) { return; } 38 #define RETURN_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return ; }
39 #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->abandoned()) { return fa lse; } 39 #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return false; }
40 #define RETURN_FALSE_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->aband oned()) { return false; } 40 #define RETURN_FALSE_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->wasAb andoned()) { return false; }
41 #define RETURN_NULL_IF_ABANDONED if (fDrawingManager->abandoned()) { return nu llptr; } 41 #define RETURN_NULL_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return nullptr; }
42 42
43 class AutoCheckFlush { 43 class AutoCheckFlush {
44 public: 44 public:
45 AutoCheckFlush(GrDrawingManager* drawingManager) : fDrawingManager(drawingMa nager) { 45 AutoCheckFlush(GrDrawingManager* drawingManager) : fDrawingManager(drawingMa nager) {
46 SkASSERT(fDrawingManager); 46 SkASSERT(fDrawingManager);
47 } 47 }
48 ~AutoCheckFlush() { fDrawingManager->getContext()->flushIfNecessary(); } 48 ~AutoCheckFlush() { fDrawingManager->getContext()->flushIfNecessary(); }
49 49
50 private: 50 private:
51 GrDrawingManager* fDrawingManager; 51 GrDrawingManager* fDrawingManager;
52 }; 52 };
53 53
54 bool GrDrawContext::wasAbandoned() const {
55 return fDrawingManager->wasAbandoned();
56 }
57
54 // In MDB mode the reffing of the 'getLastDrawTarget' call's result allows in-pr ogress 58 // In MDB mode the reffing of the 'getLastDrawTarget' call's result allows in-pr ogress
55 // drawTargets to be picked up and added to by drawContexts lower in the call 59 // drawTargets to be picked up and added to by drawContexts lower in the call
56 // stack. When this occurs with a closed drawTarget, a new one will be allocated 60 // stack. When this occurs with a closed drawTarget, a new one will be allocated
57 // when the drawContext attempts to use it (via getDrawTarget). 61 // when the drawContext attempts to use it (via getDrawTarget).
58 GrDrawContext::GrDrawContext(GrContext* context, 62 GrDrawContext::GrDrawContext(GrContext* context,
59 GrDrawingManager* drawingMgr, 63 GrDrawingManager* drawingMgr,
60 sk_sp<GrRenderTarget> rt, 64 sk_sp<GrRenderTarget> rt,
61 const SkSurfaceProps* surfaceProps, 65 const SkSurfaceProps* surfaceProps,
62 GrAuditTrail* auditTrail, 66 GrAuditTrail* auditTrail,
63 GrSingleOwner* singleOwner) 67 GrSingleOwner* singleOwner)
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 1012
1009 void GrDrawContext::drawBatch(GrPipelineBuilder* pipelineBuilder, const GrClip& clip, 1013 void GrDrawContext::drawBatch(GrPipelineBuilder* pipelineBuilder, const GrClip& clip,
1010 GrDrawBatch* batch) { 1014 GrDrawBatch* batch) {
1011 ASSERT_SINGLE_OWNER 1015 ASSERT_SINGLE_OWNER
1012 RETURN_IF_ABANDONED 1016 RETURN_IF_ABANDONED
1013 SkDEBUGCODE(this->validate();) 1017 SkDEBUGCODE(this->validate();)
1014 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); 1018 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch");
1015 1019
1016 this->getDrawTarget()->drawBatch(*pipelineBuilder, clip, batch); 1020 this->getDrawTarget()->drawBatch(*pipelineBuilder, clip, batch);
1017 } 1021 }
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrDrawingManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698