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 "GrDrawPathBatch.h" | 8 #include "GrDrawPathBatch.h" |
9 | 9 |
10 #include "GrRenderTargetPriv.h" | 10 #include "GrRenderTargetPriv.h" |
11 | 11 |
12 static void pre_translate_transform_values(const float* xforms, | 12 static void pre_translate_transform_values(const float* xforms, |
13 GrPathRendering::PathTransformType ty
pe, int count, | 13 GrPathRendering::PathTransformType ty
pe, int count, |
14 SkScalar x, SkScalar y, float* dst); | 14 SkScalar x, SkScalar y, float* dst); |
15 | 15 |
16 void GrDrawPathBatchBase::onPrepare(GrBatchFlushState*) { | 16 void GrDrawPathBatchBase::onPrepare(GrBatchFlushState*) { |
17 const GrRenderTargetPriv& rtPriv = this->pipeline()->getRenderTarget()->rend
erTargetPriv(); | 17 const GrRenderTargetPriv& rtPriv = this->pipeline()->getRenderTarget()->rend
erTargetPriv(); |
18 fStencilPassSettings.reset(GrPathRendering::GetStencilPassSettings(fFillType
), | 18 fStencilPassSettings.reset(GrPathRendering::GetStencilPassSettings(fFillType
), |
19 this->pipeline()->hasStencilClip(), rtPriv.numSte
ncilBits()); | 19 this->pipeline()->hasStencilClip(), rtPriv.numSte
ncilBits()); |
20 } | 20 } |
21 | 21 |
22 SkString GrDrawPathBatch::dumpInfo() const { | 22 SkString GrDrawPathBatch::dumpInfo() const { |
23 SkString string; | 23 SkString string; |
24 string.printf("PATH: 0x%p", fPath.get()); | 24 string.printf("PATH: 0x%p", fPath.get()); |
| 25 string.append(INHERITED::dumpInfo()); |
25 return string; | 26 return string; |
26 } | 27 } |
27 | 28 |
28 void GrDrawPathBatch::onDraw(GrBatchFlushState* state) { | 29 void GrDrawPathBatch::onDraw(GrBatchFlushState* state) { |
29 GrProgramDesc desc; | 30 GrProgramDesc desc; |
30 | 31 |
31 SkAutoTUnref<GrPathProcessor> pathProc(GrPathProcessor::Create(this->color()
, | 32 SkAutoTUnref<GrPathProcessor> pathProc(GrPathProcessor::Create(this->color()
, |
32 this->overrid
es(), | 33 this->overrid
es(), |
33 this->viewMat
rix())); | 34 this->viewMat
rix())); |
34 state->gpu()->pathRendering()->drawPath(*this->pipeline(), *pathProc, | 35 state->gpu()->pathRendering()->drawPath(*this->pipeline(), *pathProc, |
35 this->stencilPassSettings(), fPath.g
et()); | 36 this->stencilPassSettings(), fPath.g
et()); |
36 } | 37 } |
37 | 38 |
38 SkString GrDrawPathRangeBatch::dumpInfo() const { | 39 SkString GrDrawPathRangeBatch::dumpInfo() const { |
39 SkString string; | 40 SkString string; |
40 string.printf("RANGE: 0x%p COUNTS: [", fPathRange.get()); | 41 string.printf("RANGE: 0x%p COUNTS: [", fPathRange.get()); |
41 for (DrawList::Iter iter(fDraws); iter.get(); iter.next()) { | 42 for (DrawList::Iter iter(fDraws); iter.get(); iter.next()) { |
42 string.appendf("%d, ", iter.get()->fInstanceData->count()); | 43 string.appendf("%d, ", iter.get()->fInstanceData->count()); |
43 } | 44 } |
44 string.remove(string.size() - 2, 2); | 45 string.remove(string.size() - 2, 2); |
45 string.append("]"); | 46 string.append("]"); |
| 47 string.append(INHERITED::dumpInfo()); |
46 return string; | 48 return string; |
47 } | 49 } |
48 | 50 |
49 GrDrawPathRangeBatch::GrDrawPathRangeBatch(const SkMatrix& viewMatrix, SkScalar
scale, SkScalar x, | 51 GrDrawPathRangeBatch::GrDrawPathRangeBatch(const SkMatrix& viewMatrix, SkScalar
scale, SkScalar x, |
50 SkScalar y, GrColor color, | 52 SkScalar y, GrColor color, |
51 GrPathRendering::FillType fill, GrPat
hRange* range, | 53 GrPathRendering::FillType fill, GrPat
hRange* range, |
52 const InstanceData* instanceData, con
st SkRect& bounds) | 54 const InstanceData* instanceData, con
st SkRect& bounds) |
53 : INHERITED(ClassID(), viewMatrix, color, fill) | 55 : INHERITED(ClassID(), viewMatrix, color, fill) |
54 , fPathRange(range) | 56 , fPathRange(range) |
55 , fTotalPathCount(instanceData->count()) | 57 , fTotalPathCount(instanceData->count()) |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 dst[i + 3] = xforms[i + 3]; | 212 dst[i + 3] = xforms[i + 3]; |
211 dst[i + 4] = xforms[i + 4]; | 213 dst[i + 4] = xforms[i + 4]; |
212 dst[i + 5] = xforms[i + 3] * x + xforms[i + 4] * y + xforms[i +
5]; | 214 dst[i + 5] = xforms[i + 3] * x + xforms[i + 4] * y + xforms[i +
5]; |
213 } | 215 } |
214 break; | 216 break; |
215 default: | 217 default: |
216 SkFAIL("Unknown transform type."); | 218 SkFAIL("Unknown transform type."); |
217 break; | 219 break; |
218 } | 220 } |
219 } | 221 } |
OLD | NEW |