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 #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 Loading... |
28 | 28 |
29 #include "effects/GrRRectEffect.h" | 29 #include "effects/GrRRectEffect.h" |
30 | 30 |
31 #include "instanced/InstancedRendering.h" | 31 #include "instanced/InstancedRendering.h" |
32 | 32 |
33 #include "text/GrAtlasTextContext.h" | 33 #include "text/GrAtlasTextContext.h" |
34 #include "text/GrStencilAndCoverTextContext.h" | 34 #include "text/GrStencilAndCoverTextContext.h" |
35 | 35 |
36 #include "../private/GrAuditTrail.h" | 36 #include "../private/GrAuditTrail.h" |
37 | 37 |
38 #include "SkLatticeIter.h" | |
39 | |
40 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == fDrawingM
anager->getContext()) | 38 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == fDrawingM
anager->getContext()) |
41 #define ASSERT_SINGLE_OWNER \ | 39 #define ASSERT_SINGLE_OWNER \ |
42 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);) | 40 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);) |
43 #define ASSERT_SINGLE_OWNER_PRIV \ | 41 #define ASSERT_SINGLE_OWNER_PRIV \ |
44 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fDrawContext->fSing
leOwner);) | 42 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fDrawContext->fSing
leOwner);) |
45 #define RETURN_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return
; } | 43 #define RETURN_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return
; } |
46 #define RETURN_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->wasAbandon
ed()) { return; } | 44 #define RETURN_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->wasAbandon
ed()) { return; } |
47 #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return
false; } | 45 #define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return
false; } |
48 #define RETURN_FALSE_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->wasAb
andoned()) { return false; } | 46 #define RETURN_FALSE_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->wasAb
andoned()) { return false; } |
49 #define RETURN_NULL_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return
nullptr; } | 47 #define RETURN_NULL_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return
nullptr; } |
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 return; | 992 return; |
995 } | 993 } |
996 } | 994 } |
997 | 995 |
998 SkPath path; | 996 SkPath path; |
999 path.setIsVolatile(true); | 997 path.setIsVolatile(true); |
1000 path.addOval(oval); | 998 path.addOval(oval); |
1001 this->internalDrawPath(clip, paint, viewMatrix, path, style); | 999 this->internalDrawPath(clip, paint, viewMatrix, path, style); |
1002 } | 1000 } |
1003 | 1001 |
1004 void GrDrawContext::drawImageLattice(const GrClip& clip, | 1002 void GrDrawContext::drawImageNine(const GrClip& clip, |
1005 const GrPaint& paint, | 1003 const GrPaint& paint, |
1006 const SkMatrix& viewMatrix, | 1004 const SkMatrix& viewMatrix, |
1007 int imageWidth, | 1005 int imageWidth, |
1008 int imageHeight, | 1006 int imageHeight, |
1009 std::unique_ptr<SkLatticeIter> iter, | 1007 const SkIRect& center, |
1010 const SkRect& dst) { | 1008 const SkRect& dst) { |
1011 ASSERT_SINGLE_OWNER | 1009 ASSERT_SINGLE_OWNER |
1012 RETURN_IF_ABANDONED | 1010 RETURN_IF_ABANDONED |
1013 SkDEBUGCODE(this->validate();) | 1011 SkDEBUGCODE(this->validate();) |
1014 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawImageLattice"); | 1012 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawImageNine"); |
1015 | 1013 |
1016 AutoCheckFlush acf(fDrawingManager); | 1014 AutoCheckFlush acf(fDrawingManager); |
1017 | 1015 |
1018 SkAutoTUnref<GrDrawBatch> batch(GrNinePatch::CreateNonAA(paint.getColor(), v
iewMatrix, | 1016 SkAutoTUnref<GrDrawBatch> batch(GrNinePatch::CreateNonAA(paint.getColor(), v
iewMatrix, |
1019 imageWidth, imageHe
ight, | 1017 imageWidth, imageHe
ight, |
1020 std::move(iter), ds
t)); | 1018 center, dst)); |
1021 | 1019 |
1022 GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint)); | 1020 GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint)); |
1023 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); | 1021 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); |
1024 } | 1022 } |
1025 | 1023 |
1026 void GrDrawContext::prepareForExternalIO() { | 1024 void GrDrawContext::prepareForExternalIO() { |
1027 ASSERT_SINGLE_OWNER | 1025 ASSERT_SINGLE_OWNER |
1028 RETURN_IF_ABANDONED | 1026 RETURN_IF_ABANDONED |
1029 SkDEBUGCODE(this->validate();) | 1027 SkDEBUGCODE(this->validate();) |
1030 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::prepareForExternalIO"
); | 1028 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::prepareForExternalIO"
); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 | 1309 |
1312 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, | 1310 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, |
1313 GrDrawBatch* batch) { | 1311 GrDrawBatch* batch) { |
1314 ASSERT_SINGLE_OWNER | 1312 ASSERT_SINGLE_OWNER |
1315 RETURN_IF_ABANDONED | 1313 RETURN_IF_ABANDONED |
1316 SkDEBUGCODE(this->validate();) | 1314 SkDEBUGCODE(this->validate();) |
1317 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); | 1315 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); |
1318 | 1316 |
1319 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); | 1317 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); |
1320 } | 1318 } |
OLD | NEW |