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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include "effects/GrRRectEffect.h" | 31 #include "effects/GrRRectEffect.h" |
32 | 32 |
33 #include "instanced/InstancedRendering.h" | 33 #include "instanced/InstancedRendering.h" |
34 | 34 |
35 #include "text/GrAtlasTextContext.h" | 35 #include "text/GrAtlasTextContext.h" |
36 #include "text/GrStencilAndCoverTextContext.h" | 36 #include "text/GrStencilAndCoverTextContext.h" |
37 | 37 |
38 #include "../private/GrAuditTrail.h" | 38 #include "../private/GrAuditTrail.h" |
39 | 39 |
40 #include "SkColorSpaceXform.h" | |
41 #include "SkGr.h" | 40 #include "SkGr.h" |
42 #include "SkLatticeIter.h" | 41 #include "SkLatticeIter.h" |
43 #include "SkMatrixPriv.h" | 42 #include "SkMatrixPriv.h" |
44 | 43 |
45 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == fDrawingM
anager->getContext()) | 44 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == fDrawingM
anager->getContext()) |
46 #define ASSERT_SINGLE_OWNER \ | 45 #define ASSERT_SINGLE_OWNER \ |
47 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);) | 46 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);) |
48 #define ASSERT_SINGLE_OWNER_PRIV \ | 47 #define ASSERT_SINGLE_OWNER_PRIV \ |
49 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fDrawContext->fSing
leOwner);) | 48 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fDrawContext->fSing
leOwner);) |
50 #define RETURN_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return
; } | 49 #define RETURN_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return
; } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 , fColorXformFromSRGB(nullptr) | 89 , fColorXformFromSRGB(nullptr) |
91 , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps)) | 90 , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps)) |
92 , fAuditTrail(auditTrail) | 91 , fAuditTrail(auditTrail) |
93 #ifdef SK_DEBUG | 92 #ifdef SK_DEBUG |
94 , fSingleOwner(singleOwner) | 93 , fSingleOwner(singleOwner) |
95 #endif | 94 #endif |
96 { | 95 { |
97 if (fColorSpace) { | 96 if (fColorSpace) { |
98 // sRGB sources are very common (SkColor, etc...), so we cache that gamu
t transformation | 97 // sRGB sources are very common (SkColor, etc...), so we cache that gamu
t transformation |
99 auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); | 98 auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); |
100 fColorXformFromSRGB = SkColorSpaceXform::New(srgbColorSpace, fColorSpace
); | 99 fColorXformFromSRGB = GrColorSpaceXform::Make(srgbColorSpace.get(), fCol
orSpace.get()); |
101 } | 100 } |
102 SkDEBUGCODE(this->validate();) | 101 SkDEBUGCODE(this->validate();) |
103 } | 102 } |
104 | 103 |
105 #ifdef SK_DEBUG | 104 #ifdef SK_DEBUG |
106 void GrDrawContext::validate() const { | 105 void GrDrawContext::validate() const { |
107 SkASSERT(fRenderTarget); | 106 SkASSERT(fRenderTarget); |
108 ASSERT_OWNED_RESOURCE(fRenderTarget); | 107 ASSERT_OWNED_RESOURCE(fRenderTarget); |
109 | 108 |
110 if (fDrawTarget && !fDrawTarget->isClosed()) { | 109 if (fDrawTarget && !fDrawTarget->isClosed()) { |
(...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 | 1426 |
1428 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, | 1427 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr
Clip& clip, |
1429 GrDrawBatch* batch) { | 1428 GrDrawBatch* batch) { |
1430 ASSERT_SINGLE_OWNER | 1429 ASSERT_SINGLE_OWNER |
1431 RETURN_IF_ABANDONED | 1430 RETURN_IF_ABANDONED |
1432 SkDEBUGCODE(this->validate();) | 1431 SkDEBUGCODE(this->validate();) |
1433 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); | 1432 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); |
1434 | 1433 |
1435 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); | 1434 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); |
1436 } | 1435 } |
OLD | NEW |