Line data Source code
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 "GrPathRenderingRenderTargetContext.h"
9 :
10 : #include "GrDrawingManager.h"
11 :
12 : #include "text/GrStencilAndCoverTextContext.h"
13 :
14 : #define ASSERT_SINGLE_OWNER \
15 : SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(this->singleOwner());)
16 : #define RETURN_IF_ABANDONED if (this->drawingManager()->wasAbandoned()) { return; }
17 :
18 0 : void GrPathRenderingRenderTargetContext::drawText(const GrClip& clip, const SkPaint& skPaint,
19 : const SkMatrix& viewMatrix, const char text[],
20 : size_t byteLength, SkScalar x, SkScalar y,
21 : const SkIRect& clipBounds) {
22 0 : ASSERT_SINGLE_OWNER
23 0 : RETURN_IF_ABANDONED
24 0 : SkDEBUGCODE(this->validate();)
25 0 : GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrPathRenderingRenderTargetContext::drawText");
26 :
27 0 : if (!fStencilAndCoverTextContext) {
28 0 : GrAtlasTextContext* fallbackContext = this->drawingManager()->getAtlasTextContext();
29 0 : fStencilAndCoverTextContext.reset(GrStencilAndCoverTextContext::Create(fallbackContext));
30 : }
31 :
32 0 : fStencilAndCoverTextContext->drawText(this->drawingManager()->getContext(), this, clip, skPaint,
33 : viewMatrix, this->surfaceProps(), text, byteLength, x, y,
34 0 : clipBounds);
35 : }
36 :
37 0 : void GrPathRenderingRenderTargetContext::drawPosText(const GrClip& clip, const SkPaint& skPaint,
38 : const SkMatrix& viewMatrix, const char text[],
39 : size_t byteLength, const SkScalar pos[],
40 : int scalarsPerPosition, const SkPoint& offset,
41 : const SkIRect& clipBounds) {
42 0 : ASSERT_SINGLE_OWNER
43 0 : RETURN_IF_ABANDONED
44 0 : SkDEBUGCODE(this->validate();)
45 0 : GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(),
46 : "GrPathRenderingRenderTargetContext::drawPosText");
47 :
48 0 : if (!fStencilAndCoverTextContext) {
49 0 : GrAtlasTextContext* fallbackContext = this->drawingManager()->getAtlasTextContext();
50 0 : fStencilAndCoverTextContext.reset(GrStencilAndCoverTextContext::Create(fallbackContext));
51 : }
52 :
53 0 : fStencilAndCoverTextContext->drawPosText(
54 : this->drawingManager()->getContext(), this, clip, skPaint, viewMatrix,
55 0 : this->surfaceProps(), text, byteLength, pos, scalarsPerPosition, offset, clipBounds);
56 : }
57 :
58 0 : void GrPathRenderingRenderTargetContext::drawTextBlob(const GrClip& clip, const SkPaint& skPaint,
59 : const SkMatrix& viewMatrix,
60 : const SkTextBlob* blob,
61 : SkScalar x, SkScalar y,
62 : SkDrawFilter* filter,
63 : const SkIRect& clipBounds) {
64 0 : ASSERT_SINGLE_OWNER
65 0 : RETURN_IF_ABANDONED
66 0 : SkDEBUGCODE(this->validate();)
67 0 : GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(),
68 : "GrPathRenderingRenderTargetContext::drawTextBlob");
69 :
70 0 : if (!fStencilAndCoverTextContext) {
71 0 : GrAtlasTextContext* fallbackContext = this->drawingManager()->getAtlasTextContext();
72 0 : fStencilAndCoverTextContext.reset(GrStencilAndCoverTextContext::Create(fallbackContext));
73 : }
74 :
75 0 : fStencilAndCoverTextContext->drawTextBlob(this->drawingManager()->getContext(), this, clip,
76 : skPaint, viewMatrix, this->surfaceProps(), blob, x,
77 0 : y, filter, clipBounds);
78 : }
|