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 "GrNinePatch.h" | 8 #include "GrNinePatch.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 geo.fCenter = center; | 47 geo.fCenter = center; |
48 geo.fDst = dst; | 48 geo.fDst = dst; |
49 | 49 |
50 fImageWidth = imageWidth; | 50 fImageWidth = imageWidth; |
51 fImageHeight = imageHeight; | 51 fImageHeight = imageHeight; |
52 | 52 |
53 // setup bounds | 53 // setup bounds |
54 geo.fViewMatrix.mapRect(&fBounds, geo.fDst); | 54 geo.fViewMatrix.mapRect(&fBounds, geo.fDst); |
55 } | 55 } |
56 | 56 |
57 const char* name() const override { return "GrNonAANinePatchBatch"; } | 57 const char* name() const override { return "NonAANinePatchBatch"; } |
| 58 |
| 59 SkString dumpInfo() const override { |
| 60 SkString str; |
| 61 |
| 62 for (int i = 0; i < fGeoData.count(); ++i) { |
| 63 str.appendf("%d: Color: 0x%08x Center [L: %d, T: %d, R: %d, B: %d],
" |
| 64 "Dst [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n", |
| 65 i, |
| 66 fGeoData[i].fColor, |
| 67 fGeoData[i].fCenter.fLeft, fGeoData[i].fCenter.fTop, |
| 68 fGeoData[i].fCenter.fRight, fGeoData[i].fCenter.fBottom, |
| 69 fGeoData[i].fDst.fLeft, fGeoData[i].fDst.fTop, |
| 70 fGeoData[i].fDst.fRight, fGeoData[i].fDst.fBottom); |
| 71 } |
| 72 |
| 73 str.append(INHERITED::dumpInfo()); |
| 74 return str; |
| 75 } |
58 | 76 |
59 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 77 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
60 out->setUnknownFourComponents(); | 78 out->setUnknownFourComponents(); |
61 } | 79 } |
62 | 80 |
63 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 81 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
64 out->setKnownSingleComponent(0xff); | 82 out->setKnownSingleComponent(0xff); |
65 } | 83 } |
66 | 84 |
67 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 85 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 175 |
158 typedef GrVertexBatch INHERITED; | 176 typedef GrVertexBatch INHERITED; |
159 }; | 177 }; |
160 | 178 |
161 namespace GrNinePatch { | 179 namespace GrNinePatch { |
162 GrDrawBatch* CreateNonAA(GrColor color, const SkMatrix& viewMatrix, int imageWid
th, int imageHeight, | 180 GrDrawBatch* CreateNonAA(GrColor color, const SkMatrix& viewMatrix, int imageWid
th, int imageHeight, |
163 const SkIRect& center, const SkRect& dst) { | 181 const SkIRect& center, const SkRect& dst) { |
164 return new GrNonAANinePatchBatch(color, viewMatrix, imageWidth, imageHeight,
center, dst); | 182 return new GrNonAANinePatchBatch(color, viewMatrix, imageWidth, imageHeight,
center, dst); |
165 } | 183 } |
166 }; | 184 }; |
OLD | NEW |