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