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 "GrAAFillRectBatch.h" | 8 #include "GrAAFillRectBatch.h" |
9 | 9 |
10 #include "GrColor.h" | 10 #include "GrColor.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 SkASSERT(overrides.canTweakAlphaForCoverage() ? | 243 SkASSERT(overrides.canTweakAlphaForCoverage() ? |
244 gp->getVertexStride() == sizeof(GrDefaultGeoProcFactory::Positi
onColorAttr) : | 244 gp->getVertexStride() == sizeof(GrDefaultGeoProcFactory::Positi
onColorAttr) : |
245 gp->getVertexStride() == | 245 gp->getVertexStride() == |
246 sizeof(GrDefaultGeoProcFactory::PositionColorCoverageAt
tr)); | 246 sizeof(GrDefaultGeoProcFactory::PositionColorCoverageAt
tr)); |
247 return gp; | 247 return gp; |
248 } | 248 } |
249 | 249 |
250 static void Tesselate(intptr_t vertices, size_t vertexStride, const Geometry
& geo, | 250 static void Tesselate(intptr_t vertices, size_t vertexStride, const Geometry
& geo, |
251 const GrXPOverridesForBatch& overrides) { | 251 const GrXPOverridesForBatch& overrides) { |
252 generate_aa_fill_rect_geometry(vertices, vertexStride, | 252 generate_aa_fill_rect_geometry(vertices, vertexStride, |
253 geo.fColor, geo.fViewMatrix, geo.fRect, g
eo.fDevRect, | 253 geo.fColor, geo.fViewMatrix, geo.fRect, g
eo.fDevRect, |
254 overrides, nullptr); | 254 overrides, nullptr); |
255 } | 255 } |
256 }; | 256 }; |
257 | 257 |
258 class AAFillRectBatchLocalMatrixImp : public AAFillRectBatchBase { | 258 class AAFillRectBatchLocalMatrixImp : public AAFillRectBatchBase { |
259 public: | 259 public: |
260 struct Geometry { | 260 struct Geometry { |
261 SkMatrix fViewMatrix; | 261 SkMatrix fViewMatrix; |
262 SkMatrix fLocalMatrix; | 262 SkMatrix fLocalMatrix; |
263 SkRect fRect; | 263 SkRect fRect; |
(...skipping 27 matching lines...) Expand all Loading... |
291 gp->getVertexStride() == | 291 gp->getVertexStride() == |
292 sizeof(GrDefaultGeoProcFactory::PositionColorLocalCoord
Attr) : | 292 sizeof(GrDefaultGeoProcFactory::PositionColorLocalCoord
Attr) : |
293 gp->getVertexStride() == | 293 gp->getVertexStride() == |
294 sizeof(GrDefaultGeoProcFactory::PositionColorLocalCoord
Coverage)); | 294 sizeof(GrDefaultGeoProcFactory::PositionColorLocalCoord
Coverage)); |
295 return gp; | 295 return gp; |
296 } | 296 } |
297 | 297 |
298 static void Tesselate(intptr_t vertices, size_t vertexStride, const Geometry
& geo, | 298 static void Tesselate(intptr_t vertices, size_t vertexStride, const Geometry
& geo, |
299 const GrXPOverridesForBatch& overrides) { | 299 const GrXPOverridesForBatch& overrides) { |
300 generate_aa_fill_rect_geometry(vertices, vertexStride, | 300 generate_aa_fill_rect_geometry(vertices, vertexStride, |
301 geo.fColor, geo.fViewMatrix, geo.fRect, g
eo.fDevRect, | 301 geo.fColor, geo.fViewMatrix, geo.fRect, g
eo.fDevRect, |
302 overrides, &geo.fLocalMatrix); | 302 overrides, &geo.fLocalMatrix); |
303 } | 303 } |
304 }; | 304 }; |
305 | 305 |
306 typedef GrTInstanceBatch<AAFillRectBatchNoLocalMatrixImp> AAFillRectBatchNoLocal
Matrix; | 306 typedef GrTInstanceBatch<AAFillRectBatchNoLocalMatrixImp> AAFillRectBatchNoLocal
Matrix; |
307 typedef GrTInstanceBatch<AAFillRectBatchLocalMatrixImp> AAFillRectBatchLocalMatr
ix; | 307 typedef GrTInstanceBatch<AAFillRectBatchLocalMatrixImp> AAFillRectBatchLocalMatr
ix; |
308 | 308 |
309 inline static void append_to_batch(AAFillRectBatchNoLocalMatrix* batch, GrColor
color, | 309 inline static void append_to_batch(AAFillRectBatchNoLocalMatrix* batch, GrColor
color, |
310 const SkMatrix& viewMatrix, const SkRect& rec
t, | 310 const SkMatrix& viewMatrix, const SkRect& rec
t, |
311 const SkRect& devRect) { | 311 const SkRect& devRect) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 DRAW_BATCH_TEST_DEFINE(AAFillRectBatchLocalMatrix) { | 412 DRAW_BATCH_TEST_DEFINE(AAFillRectBatchLocalMatrix) { |
413 GrColor color = GrRandomColor(random); | 413 GrColor color = GrRandomColor(random); |
414 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); | 414 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); |
415 SkMatrix localMatrix = GrTest::TestMatrix(random); | 415 SkMatrix localMatrix = GrTest::TestMatrix(random); |
416 SkRect rect = GrTest::TestRect(random); | 416 SkRect rect = GrTest::TestRect(random); |
417 SkRect devRect = GrTest::TestRect(random); | 417 SkRect devRect = GrTest::TestRect(random); |
418 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRe
ct); | 418 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRe
ct); |
419 } | 419 } |
420 | 420 |
421 #endif | 421 #endif |
OLD | NEW |