OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrDashingEffect.h" | 8 #include "GrDashingEffect.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 overrides.getOverrideColorIfSet(&fGeoData[0].fColor); | 309 overrides.getOverrideColorIfSet(&fGeoData[0].fColor); |
310 | 310 |
311 // setup batch properties | 311 // setup batch properties |
312 fBatch.fColorIgnored = !overrides.readsColor(); | 312 fBatch.fColorIgnored = !overrides.readsColor(); |
313 fBatch.fColor = fGeoData[0].fColor; | 313 fBatch.fColor = fGeoData[0].fColor; |
314 fBatch.fUsesLocalCoords = overrides.readsLocalCoords(); | 314 fBatch.fUsesLocalCoords = overrides.readsLocalCoords(); |
315 fBatch.fCoverageIgnored = !overrides.readsCoverage(); | 315 fBatch.fCoverageIgnored = !overrides.readsCoverage(); |
316 } | 316 } |
317 | 317 |
318 struct DashDraw { | 318 struct DashDraw { |
| 319 DashDraw(const Geometry& geo) { |
| 320 memcpy(fPtsRot, geo.fPtsRot, sizeof(geo.fPtsRot)); |
| 321 memcpy(fIntervals, geo.fIntervals, sizeof(geo.fIntervals)); |
| 322 fPhase = geo.fPhase; |
| 323 } |
| 324 SkPoint fPtsRot[2]; |
| 325 SkScalar fIntervals[2]; |
| 326 SkScalar fPhase; |
319 SkScalar fStartOffset; | 327 SkScalar fStartOffset; |
320 SkScalar fStrokeWidth; | 328 SkScalar fStrokeWidth; |
321 SkScalar fLineLength; | 329 SkScalar fLineLength; |
322 SkScalar fHalfDevStroke; | 330 SkScalar fHalfDevStroke; |
323 SkScalar fDevBloatX; | 331 SkScalar fDevBloatX; |
324 SkScalar fDevBloatY; | 332 SkScalar fDevBloatY; |
325 bool fLineDone; | 333 bool fLineDone; |
326 bool fHasStartRect; | 334 bool fHasStartRect; |
327 bool fHasEndRect; | 335 bool fHasEndRect; |
328 }; | 336 }; |
329 | 337 |
330 void onPrepareDraws(Target* target) override { | 338 void onPrepareDraws(Target* target) const override { |
331 int instanceCount = fGeoData.count(); | 339 int instanceCount = fGeoData.count(); |
332 SkPaint::Cap cap = this->cap(); | 340 SkPaint::Cap cap = this->cap(); |
333 bool isRoundCap = SkPaint::kRound_Cap == cap; | 341 bool isRoundCap = SkPaint::kRound_Cap == cap; |
334 DashCap capType = isRoundCap ? kRound_DashCap : kNonRound_DashCap; | 342 DashCap capType = isRoundCap ? kRound_DashCap : kNonRound_DashCap; |
335 | 343 |
336 SkAutoTUnref<const GrGeometryProcessor> gp; | 344 SkAutoTUnref<const GrGeometryProcessor> gp; |
337 if (this->fullDash()) { | 345 if (this->fullDash()) { |
338 gp.reset(create_dash_gp(this->color(), this->aaMode(), capType, this
->viewMatrix(), | 346 gp.reset(create_dash_gp(this->color(), this->aaMode(), capType, this
->viewMatrix(), |
339 this->usesLocalCoords())); | 347 this->usesLocalCoords())); |
340 } else { | 348 } else { |
(...skipping 14 matching lines...) Expand all Loading... |
355 | 363 |
356 target->initDraw(gp, this->pipeline()); | 364 target->initDraw(gp, this->pipeline()); |
357 | 365 |
358 // useAA here means Edge AA or MSAA | 366 // useAA here means Edge AA or MSAA |
359 bool useAA = this->aaMode() != kBW_DashAAMode; | 367 bool useAA = this->aaMode() != kBW_DashAAMode; |
360 bool fullDash = this->fullDash(); | 368 bool fullDash = this->fullDash(); |
361 | 369 |
362 // We do two passes over all of the dashes. First we setup the start, e
nd, and bounds, | 370 // We do two passes over all of the dashes. First we setup the start, e
nd, and bounds, |
363 // rectangles. We preserve all of this work in the rects / draws arrays
below. Then we | 371 // rectangles. We preserve all of this work in the rects / draws arrays
below. Then we |
364 // iterate again over these decomposed dashes to generate vertices | 372 // iterate again over these decomposed dashes to generate vertices |
365 SkSTArray<128, SkRect, true> rects; | 373 static const int kNumStackDashes = 128; |
366 SkSTArray<128, DashDraw, true> draws; | 374 SkSTArray<kNumStackDashes, SkRect, true> rects; |
| 375 SkSTArray<kNumStackDashes, DashDraw, true> draws; |
367 | 376 |
368 int totalRectCount = 0; | 377 int totalRectCount = 0; |
369 int rectOffset = 0; | 378 int rectOffset = 0; |
370 rects.push_back_n(3 * instanceCount); | 379 rects.push_back_n(3 * instanceCount); |
371 for (int i = 0; i < instanceCount; i++) { | 380 for (int i = 0; i < instanceCount; i++) { |
372 Geometry& args = fGeoData[i]; | 381 const Geometry& args = fGeoData[i]; |
| 382 |
| 383 DashDraw& draw = draws.push_back(args); |
373 | 384 |
374 bool hasCap = SkPaint::kButt_Cap != cap && 0 != args.fSrcStrokeWidth
; | 385 bool hasCap = SkPaint::kButt_Cap != cap && 0 != args.fSrcStrokeWidth
; |
375 | 386 |
376 // We always want to at least stroke out half a pixel on each side i
n device space | 387 // We always want to at least stroke out half a pixel on each side i
n device space |
377 // so 0.5f / perpScale gives us this min in src space | 388 // so 0.5f / perpScale gives us this min in src space |
378 SkScalar halfSrcStroke = | 389 SkScalar halfSrcStroke = |
379 SkMaxScalar(args.fSrcStrokeWidth * 0.5f, 0.5f / args.fPerpen
dicularScale); | 390 SkMaxScalar(args.fSrcStrokeWidth * 0.5f, 0.5f / args.fPerpen
dicularScale); |
380 | 391 |
381 SkScalar strokeAdj; | 392 SkScalar strokeAdj; |
382 if (!hasCap) { | 393 if (!hasCap) { |
383 strokeAdj = 0.f; | 394 strokeAdj = 0.f; |
384 } else { | 395 } else { |
385 strokeAdj = halfSrcStroke; | 396 strokeAdj = halfSrcStroke; |
386 } | 397 } |
387 | 398 |
388 SkScalar startAdj = 0; | 399 SkScalar startAdj = 0; |
389 | 400 |
390 bool lineDone = false; | 401 bool lineDone = false; |
391 | 402 |
392 // Too simplify the algorithm, we always push back rects for start a
nd end rect. | 403 // Too simplify the algorithm, we always push back rects for start a
nd end rect. |
393 // Otherwise we'd have to track start / end rects for each individua
l geometry | 404 // Otherwise we'd have to track start / end rects for each individua
l geometry |
394 SkRect& bounds = rects[rectOffset++]; | 405 SkRect& bounds = rects[rectOffset++]; |
395 SkRect& startRect = rects[rectOffset++]; | 406 SkRect& startRect = rects[rectOffset++]; |
396 SkRect& endRect = rects[rectOffset++]; | 407 SkRect& endRect = rects[rectOffset++]; |
397 | 408 |
398 bool hasStartRect = false; | 409 bool hasStartRect = false; |
399 // If we are using AA, check to see if we are drawing a partial dash
at the start. If so | 410 // If we are using AA, check to see if we are drawing a partial dash
at the start. If so |
400 // draw it separately here and adjust our start point accordingly | 411 // draw it separately here and adjust our start point accordingly |
401 if (useAA) { | 412 if (useAA) { |
402 if (args.fPhase > 0 && args.fPhase < args.fIntervals[0]) { | 413 if (draw.fPhase > 0 && draw.fPhase < draw.fIntervals[0]) { |
403 SkPoint startPts[2]; | 414 SkPoint startPts[2]; |
404 startPts[0] = args.fPtsRot[0]; | 415 startPts[0] = draw.fPtsRot[0]; |
405 startPts[1].fY = startPts[0].fY; | 416 startPts[1].fY = startPts[0].fY; |
406 startPts[1].fX = SkMinScalar(startPts[0].fX + args.fInterval
s[0] - args.fPhase, | 417 startPts[1].fX = SkMinScalar(startPts[0].fX + draw.fInterval
s[0] - draw.fPhase, |
407 args.fPtsRot[1].fX); | 418 draw.fPtsRot[1].fX); |
408 startRect.set(startPts, 2); | 419 startRect.set(startPts, 2); |
409 startRect.outset(strokeAdj, halfSrcStroke); | 420 startRect.outset(strokeAdj, halfSrcStroke); |
410 | 421 |
411 hasStartRect = true; | 422 hasStartRect = true; |
412 startAdj = args.fIntervals[0] + args.fIntervals[1] - args.fP
hase; | 423 startAdj = draw.fIntervals[0] + draw.fIntervals[1] - draw.fP
hase; |
413 } | 424 } |
414 } | 425 } |
415 | 426 |
416 // adjustments for start and end of bounding rect so we only draw da
sh intervals | 427 // adjustments for start and end of bounding rect so we only draw da
sh intervals |
417 // contained in the original line segment. | 428 // contained in the original line segment. |
418 startAdj += calc_start_adjustment(args.fIntervals, args.fPhase); | 429 startAdj += calc_start_adjustment(draw.fIntervals, draw.fPhase); |
419 if (startAdj != 0) { | 430 if (startAdj != 0) { |
420 args.fPtsRot[0].fX += startAdj; | 431 draw.fPtsRot[0].fX += startAdj; |
421 args.fPhase = 0; | 432 draw.fPhase = 0; |
422 } | 433 } |
423 SkScalar endingInterval = 0; | 434 SkScalar endingInterval = 0; |
424 SkScalar endAdj = calc_end_adjustment(args.fIntervals, args.fPtsRot,
args.fPhase, | 435 SkScalar endAdj = calc_end_adjustment(draw.fIntervals, draw.fPtsRot,
draw.fPhase, |
425 &endingInterval); | 436 &endingInterval); |
426 args.fPtsRot[1].fX -= endAdj; | 437 draw.fPtsRot[1].fX -= endAdj; |
427 if (args.fPtsRot[0].fX >= args.fPtsRot[1].fX) { | 438 if (draw.fPtsRot[0].fX >= draw.fPtsRot[1].fX) { |
428 lineDone = true; | 439 lineDone = true; |
429 } | 440 } |
430 | 441 |
431 bool hasEndRect = false; | 442 bool hasEndRect = false; |
432 // If we are using AA, check to see if we are drawing a partial dash
at then end. If so | 443 // If we are using AA, check to see if we are drawing a partial dash
at then end. If so |
433 // draw it separately here and adjust our end point accordingly | 444 // draw it separately here and adjust our end point accordingly |
434 if (useAA && !lineDone) { | 445 if (useAA && !lineDone) { |
435 // If we adjusted the end then we will not be drawing a partial
dash at the end. | 446 // If we adjusted the end then we will not be drawing a partial
dash at the end. |
436 // If we didn't adjust the end point then we just need to make s
ure the ending | 447 // If we didn't adjust the end point then we just need to make s
ure the ending |
437 // dash isn't a full dash | 448 // dash isn't a full dash |
438 if (0 == endAdj && endingInterval != args.fIntervals[0]) { | 449 if (0 == endAdj && endingInterval != draw.fIntervals[0]) { |
439 SkPoint endPts[2]; | 450 SkPoint endPts[2]; |
440 endPts[1] = args.fPtsRot[1]; | 451 endPts[1] = draw.fPtsRot[1]; |
441 endPts[0].fY = endPts[1].fY; | 452 endPts[0].fY = endPts[1].fY; |
442 endPts[0].fX = endPts[1].fX - endingInterval; | 453 endPts[0].fX = endPts[1].fX - endingInterval; |
443 | 454 |
444 endRect.set(endPts, 2); | 455 endRect.set(endPts, 2); |
445 endRect.outset(strokeAdj, halfSrcStroke); | 456 endRect.outset(strokeAdj, halfSrcStroke); |
446 | 457 |
447 hasEndRect = true; | 458 hasEndRect = true; |
448 endAdj = endingInterval + args.fIntervals[1]; | 459 endAdj = endingInterval + draw.fIntervals[1]; |
449 | 460 |
450 args.fPtsRot[1].fX -= endAdj; | 461 draw.fPtsRot[1].fX -= endAdj; |
451 if (args.fPtsRot[0].fX >= args.fPtsRot[1].fX) { | 462 if (draw.fPtsRot[0].fX >= draw.fPtsRot[1].fX) { |
452 lineDone = true; | 463 lineDone = true; |
453 } | 464 } |
454 } | 465 } |
455 } | 466 } |
456 | 467 |
457 if (startAdj != 0) { | 468 if (startAdj != 0) { |
458 args.fPhase = 0; | 469 draw.fPhase = 0; |
459 } | 470 } |
460 | 471 |
461 // Change the dashing info from src space into device space | 472 // Change the dashing info from src space into device space |
462 SkScalar* devIntervals = args.fIntervals; | 473 SkScalar* devIntervals = draw.fIntervals; |
463 devIntervals[0] = args.fIntervals[0] * args.fParallelScale; | 474 devIntervals[0] = draw.fIntervals[0] * args.fParallelScale; |
464 devIntervals[1] = args.fIntervals[1] * args.fParallelScale; | 475 devIntervals[1] = draw.fIntervals[1] * args.fParallelScale; |
465 SkScalar devPhase = args.fPhase * args.fParallelScale; | 476 SkScalar devPhase = draw.fPhase * args.fParallelScale; |
466 SkScalar strokeWidth = args.fSrcStrokeWidth * args.fPerpendicularSca
le; | 477 SkScalar strokeWidth = args.fSrcStrokeWidth * args.fPerpendicularSca
le; |
467 | 478 |
468 if ((strokeWidth < 1.f && useAA) || 0.f == strokeWidth) { | 479 if ((strokeWidth < 1.f && useAA) || 0.f == strokeWidth) { |
469 strokeWidth = 1.f; | 480 strokeWidth = 1.f; |
470 } | 481 } |
471 | 482 |
472 SkScalar halfDevStroke = strokeWidth * 0.5f; | 483 SkScalar halfDevStroke = strokeWidth * 0.5f; |
473 | 484 |
474 if (SkPaint::kSquare_Cap == cap && 0 != args.fSrcStrokeWidth) { | 485 if (SkPaint::kSquare_Cap == cap && 0 != args.fSrcStrokeWidth) { |
475 // add cap to on interval and remove from off interval | 486 // add cap to on interval and remove from off interval |
476 devIntervals[0] += strokeWidth; | 487 devIntervals[0] += strokeWidth; |
477 devIntervals[1] -= strokeWidth; | 488 devIntervals[1] -= strokeWidth; |
478 } | 489 } |
479 SkScalar startOffset = devIntervals[1] * 0.5f + devPhase; | 490 SkScalar startOffset = devIntervals[1] * 0.5f + devPhase; |
480 | 491 |
481 // For EdgeAA, we bloat in X & Y for both square and round caps. | 492 // For EdgeAA, we bloat in X & Y for both square and round caps. |
482 // For MSAA, we don't bloat at all for square caps, and bloat in Y o
nly for round caps. | 493 // For MSAA, we don't bloat at all for square caps, and bloat in Y o
nly for round caps. |
483 SkScalar devBloatX = this->aaMode() == kEdgeAA_DashAAMode ? 0.5f : 0
.0f; | 494 SkScalar devBloatX = this->aaMode() == kEdgeAA_DashAAMode ? 0.5f : 0
.0f; |
484 SkScalar devBloatY = (SkPaint::kRound_Cap == cap && this->aaMode() =
= kMSAA_DashAAMode) | 495 SkScalar devBloatY = (SkPaint::kRound_Cap == cap && this->aaMode() =
= kMSAA_DashAAMode) |
485 ? 0.5f : devBloatX; | 496 ? 0.5f : devBloatX; |
486 | 497 |
487 SkScalar bloatX = devBloatX / args.fParallelScale; | 498 SkScalar bloatX = devBloatX / args.fParallelScale; |
488 SkScalar bloatY = devBloatY / args.fPerpendicularScale; | 499 SkScalar bloatY = devBloatY / args.fPerpendicularScale; |
489 | 500 |
490 if (devIntervals[1] <= 0.f && useAA) { | 501 if (devIntervals[1] <= 0.f && useAA) { |
491 // Case when we end up drawing a solid AA rect | 502 // Case when we end up drawing a solid AA rect |
492 // Reset the start rect to draw this single solid rect | 503 // Reset the start rect to draw this single solid rect |
493 // but it requires to upload a new intervals uniform so we can m
imic | 504 // but it requires to upload a new intervals uniform so we can m
imic |
494 // one giant dash | 505 // one giant dash |
495 args.fPtsRot[0].fX -= hasStartRect ? startAdj : 0; | 506 draw.fPtsRot[0].fX -= hasStartRect ? startAdj : 0; |
496 args.fPtsRot[1].fX += hasEndRect ? endAdj : 0; | 507 draw.fPtsRot[1].fX += hasEndRect ? endAdj : 0; |
497 startRect.set(args.fPtsRot, 2); | 508 startRect.set(draw.fPtsRot, 2); |
498 startRect.outset(strokeAdj, halfSrcStroke); | 509 startRect.outset(strokeAdj, halfSrcStroke); |
499 hasStartRect = true; | 510 hasStartRect = true; |
500 hasEndRect = false; | 511 hasEndRect = false; |
501 lineDone = true; | 512 lineDone = true; |
502 | 513 |
503 SkPoint devicePts[2]; | 514 SkPoint devicePts[2]; |
504 args.fViewMatrix.mapPoints(devicePts, args.fPtsRot, 2); | 515 args.fViewMatrix.mapPoints(devicePts, draw.fPtsRot, 2); |
505 SkScalar lineLength = SkPoint::Distance(devicePts[0], devicePts[
1]); | 516 SkScalar lineLength = SkPoint::Distance(devicePts[0], devicePts[
1]); |
506 if (hasCap) { | 517 if (hasCap) { |
507 lineLength += 2.f * halfDevStroke; | 518 lineLength += 2.f * halfDevStroke; |
508 } | 519 } |
509 devIntervals[0] = lineLength; | 520 devIntervals[0] = lineLength; |
510 } | 521 } |
511 | 522 |
512 totalRectCount += !lineDone ? 1 : 0; | 523 totalRectCount += !lineDone ? 1 : 0; |
513 totalRectCount += hasStartRect ? 1 : 0; | 524 totalRectCount += hasStartRect ? 1 : 0; |
514 totalRectCount += hasEndRect ? 1 : 0; | 525 totalRectCount += hasEndRect ? 1 : 0; |
515 | 526 |
516 if (SkPaint::kRound_Cap == cap && 0 != args.fSrcStrokeWidth) { | 527 if (SkPaint::kRound_Cap == cap && 0 != args.fSrcStrokeWidth) { |
517 // need to adjust this for round caps to correctly set the dashP
os attrib on | 528 // need to adjust this for round caps to correctly set the dashP
os attrib on |
518 // vertices | 529 // vertices |
519 startOffset -= halfDevStroke; | 530 startOffset -= halfDevStroke; |
520 } | 531 } |
521 | 532 |
522 DashDraw& draw = draws.push_back(); | |
523 if (!lineDone) { | 533 if (!lineDone) { |
524 SkPoint devicePts[2]; | 534 SkPoint devicePts[2]; |
525 args.fViewMatrix.mapPoints(devicePts, args.fPtsRot, 2); | 535 args.fViewMatrix.mapPoints(devicePts, draw.fPtsRot, 2); |
526 draw.fLineLength = SkPoint::Distance(devicePts[0], devicePts[1])
; | 536 draw.fLineLength = SkPoint::Distance(devicePts[0], devicePts[1])
; |
527 if (hasCap) { | 537 if (hasCap) { |
528 draw.fLineLength += 2.f * halfDevStroke; | 538 draw.fLineLength += 2.f * halfDevStroke; |
529 } | 539 } |
530 | 540 |
531 bounds.set(args.fPtsRot[0].fX, args.fPtsRot[0].fY, | 541 bounds.set(draw.fPtsRot[0].fX, draw.fPtsRot[0].fY, |
532 args.fPtsRot[1].fX, args.fPtsRot[1].fY); | 542 draw.fPtsRot[1].fX, draw.fPtsRot[1].fY); |
533 bounds.outset(bloatX + strokeAdj, bloatY + halfSrcStroke); | 543 bounds.outset(bloatX + strokeAdj, bloatY + halfSrcStroke); |
534 } | 544 } |
535 | 545 |
536 if (hasStartRect) { | 546 if (hasStartRect) { |
537 SkASSERT(useAA); // so that we know bloatX and bloatY have been
set | 547 SkASSERT(useAA); // so that we know bloatX and bloatY have been
set |
538 startRect.outset(bloatX, bloatY); | 548 startRect.outset(bloatX, bloatY); |
539 } | 549 } |
540 | 550 |
541 if (hasEndRect) { | 551 if (hasEndRect) { |
542 SkASSERT(useAA); // so that we know bloatX and bloatY have been
set | 552 SkASSERT(useAA); // so that we know bloatX and bloatY have been
set |
(...skipping 16 matching lines...) Expand all Loading... |
559 | 569 |
560 QuadHelper helper; | 570 QuadHelper helper; |
561 void* vertices = helper.init(target, gp->getVertexStride(), totalRectCou
nt); | 571 void* vertices = helper.init(target, gp->getVertexStride(), totalRectCou
nt); |
562 if (!vertices) { | 572 if (!vertices) { |
563 return; | 573 return; |
564 } | 574 } |
565 | 575 |
566 int curVIdx = 0; | 576 int curVIdx = 0; |
567 int rectIndex = 0; | 577 int rectIndex = 0; |
568 for (int i = 0; i < instanceCount; i++) { | 578 for (int i = 0; i < instanceCount; i++) { |
569 Geometry& geom = fGeoData[i]; | 579 const Geometry& geom = fGeoData[i]; |
570 | 580 |
571 if (!draws[i].fLineDone) { | 581 if (!draws[i].fLineDone) { |
572 if (fullDash) { | 582 if (fullDash) { |
573 setup_dashed_rect(rects[rectIndex], vertices, curVIdx, geom.
fSrcRotInv, | 583 setup_dashed_rect(rects[rectIndex], vertices, curVIdx, geom.
fSrcRotInv, |
574 draws[i].fStartOffset, draws[i].fDevBloatX
, | 584 draws[i].fStartOffset, draws[i].fDevBloatX
, |
575 draws[i].fDevBloatY, draws[i].fLineLength, | 585 draws[i].fDevBloatY, draws[i].fLineLength, |
576 draws[i].fHalfDevStroke, geom.fIntervals[0
], | 586 draws[i].fHalfDevStroke, draws[i].fInterva
ls[0], |
577 geom.fIntervals[1], draws[i].fStrokeWidth, | 587 draws[i].fIntervals[1], draws[i].fStrokeWi
dth, |
578 capType, gp->getVertexStride()); | 588 capType, gp->getVertexStride()); |
579 } else { | 589 } else { |
580 SkPoint* verts = reinterpret_cast<SkPoint*>(vertices); | 590 SkPoint* verts = reinterpret_cast<SkPoint*>(vertices); |
581 SkASSERT(gp->getVertexStride() == sizeof(SkPoint)); | 591 SkASSERT(gp->getVertexStride() == sizeof(SkPoint)); |
582 setup_dashed_rect_pos(rects[rectIndex], curVIdx, geom.fSrcRo
tInv, verts); | 592 setup_dashed_rect_pos(rects[rectIndex], curVIdx, geom.fSrcRo
tInv, verts); |
583 } | 593 } |
584 curVIdx += 4; | 594 curVIdx += 4; |
585 } | 595 } |
586 rectIndex++; | 596 rectIndex++; |
587 | 597 |
588 if (draws[i].fHasStartRect) { | 598 if (draws[i].fHasStartRect) { |
589 if (fullDash) { | 599 if (fullDash) { |
590 setup_dashed_rect(rects[rectIndex], vertices, curVIdx, geom.
fSrcRotInv, | 600 setup_dashed_rect(rects[rectIndex], vertices, curVIdx, geom.
fSrcRotInv, |
591 draws[i].fStartOffset, draws[i].fDevBloatX
, | 601 draws[i].fStartOffset, draws[i].fDevBloatX
, |
592 draws[i].fDevBloatY, geom.fIntervals[0], | 602 draws[i].fDevBloatY, draws[i].fIntervals[0
], |
593 draws[i].fHalfDevStroke, geom.fIntervals[0
], | 603 draws[i].fHalfDevStroke, draws[i].fInterva
ls[0], |
594 geom.fIntervals[1], draws[i].fStrokeWidth,
capType, | 604 draws[i].fIntervals[1], draws[i].fStrokeWi
dth, capType, |
595 gp->getVertexStride()); | 605 gp->getVertexStride()); |
596 } else { | 606 } else { |
597 SkPoint* verts = reinterpret_cast<SkPoint*>(vertices); | 607 SkPoint* verts = reinterpret_cast<SkPoint*>(vertices); |
598 SkASSERT(gp->getVertexStride() == sizeof(SkPoint)); | 608 SkASSERT(gp->getVertexStride() == sizeof(SkPoint)); |
599 setup_dashed_rect_pos(rects[rectIndex], curVIdx, geom.fSrcRo
tInv, verts); | 609 setup_dashed_rect_pos(rects[rectIndex], curVIdx, geom.fSrcRo
tInv, verts); |
600 } | 610 } |
601 curVIdx += 4; | 611 curVIdx += 4; |
602 } | 612 } |
603 rectIndex++; | 613 rectIndex++; |
604 | 614 |
605 if (draws[i].fHasEndRect) { | 615 if (draws[i].fHasEndRect) { |
606 if (fullDash) { | 616 if (fullDash) { |
607 setup_dashed_rect(rects[rectIndex], vertices, curVIdx, geom.
fSrcRotInv, | 617 setup_dashed_rect(rects[rectIndex], vertices, curVIdx, geom.
fSrcRotInv, |
608 draws[i].fStartOffset, draws[i].fDevBloatX
, | 618 draws[i].fStartOffset, draws[i].fDevBloatX
, |
609 draws[i].fDevBloatY, geom.fIntervals[0], | 619 draws[i].fDevBloatY, draws[i].fIntervals[0
], |
610 draws[i].fHalfDevStroke, geom.fIntervals[0
], | 620 draws[i].fHalfDevStroke, draws[i].fInterva
ls[0], |
611 geom.fIntervals[1], draws[i].fStrokeWidth,
capType, | 621 draws[i].fIntervals[1], draws[i].fStrokeWi
dth, capType, |
612 gp->getVertexStride()); | 622 gp->getVertexStride()); |
613 } else { | 623 } else { |
614 SkPoint* verts = reinterpret_cast<SkPoint*>(vertices); | 624 SkPoint* verts = reinterpret_cast<SkPoint*>(vertices); |
615 SkASSERT(gp->getVertexStride() == sizeof(SkPoint)); | 625 SkASSERT(gp->getVertexStride() == sizeof(SkPoint)); |
616 setup_dashed_rect_pos(rects[rectIndex], curVIdx, geom.fSrcRo
tInv, verts); | 626 setup_dashed_rect_pos(rects[rectIndex], curVIdx, geom.fSrcRo
tInv, verts); |
617 } | 627 } |
618 curVIdx += 4; | 628 curVIdx += 4; |
619 } | 629 } |
620 rectIndex++; | 630 rectIndex++; |
621 } | 631 } |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 info.fIntervals = intervals; | 1307 info.fIntervals = intervals; |
1298 info.fCount = 2; | 1308 info.fCount = 2; |
1299 info.fPhase = phase; | 1309 info.fPhase = phase; |
1300 SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info); | 1310 SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info); |
1301 SkASSERT(success); | 1311 SkASSERT(success); |
1302 | 1312 |
1303 return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT); | 1313 return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT); |
1304 } | 1314 } |
1305 | 1315 |
1306 #endif | 1316 #endif |
OLD | NEW |