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