OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" |
9 | 9 |
10 #include "effects/GrBicubicEffect.h" | 10 #include "effects/GrBicubicEffect.h" |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 void SkGpuDevice::clear(SkColor color) { | 391 void SkGpuDevice::clear(SkColor color) { |
392 SkIRect rect = SkIRect::MakeWH(this->width(), this->height()); | 392 SkIRect rect = SkIRect::MakeWH(this->width(), this->height()); |
393 fContext->clear(&rect, SkColor2GrColor(color), true, fRenderTarget); | 393 fContext->clear(&rect, SkColor2GrColor(color), true, fRenderTarget); |
394 fNeedClear = false; | 394 fNeedClear = false; |
395 } | 395 } |
396 | 396 |
397 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { | 397 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { |
398 CHECK_SHOULD_DRAW(draw, false); | 398 CHECK_SHOULD_DRAW(draw, false); |
399 | 399 |
400 GrPaint grPaint; | 400 GrPaint grPaint; |
401 SkPaint2GrPaintShader(this, paint, true, &grPaint); | 401 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |
402 | 402 |
403 fContext->drawPaint(grPaint); | 403 fContext->drawPaint(grPaint); |
404 } | 404 } |
405 | 405 |
406 // must be in SkCanvas::PointMode order | 406 // must be in SkCanvas::PointMode order |
407 static const GrPrimitiveType gPointMode2PrimtiveType[] = { | 407 static const GrPrimitiveType gPointMode2PrimtiveType[] = { |
408 kPoints_GrPrimitiveType, | 408 kPoints_GrPrimitiveType, |
409 kLines_GrPrimitiveType, | 409 kLines_GrPrimitiveType, |
410 kLineStrip_GrPrimitiveType | 410 kLineStrip_GrPrimitiveType |
411 }; | 411 }; |
412 | 412 |
413 void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, | 413 void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, |
414 size_t count, const SkPoint pts[], const SkPaint& p
aint) { | 414 size_t count, const SkPoint pts[], const SkPaint& p
aint) { |
415 CHECK_FOR_ANNOTATION(paint); | 415 CHECK_FOR_ANNOTATION(paint); |
416 CHECK_SHOULD_DRAW(draw, false); | 416 CHECK_SHOULD_DRAW(draw, false); |
417 | 417 |
418 SkScalar width = paint.getStrokeWidth(); | 418 SkScalar width = paint.getStrokeWidth(); |
419 if (width < 0) { | 419 if (width < 0) { |
420 return; | 420 return; |
421 } | 421 } |
422 | 422 |
423 if (paint.getPathEffect() && 2 == count && SkCanvas::kLines_PointMode == mod
e) { | 423 if (paint.getPathEffect() && 2 == count && SkCanvas::kLines_PointMode == mod
e) { |
424 if (GrDashingEffect::DrawDashLine(pts, paint, this)) { | 424 if (GrDashingEffect::DrawDashLine(pts, paint, this->context())) { |
425 return; | 425 return; |
426 } | 426 } |
427 } | 427 } |
428 | 428 |
429 // we only handle hairlines and paints without path effects or mask filters, | 429 // we only handle hairlines and paints without path effects or mask filters, |
430 // else we let the SkDraw call our drawPath() | 430 // else we let the SkDraw call our drawPath() |
431 if (width > 0 || paint.getPathEffect() || paint.getMaskFilter()) { | 431 if (width > 0 || paint.getPathEffect() || paint.getMaskFilter()) { |
432 draw.drawPoints(mode, count, pts, paint, true); | 432 draw.drawPoints(mode, count, pts, paint, true); |
433 return; | 433 return; |
434 } | 434 } |
435 | 435 |
436 GrPaint grPaint; | 436 GrPaint grPaint; |
437 SkPaint2GrPaintShader(this, paint, true, &grPaint); | 437 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |
438 | 438 |
439 fContext->drawVertices(grPaint, | 439 fContext->drawVertices(grPaint, |
440 gPointMode2PrimtiveType[mode], | 440 gPointMode2PrimtiveType[mode], |
441 SkToS32(count), | 441 SkToS32(count), |
442 (SkPoint*)pts, | 442 (SkPoint*)pts, |
443 NULL, | 443 NULL, |
444 NULL, | 444 NULL, |
445 NULL, | 445 NULL, |
446 0); | 446 0); |
447 } | 447 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 } | 484 } |
485 | 485 |
486 if (usePath) { | 486 if (usePath) { |
487 SkPath path; | 487 SkPath path; |
488 path.addRect(rect); | 488 path.addRect(rect); |
489 this->drawPath(draw, path, paint, NULL, true); | 489 this->drawPath(draw, path, paint, NULL, true); |
490 return; | 490 return; |
491 } | 491 } |
492 | 492 |
493 GrPaint grPaint; | 493 GrPaint grPaint; |
494 SkPaint2GrPaintShader(this, paint, true, &grPaint); | 494 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |
495 | 495 |
496 if (!doStroke) { | 496 if (!doStroke) { |
497 fContext->drawRect(grPaint, rect); | 497 fContext->drawRect(grPaint, rect); |
498 } else { | 498 } else { |
499 SkStrokeRec stroke(paint); | 499 SkStrokeRec stroke(paint); |
500 fContext->drawRect(grPaint, rect, &stroke); | 500 fContext->drawRect(grPaint, rect, &stroke); |
501 } | 501 } |
502 } | 502 } |
503 | 503 |
504 /////////////////////////////////////////////////////////////////////////////// | 504 /////////////////////////////////////////////////////////////////////////////// |
505 | 505 |
506 void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect, | 506 void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect, |
507 const SkPaint& paint) { | 507 const SkPaint& paint) { |
508 CHECK_FOR_ANNOTATION(paint); | 508 CHECK_FOR_ANNOTATION(paint); |
509 CHECK_SHOULD_DRAW(draw, false); | 509 CHECK_SHOULD_DRAW(draw, false); |
510 | 510 |
511 GrPaint grPaint; | 511 GrPaint grPaint; |
512 SkPaint2GrPaintShader(this, paint, true, &grPaint); | 512 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |
513 | 513 |
514 SkStrokeRec stroke(paint); | 514 SkStrokeRec stroke(paint); |
515 if (paint.getMaskFilter()) { | 515 if (paint.getMaskFilter()) { |
516 // try to hit the fast path for drawing filtered round rects | 516 // try to hit the fast path for drawing filtered round rects |
517 | 517 |
518 SkRRect devRRect; | 518 SkRRect devRRect; |
519 if (rect.transform(fContext->getMatrix(), &devRRect)) { | 519 if (rect.transform(fContext->getMatrix(), &devRRect)) { |
520 if (devRRect.allCornersCircular()) { | 520 if (devRRect.allCornersCircular()) { |
521 SkRect maskRect; | 521 SkRect maskRect; |
522 if (paint.getMaskFilter()->canFilterMaskGPU(devRRect.rect(), | 522 if (paint.getMaskFilter()->canFilterMaskGPU(devRRect.rect(), |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 | 556 |
557 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, | 557 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, |
558 const SkRRect& inner, const SkPaint& paint) { | 558 const SkRRect& inner, const SkPaint& paint) { |
559 SkStrokeRec stroke(paint); | 559 SkStrokeRec stroke(paint); |
560 if (stroke.isFillStyle()) { | 560 if (stroke.isFillStyle()) { |
561 | 561 |
562 CHECK_FOR_ANNOTATION(paint); | 562 CHECK_FOR_ANNOTATION(paint); |
563 CHECK_SHOULD_DRAW(draw, false); | 563 CHECK_SHOULD_DRAW(draw, false); |
564 | 564 |
565 GrPaint grPaint; | 565 GrPaint grPaint; |
566 SkPaint2GrPaintShader(this, paint, true, &grPaint); | 566 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |
567 | 567 |
568 if (NULL == paint.getMaskFilter() && NULL == paint.getPathEffect()) { | 568 if (NULL == paint.getMaskFilter() && NULL == paint.getPathEffect()) { |
569 fContext->drawDRRect(grPaint, outer, inner); | 569 fContext->drawDRRect(grPaint, outer, inner); |
570 return; | 570 return; |
571 } | 571 } |
572 } | 572 } |
573 | 573 |
574 SkPath path; | 574 SkPath path; |
575 path.addRRect(outer); | 575 path.addRRect(outer); |
576 path.addRRect(inner); | 576 path.addRRect(inner); |
(...skipping 17 matching lines...) Expand all Loading... |
594 } | 594 } |
595 | 595 |
596 if (usePath) { | 596 if (usePath) { |
597 SkPath path; | 597 SkPath path; |
598 path.addOval(oval); | 598 path.addOval(oval); |
599 this->drawPath(draw, path, paint, NULL, true); | 599 this->drawPath(draw, path, paint, NULL, true); |
600 return; | 600 return; |
601 } | 601 } |
602 | 602 |
603 GrPaint grPaint; | 603 GrPaint grPaint; |
604 SkPaint2GrPaintShader(this, paint, true, &grPaint); | 604 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |
605 SkStrokeRec stroke(paint); | 605 SkStrokeRec stroke(paint); |
606 | 606 |
607 fContext->drawOval(grPaint, oval, stroke); | 607 fContext->drawOval(grPaint, oval, stroke); |
608 } | 608 } |
609 | 609 |
610 #include "SkMaskFilter.h" | 610 #include "SkMaskFilter.h" |
611 #include "SkBounder.h" | 611 #include "SkBounder.h" |
612 | 612 |
613 /////////////////////////////////////////////////////////////////////////////// | 613 /////////////////////////////////////////////////////////////////////////////// |
614 | 614 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 | 745 |
746 }; | 746 }; |
747 | 747 |
748 void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath, | 748 void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath, |
749 const SkPaint& paint, const SkMatrix* prePathMatrix, | 749 const SkPaint& paint, const SkMatrix* prePathMatrix, |
750 bool pathIsMutable) { | 750 bool pathIsMutable) { |
751 CHECK_FOR_ANNOTATION(paint); | 751 CHECK_FOR_ANNOTATION(paint); |
752 CHECK_SHOULD_DRAW(draw, false); | 752 CHECK_SHOULD_DRAW(draw, false); |
753 | 753 |
754 GrPaint grPaint; | 754 GrPaint grPaint; |
755 SkPaint2GrPaintShader(this, paint, true, &grPaint); | 755 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |
756 | 756 |
757 // If we have a prematrix, apply it to the path, optimizing for the case | 757 // If we have a prematrix, apply it to the path, optimizing for the case |
758 // where the original path can in fact be modified in place (even though | 758 // where the original path can in fact be modified in place (even though |
759 // its parameter type is const). | 759 // its parameter type is const). |
760 SkPath* pathPtr = const_cast<SkPath*>(&origSrcPath); | 760 SkPath* pathPtr = const_cast<SkPath*>(&origSrcPath); |
761 SkTLazy<SkPath> tmpPath; | 761 SkTLazy<SkPath> tmpPath; |
762 SkTLazy<SkPath> effectPath; | 762 SkTLazy<SkPath> effectPath; |
763 | 763 |
764 if (prePathMatrix) { | 764 if (prePathMatrix) { |
765 SkPath* result = pathPtr; | 765 SkPath* result = pathPtr; |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1393 effect.reset(GrBicubicEffect::Create(texture, SkMatrix::I(), tileModes))
; | 1393 effect.reset(GrBicubicEffect::Create(texture, SkMatrix::I(), tileModes))
; |
1394 } else { | 1394 } else { |
1395 effect.reset(GrSimpleTextureEffect::Create(texture, SkMatrix::I(), param
s)); | 1395 effect.reset(GrSimpleTextureEffect::Create(texture, SkMatrix::I(), param
s)); |
1396 } | 1396 } |
1397 | 1397 |
1398 // Construct a GrPaint by setting the bitmap texture as the first effect and
then configuring | 1398 // Construct a GrPaint by setting the bitmap texture as the first effect and
then configuring |
1399 // the rest from the SkPaint. | 1399 // the rest from the SkPaint. |
1400 GrPaint grPaint; | 1400 GrPaint grPaint; |
1401 grPaint.addColorEffect(effect); | 1401 grPaint.addColorEffect(effect); |
1402 bool alphaOnly = !(SkBitmap::kA8_Config == bitmap.config()); | 1402 bool alphaOnly = !(SkBitmap::kA8_Config == bitmap.config()); |
1403 SkPaint2GrPaintNoShader(this, paint, alphaOnly, false, &grPaint); | 1403 SkPaint2GrPaintNoShader(this->context(), paint, alphaOnly, false, &grPaint); |
1404 | 1404 |
1405 fContext->drawRectToRect(grPaint, dstRect, paintRect, NULL); | 1405 fContext->drawRectToRect(grPaint, dstRect, paintRect, NULL); |
1406 } | 1406 } |
1407 | 1407 |
1408 static bool filter_texture(SkBaseDevice* device, GrContext* context, | 1408 static bool filter_texture(SkBaseDevice* device, GrContext* context, |
1409 GrTexture* texture, const SkImageFilter* filter, | 1409 GrTexture* texture, const SkImageFilter* filter, |
1410 int w, int h, const SkImageFilter::Context& ctx, | 1410 int w, int h, const SkImageFilter::Context& ctx, |
1411 SkBitmap* result, SkIPoint* offset) { | 1411 SkBitmap* result, SkIPoint* offset) { |
1412 SkASSERT(filter); | 1412 SkASSERT(filter); |
1413 SkDeviceImageFilterProxy proxy(device); | 1413 SkDeviceImageFilterProxy proxy(device); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 left += offset.x(); | 1459 left += offset.x(); |
1460 top += offset.y(); | 1460 top += offset.y(); |
1461 } else { | 1461 } else { |
1462 return; | 1462 return; |
1463 } | 1463 } |
1464 } | 1464 } |
1465 | 1465 |
1466 GrPaint grPaint; | 1466 GrPaint grPaint; |
1467 grPaint.addColorTextureEffect(texture, SkMatrix::I()); | 1467 grPaint.addColorTextureEffect(texture, SkMatrix::I()); |
1468 | 1468 |
1469 SkPaint2GrPaintNoShader(this, paint, true, false, &grPaint); | 1469 SkPaint2GrPaintNoShader(this->context(), paint, true, false, &grPaint); |
1470 | 1470 |
1471 fContext->drawRectToRect(grPaint, | 1471 fContext->drawRectToRect(grPaint, |
1472 SkRect::MakeXYWH(SkIntToScalar(left), | 1472 SkRect::MakeXYWH(SkIntToScalar(left), |
1473 SkIntToScalar(top), | 1473 SkIntToScalar(top), |
1474 SkIntToScalar(w), | 1474 SkIntToScalar(w), |
1475 SkIntToScalar(h)), | 1475 SkIntToScalar(h)), |
1476 SkRect::MakeXYWH(0, | 1476 SkRect::MakeXYWH(0, |
1477 0, | 1477 0, |
1478 SK_Scalar1 * w / texture->width(), | 1478 SK_Scalar1 * w / texture->width(), |
1479 SK_Scalar1 * h / texture->height()
)); | 1479 SK_Scalar1 * h / texture->height()
)); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1567 x += offset.fX; | 1567 x += offset.fX; |
1568 y += offset.fY; | 1568 y += offset.fY; |
1569 } else { | 1569 } else { |
1570 return; | 1570 return; |
1571 } | 1571 } |
1572 } | 1572 } |
1573 | 1573 |
1574 GrPaint grPaint; | 1574 GrPaint grPaint; |
1575 grPaint.addColorTextureEffect(devTex, SkMatrix::I()); | 1575 grPaint.addColorTextureEffect(devTex, SkMatrix::I()); |
1576 | 1576 |
1577 SkPaint2GrPaintNoShader(this, paint, true, false, &grPaint); | 1577 SkPaint2GrPaintNoShader(this->context(), paint, true, false, &grPaint); |
1578 | 1578 |
1579 SkRect dstRect = SkRect::MakeXYWH(SkIntToScalar(x), | 1579 SkRect dstRect = SkRect::MakeXYWH(SkIntToScalar(x), |
1580 SkIntToScalar(y), | 1580 SkIntToScalar(y), |
1581 SkIntToScalar(w), | 1581 SkIntToScalar(w), |
1582 SkIntToScalar(h)); | 1582 SkIntToScalar(h)); |
1583 | 1583 |
1584 // The device being drawn may not fill up its texture (e.g. saveLayer uses a
pproximate | 1584 // The device being drawn may not fill up its texture (e.g. saveLayer uses a
pproximate |
1585 // scratch texture). | 1585 // scratch texture). |
1586 SkRect srcRect = SkRect::MakeWH(SK_Scalar1 * w / devTex->width(), | 1586 SkRect srcRect = SkRect::MakeWH(SK_Scalar1 * w / devTex->width(), |
1587 SK_Scalar1 * h / devTex->height()); | 1587 SK_Scalar1 * h / devTex->height()); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1628 int vertexCount, const SkPoint vertices[], | 1628 int vertexCount, const SkPoint vertices[], |
1629 const SkPoint texs[], const SkColor colors[], | 1629 const SkPoint texs[], const SkColor colors[], |
1630 SkXfermode* xmode, | 1630 SkXfermode* xmode, |
1631 const uint16_t indices[], int indexCount, | 1631 const uint16_t indices[], int indexCount, |
1632 const SkPaint& paint) { | 1632 const SkPaint& paint) { |
1633 CHECK_SHOULD_DRAW(draw, false); | 1633 CHECK_SHOULD_DRAW(draw, false); |
1634 | 1634 |
1635 GrPaint grPaint; | 1635 GrPaint grPaint; |
1636 // we ignore the shader if texs is null. | 1636 // we ignore the shader if texs is null. |
1637 if (NULL == texs) { | 1637 if (NULL == texs) { |
1638 SkPaint2GrPaintNoShader(this, paint, false, NULL == colors, &grPaint); | 1638 SkPaint2GrPaintNoShader(this->context(), paint, false, NULL == colors, &
grPaint); |
1639 } else { | 1639 } else { |
1640 SkPaint2GrPaintShader(this, paint, NULL == colors, &grPaint); | 1640 SkPaint2GrPaintShader(this->context(), paint, NULL == colors, &grPaint); |
1641 } | 1641 } |
1642 | 1642 |
1643 if (NULL != xmode && NULL != texs && NULL != colors) { | 1643 if (NULL != xmode && NULL != texs && NULL != colors) { |
1644 if (!SkXfermode::IsMode(xmode, SkXfermode::kModulate_Mode)) { | 1644 if (!SkXfermode::IsMode(xmode, SkXfermode::kModulate_Mode)) { |
1645 SkDebugf("Unsupported vertex-color/texture xfer mode.\n"); | 1645 SkDebugf("Unsupported vertex-color/texture xfer mode.\n"); |
1646 #if 0 | 1646 #if 0 |
1647 return | 1647 return |
1648 #endif | 1648 #endif |
1649 } | 1649 } |
1650 } | 1650 } |
(...skipping 19 matching lines...) Expand all Loading... |
1670 | 1670 |
1671 /////////////////////////////////////////////////////////////////////////////// | 1671 /////////////////////////////////////////////////////////////////////////////// |
1672 | 1672 |
1673 void SkGpuDevice::drawText(const SkDraw& draw, const void* text, | 1673 void SkGpuDevice::drawText(const SkDraw& draw, const void* text, |
1674 size_t byteLength, SkScalar x, SkScalar y, | 1674 size_t byteLength, SkScalar x, SkScalar y, |
1675 const SkPaint& paint) { | 1675 const SkPaint& paint) { |
1676 CHECK_SHOULD_DRAW(draw, false); | 1676 CHECK_SHOULD_DRAW(draw, false); |
1677 | 1677 |
1678 if (fMainTextContext->canDraw(paint)) { | 1678 if (fMainTextContext->canDraw(paint)) { |
1679 GrPaint grPaint; | 1679 GrPaint grPaint; |
1680 SkPaint2GrPaintShader(this, paint, true, &grPaint); | 1680 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |
1681 | 1681 |
1682 SkDEBUGCODE(this->validate();) | 1682 SkDEBUGCODE(this->validate();) |
1683 | 1683 |
1684 fMainTextContext->drawText(grPaint, paint, (const char *)text, byteLengt
h, x, y); | 1684 fMainTextContext->drawText(grPaint, paint, (const char *)text, byteLengt
h, x, y); |
1685 } else if (fFallbackTextContext && fFallbackTextContext->canDraw(paint)) { | 1685 } else if (fFallbackTextContext && fFallbackTextContext->canDraw(paint)) { |
1686 GrPaint grPaint; | 1686 GrPaint grPaint; |
1687 SkPaint2GrPaintShader(this, paint, true, &grPaint); | 1687 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |
1688 | 1688 |
1689 SkDEBUGCODE(this->validate();) | 1689 SkDEBUGCODE(this->validate();) |
1690 | 1690 |
1691 fFallbackTextContext->drawText(grPaint, paint, (const char *)text, byteL
ength, x, y); | 1691 fFallbackTextContext->drawText(grPaint, paint, (const char *)text, byteL
ength, x, y); |
1692 } else { | 1692 } else { |
1693 // this guy will just call our drawPath() | 1693 // this guy will just call our drawPath() |
1694 draw.drawText_asPaths((const char*)text, byteLength, x, y, paint); | 1694 draw.drawText_asPaths((const char*)text, byteLength, x, y, paint); |
1695 } | 1695 } |
1696 } | 1696 } |
1697 | 1697 |
1698 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, | 1698 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, |
1699 size_t byteLength, const SkScalar pos[], | 1699 size_t byteLength, const SkScalar pos[], |
1700 SkScalar constY, int scalarsPerPos, | 1700 SkScalar constY, int scalarsPerPos, |
1701 const SkPaint& paint) { | 1701 const SkPaint& paint) { |
1702 CHECK_SHOULD_DRAW(draw, false); | 1702 CHECK_SHOULD_DRAW(draw, false); |
1703 | 1703 |
1704 if (fMainTextContext->canDraw(paint)) { | 1704 if (fMainTextContext->canDraw(paint)) { |
1705 GrPaint grPaint; | 1705 GrPaint grPaint; |
1706 SkPaint2GrPaintShader(this, paint, true, &grPaint); | 1706 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |
1707 | 1707 |
1708 SkDEBUGCODE(this->validate();) | 1708 SkDEBUGCODE(this->validate();) |
1709 | 1709 |
1710 fMainTextContext->drawPosText(grPaint, paint, (const char *)text, byteLe
ngth, pos, | 1710 fMainTextContext->drawPosText(grPaint, paint, (const char *)text, byteLe
ngth, pos, |
1711 constY, scalarsPerPos); | 1711 constY, scalarsPerPos); |
1712 } else if (fFallbackTextContext && fFallbackTextContext->canDraw(paint)) { | 1712 } else if (fFallbackTextContext && fFallbackTextContext->canDraw(paint)) { |
1713 GrPaint grPaint; | 1713 GrPaint grPaint; |
1714 SkPaint2GrPaintShader(this, paint, true, &grPaint); | 1714 SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); |
1715 | 1715 |
1716 SkDEBUGCODE(this->validate();) | 1716 SkDEBUGCODE(this->validate();) |
1717 | 1717 |
1718 fFallbackTextContext->drawPosText(grPaint, paint, (const char *)text, by
teLength, pos, | 1718 fFallbackTextContext->drawPosText(grPaint, paint, (const char *)text, by
teLength, pos, |
1719 constY, scalarsPerPos); | 1719 constY, scalarsPerPos); |
1720 } else { | 1720 } else { |
1721 draw.drawPosText_asPaths((const char*)text, byteLength, pos, constY, | 1721 draw.drawPosText_asPaths((const char*)text, byteLength, pos, constY, |
1722 scalarsPerPos, paint); | 1722 scalarsPerPos, paint); |
1723 } | 1723 } |
1724 } | 1724 } |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1990 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict
ure, i); | 1990 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict
ure, i); |
1991 | 1991 |
1992 if (NULL != layer->getTexture()) { | 1992 if (NULL != layer->getTexture()) { |
1993 fContext->unlockScratchTexture(layer->getTexture()); | 1993 fContext->unlockScratchTexture(layer->getTexture()); |
1994 layer->setTexture(NULL); | 1994 layer->setTexture(NULL); |
1995 } | 1995 } |
1996 } | 1996 } |
1997 | 1997 |
1998 return true; | 1998 return true; |
1999 } | 1999 } |
OLD | NEW |