Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2016 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #include "GrPathRenderingDrawContext.h" | |
| 9 | |
| 10 #include "GrDrawingManager.h" | |
| 11 | |
| 12 #include "text/GrStencilAndCoverTextContext.h" | |
| 13 | |
|
robertphillips
2016/02/16 17:05:11
Do we need OWNED_RESOURCE ?
| |
| 14 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || \ | |
| 15 (R)->getContext() == this->drawingManager()->getContext()) | |
| 16 #define ASSERT_SINGLE_OWNER \ | |
| 17 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(this->singleOwner() );) | |
| 18 #define RETURN_IF_ABANDONED if (this->drawingManager()->abandoned()) { re turn; } | |
|
robertphillips
2016/02/16 17:05:11
rm _FALSE & _NULL flavors ?
| |
| 19 #define RETURN_FALSE_IF_ABANDONED if (this->drawingManager()->abandoned()) { re turn false; } | |
| 20 #define RETURN_NULL_IF_ABANDONED if (this->drawingManager()->abandoned()) { re turn nullptr; } | |
| 21 | |
| 22 void GrPathRenderingDrawContext::drawText(const GrClip& clip, const GrPaint& gr Paint, | |
| 23 const SkPaint& skPaint, | |
| 24 const SkMatrix& viewMatrix, const char text[], | |
| 25 size_t byteLength, SkScalar x, SkScala r y, | |
| 26 const SkIRect& clipBounds) { | |
| 27 ASSERT_SINGLE_OWNER | |
| 28 RETURN_IF_ABANDONED | |
| 29 SkDEBUGCODE(this->validate();) | |
|
robertphillips
2016/02/16 17:05:11
GrPathRenderingDrawContext:: ?
| |
| 30 GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrDrawContext::drawText"); | |
| 31 | |
| 32 if (!fTextContext) { | |
| 33 fTextContext = GrStencilAndCoverTextContext::Create(); | |
| 34 } | |
| 35 | |
| 36 fTextContext->drawText(this->drawingManager()->getContext(), this, clip, grP aint, skPaint, | |
| 37 viewMatrix, this->surfaceProps(), | |
| 38 text, byteLength, x, y, clipBounds); | |
| 39 } | |
|
robertphillips
2016/02/16 17:05:11
\n
| |
| 40 void GrPathRenderingDrawContext::drawPosText(const GrClip& clip, const GrPaint& grPaint, | |
| 41 const SkPaint& skPaint, | |
| 42 const SkMatrix& viewMatrix, const c har text[], | |
| 43 size_t byteLength, const SkScalar pos[], | |
| 44 int scalarsPerPosition, const SkPoi nt& offset, | |
| 45 const SkIRect& clipBounds) { | |
| 46 ASSERT_SINGLE_OWNER | |
| 47 RETURN_IF_ABANDONED | |
| 48 SkDEBUGCODE(this->validate();) | |
|
robertphillips
2016/02/16 17:05:11
GrPathRenderingDrawContext:: ?
| |
| 49 GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrDrawContext::drawPosText"); | |
| 50 | |
| 51 if (!fTextContext) { | |
| 52 fTextContext = GrStencilAndCoverTextContext::Create(); | |
| 53 } | |
| 54 | |
| 55 fTextContext->drawPosText(this->drawingManager()->getContext(), this, clip, grPaint, skPaint, | |
| 56 viewMatrix, this->surfaceProps(), | |
| 57 text, byteLength, pos, scalarsPerPosition, offset, clipBounds); | |
| 58 } | |
|
robertphillips
2016/02/16 17:05:11
\n
| |
| 59 void GrPathRenderingDrawContext::drawTextBlob(const GrClip& clip, const SkPaint& skPaint, | |
| 60 const SkMatrix& viewMatrix, const SkTextBlob* blob, | |
| 61 SkScalar x, SkScalar y, | |
| 62 SkDrawFilter* filter, const SkIRec t& clipBounds) { | |
| 63 ASSERT_SINGLE_OWNER | |
| 64 RETURN_IF_ABANDONED | |
| 65 SkDEBUGCODE(this->validate();) | |
|
robertphillips
2016/02/16 17:05:11
GrPathRenderingDrawContext:: ?
| |
| 66 GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrDrawContext::drawTextBlob") ; | |
| 67 | |
| 68 if (!fTextContext) { | |
| 69 fTextContext = GrStencilAndCoverTextContext::Create(); | |
| 70 } | |
| 71 | |
| 72 fTextContext->drawTextBlob(this->drawingManager()->getContext(), this, clip, skPaint, | |
| 73 viewMatrix, this->surfaceProps(), blob, x, | |
| 74 y, filter, clipBounds); | |
| 75 } | |
| 76 | |
| OLD | NEW |