Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 1359833004: Stop supporting HW dither (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: minor Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrTextContext.cpp ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrBlurUtils.h" 10 #include "GrBlurUtils.h"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 fDrawContext.reset(fRenderTarget->getContext()->drawContext(&this->surfacePr ops())); 376 fDrawContext.reset(fRenderTarget->getContext()->drawContext(&this->surfacePr ops()));
377 } 377 }
378 378
379 /////////////////////////////////////////////////////////////////////////////// 379 ///////////////////////////////////////////////////////////////////////////////
380 380
381 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { 381 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
382 CHECK_SHOULD_DRAW(draw); 382 CHECK_SHOULD_DRAW(draw);
383 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPaint", fContext); 383 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPaint", fContext);
384 384
385 GrPaint grPaint; 385 GrPaint grPaint;
386 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t rue, &grPaint)) { 386 if (!SkPaint2GrPaint(this->context(), paint, *draw.fMatrix, true, &grPaint)) {
387 return; 387 return;
388 } 388 }
389 389
390 fDrawContext->drawPaint(fRenderTarget, fClip, grPaint, *draw.fMatrix); 390 fDrawContext->drawPaint(fRenderTarget, fClip, grPaint, *draw.fMatrix);
391 } 391 }
392 392
393 // must be in SkCanvas::PointMode order 393 // must be in SkCanvas::PointMode order
394 static const GrPrimitiveType gPointMode2PrimtiveType[] = { 394 static const GrPrimitiveType gPointMode2PrimtiveType[] = {
395 kPoints_GrPrimitiveType, 395 kPoints_GrPrimitiveType,
396 kLines_GrPrimitiveType, 396 kLines_GrPrimitiveType,
(...skipping 28 matching lines...) Expand all
425 CHECK_SHOULD_DRAW(draw); 425 CHECK_SHOULD_DRAW(draw);
426 426
427 SkScalar width = paint.getStrokeWidth(); 427 SkScalar width = paint.getStrokeWidth();
428 if (width < 0) { 428 if (width < 0) {
429 return; 429 return;
430 } 430 }
431 431
432 if (paint.getPathEffect() && 2 == count && SkCanvas::kLines_PointMode == mod e) { 432 if (paint.getPathEffect() && 2 == count && SkCanvas::kLines_PointMode == mod e) {
433 GrStrokeInfo strokeInfo(paint, SkPaint::kStroke_Style); 433 GrStrokeInfo strokeInfo(paint, SkPaint::kStroke_Style);
434 GrPaint grPaint; 434 GrPaint grPaint;
435 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatri x, true, 435 if (!SkPaint2GrPaint(this->context(), paint, *draw.fMatrix, true, &grPai nt)) {
436 &grPaint)) {
437 return; 436 return;
438 } 437 }
439 SkPath path; 438 SkPath path;
440 path.setIsVolatile(true); 439 path.setIsVolatile(true);
441 path.moveTo(pts[0]); 440 path.moveTo(pts[0]);
442 path.lineTo(pts[1]); 441 path.lineTo(pts[1]);
443 fDrawContext->drawPath(fRenderTarget, fClip, grPaint, *draw.fMatrix, pat h, strokeInfo); 442 fDrawContext->drawPath(fRenderTarget, fClip, grPaint, *draw.fMatrix, pat h, strokeInfo);
444 return; 443 return;
445 } 444 }
446 445
447 // we only handle non-antialiased hairlines and paints without path effects or mask filters, 446 // we only handle non-antialiased hairlines and paints without path effects or mask filters,
448 // else we let the SkDraw call our drawPath() 447 // else we let the SkDraw call our drawPath()
449 if (width > 0 || paint.getPathEffect() || paint.getMaskFilter() || 448 if (width > 0 || paint.getPathEffect() || paint.getMaskFilter() ||
450 (paint.isAntiAlias() && needs_antialiasing(mode, count, pts))) { 449 (paint.isAntiAlias() && needs_antialiasing(mode, count, pts))) {
451 draw.drawPoints(mode, count, pts, paint, true); 450 draw.drawPoints(mode, count, pts, paint, true);
452 return; 451 return;
453 } 452 }
454 453
455 GrPaint grPaint; 454 GrPaint grPaint;
456 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t rue, &grPaint)) { 455 if (!SkPaint2GrPaint(this->context(), paint, *draw.fMatrix, true, &grPaint)) {
457 return; 456 return;
458 } 457 }
459 458
460 fDrawContext->drawVertices(fRenderTarget, 459 fDrawContext->drawVertices(fRenderTarget,
461 fClip, 460 fClip,
462 grPaint, 461 grPaint,
463 *draw.fMatrix, 462 *draw.fMatrix,
464 gPointMode2PrimtiveType[mode], 463 gPointMode2PrimtiveType[mode],
465 SkToS32(count), 464 SkToS32(count),
466 (SkPoint*)pts, 465 (SkPoint*)pts,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 508
510 if (usePath) { 509 if (usePath) {
511 SkPath path; 510 SkPath path;
512 path.setIsVolatile(true); 511 path.setIsVolatile(true);
513 path.addRect(rect); 512 path.addRect(rect);
514 this->drawPath(draw, path, paint, nullptr, true); 513 this->drawPath(draw, path, paint, nullptr, true);
515 return; 514 return;
516 } 515 }
517 516
518 GrPaint grPaint; 517 GrPaint grPaint;
519 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t rue, &grPaint)) { 518 if (!SkPaint2GrPaint(this->context(), paint, *draw.fMatrix, true, &grPaint)) {
520 return; 519 return;
521 } 520 }
522 521
523 fDrawContext->drawRect(fRenderTarget, fClip, grPaint, *draw.fMatrix, rect, & strokeInfo); 522 fDrawContext->drawRect(fRenderTarget, fClip, grPaint, *draw.fMatrix, rect, & strokeInfo);
524 } 523 }
525 524
526 /////////////////////////////////////////////////////////////////////////////// 525 ///////////////////////////////////////////////////////////////////////////////
527 526
528 void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect, 527 void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect,
529 const SkPaint& paint) { 528 const SkPaint& paint) {
530 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawRRect", fContext); 529 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawRRect", fContext);
531 CHECK_FOR_ANNOTATION(paint); 530 CHECK_FOR_ANNOTATION(paint);
532 CHECK_SHOULD_DRAW(draw); 531 CHECK_SHOULD_DRAW(draw);
533 532
534 GrPaint grPaint; 533 GrPaint grPaint;
535 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t rue, &grPaint)) { 534 if (!SkPaint2GrPaint(this->context(), paint, *draw.fMatrix, true, &grPaint)) {
536 return; 535 return;
537 } 536 }
538 537
539 GrStrokeInfo strokeInfo(paint); 538 GrStrokeInfo strokeInfo(paint);
540 if (paint.getMaskFilter()) { 539 if (paint.getMaskFilter()) {
541 // try to hit the fast path for drawing filtered round rects 540 // try to hit the fast path for drawing filtered round rects
542 541
543 SkRRect devRRect; 542 SkRRect devRRect;
544 if (rect.transform(*draw.fMatrix, &devRRect)) { 543 if (rect.transform(*draw.fMatrix, &devRRect)) {
545 if (devRRect.allCornersCircular()) { 544 if (devRRect.allCornersCircular()) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 595
597 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, 596 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
598 const SkRRect& inner, const SkPaint& paint) { 597 const SkRRect& inner, const SkPaint& paint) {
599 SkStrokeRec stroke(paint); 598 SkStrokeRec stroke(paint);
600 if (stroke.isFillStyle()) { 599 if (stroke.isFillStyle()) {
601 600
602 CHECK_FOR_ANNOTATION(paint); 601 CHECK_FOR_ANNOTATION(paint);
603 CHECK_SHOULD_DRAW(draw); 602 CHECK_SHOULD_DRAW(draw);
604 603
605 GrPaint grPaint; 604 GrPaint grPaint;
606 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatri x, true, 605 if (!SkPaint2GrPaint(this->context(), paint, *draw.fMatrix, true, &grPai nt)) {
607 &grPaint)) {
608 return; 606 return;
609 } 607 }
610 608
611 if (nullptr == paint.getMaskFilter() && nullptr == paint.getPathEffect() ) { 609 if (nullptr == paint.getMaskFilter() && nullptr == paint.getPathEffect() ) {
612 fDrawContext->drawDRRect(fRenderTarget, fClip, grPaint, *draw.fMatri x, outer, inner); 610 fDrawContext->drawDRRect(fRenderTarget, fClip, grPaint, *draw.fMatri x, outer, inner);
613 return; 611 return;
614 } 612 }
615 } 613 }
616 614
617 SkPath path; 615 SkPath path;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 647
650 if (usePath) { 648 if (usePath) {
651 SkPath path; 649 SkPath path;
652 path.setIsVolatile(true); 650 path.setIsVolatile(true);
653 path.addOval(oval); 651 path.addOval(oval);
654 this->drawPath(draw, path, paint, nullptr, true); 652 this->drawPath(draw, path, paint, nullptr, true);
655 return; 653 return;
656 } 654 }
657 655
658 GrPaint grPaint; 656 GrPaint grPaint;
659 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t rue, &grPaint)) { 657 if (!SkPaint2GrPaint(this->context(), paint, *draw.fMatrix, true, &grPaint)) {
660 return; 658 return;
661 } 659 }
662 660
663 fDrawContext->drawOval(fRenderTarget, fClip, grPaint, *draw.fMatrix, oval, s trokeInfo); 661 fDrawContext->drawOval(fRenderTarget, fClip, grPaint, *draw.fMatrix, oval, s trokeInfo);
664 } 662 }
665 663
666 #include "SkMaskFilter.h" 664 #include "SkMaskFilter.h"
667 665
668 /////////////////////////////////////////////////////////////////////////////// 666 ///////////////////////////////////////////////////////////////////////////////
669 667
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 fp.reset(GrBicubicEffect::Create(grPaint.getProcessorDataManager(), text ure, 1002 fp.reset(GrBicubicEffect::Create(grPaint.getProcessorDataManager(), text ure,
1005 SkMatrix::I(), 1003 SkMatrix::I(),
1006 tm)); 1004 tm));
1007 } else { 1005 } else {
1008 fp.reset(GrSimpleTextureEffect::Create(grPaint.getProcessorDataManager() , texture, 1006 fp.reset(GrSimpleTextureEffect::Create(grPaint.getProcessorDataManager() , texture,
1009 SkMatrix::I(), params)); 1007 SkMatrix::I(), params));
1010 } 1008 }
1011 1009
1012 // The bitmap read has to be first 1010 // The bitmap read has to be first
1013 grPaint.addColorFragmentProcessor(fp); 1011 grPaint.addColorFragmentProcessor(fp);
1014 if (!SkPaint2GrPaintNoShader(context, renderTarget, paint, SkColor2GrColor(p aint.getColor()), 1012 if (!SkPaint2GrPaintNoShader(context, paint, SkColor2GrColor(paint.getColor( )), false,
1015 false, &grPaint)) { 1013 &grPaint)) {
1016 return; 1014 return;
1017 } 1015 }
1018 1016
1019 grPaint.setColor(paintColor); 1017 grPaint.setColor(paintColor);
1020 1018
1021 // Setup dst rect and final matrix 1019 // Setup dst rect and final matrix
1022 SkRect dstRect = {0, 0, dstSize.fWidth, dstSize.fHeight}; 1020 SkRect dstRect = {0, 0, dstSize.fWidth, dstSize.fHeight};
1023 1021
1024 SkRect devRect; 1022 SkRect devRect;
1025 viewMatrix.mapRect(&devRect, dstRect); 1023 viewMatrix.mapRect(&devRect, dstRect);
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 tileModes)); 1349 tileModes));
1352 } else { 1350 } else {
1353 fp.reset(GrSimpleTextureEffect::Create(grPaint.getProcessorDataManager() , texture, 1351 fp.reset(GrSimpleTextureEffect::Create(grPaint.getProcessorDataManager() , texture,
1354 SkMatrix::I(), params)); 1352 SkMatrix::I(), params));
1355 } 1353 }
1356 1354
1357 grPaint.addColorFragmentProcessor(fp); 1355 grPaint.addColorFragmentProcessor(fp);
1358 bool alphaOnly = !(kAlpha_8_SkColorType == bitmap.colorType()); 1356 bool alphaOnly = !(kAlpha_8_SkColorType == bitmap.colorType());
1359 GrColor paintColor = (alphaOnly) ? SkColor2GrColorJustAlpha(paint.getColor() ) : 1357 GrColor paintColor = (alphaOnly) ? SkColor2GrColorJustAlpha(paint.getColor() ) :
1360 SkColor2GrColor(paint.getColor()); 1358 SkColor2GrColor(paint.getColor());
1361 if (!SkPaint2GrPaintNoShader(this->context(), fRenderTarget, paint, paintCol or, false, 1359 if (!SkPaint2GrPaintNoShader(this->context(), paint, paintColor, false, &grP aint)) {
1362 &grPaint)) {
1363 return; 1360 return;
1364 } 1361 }
1365 1362
1366 fDrawContext->drawNonAARectToRect(fRenderTarget, fClip, grPaint, viewMatrix, dstRect, 1363 fDrawContext->drawNonAARectToRect(fRenderTarget, fClip, grPaint, viewMatrix, dstRect,
1367 paintRect); 1364 paintRect);
1368 } 1365 }
1369 1366
1370 bool SkGpuDevice::filterTexture(GrContext* context, GrTexture* texture, 1367 bool SkGpuDevice::filterTexture(GrContext* context, GrTexture* texture,
1371 int width, int height, 1368 int width, int height,
1372 const SkImageFilter* filter, 1369 const SkImageFilter* filter,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 left += offset.x(); 1422 left += offset.x();
1426 top += offset.y(); 1423 top += offset.y();
1427 } else { 1424 } else {
1428 return; 1425 return;
1429 } 1426 }
1430 } 1427 }
1431 1428
1432 GrPaint grPaint; 1429 GrPaint grPaint;
1433 grPaint.addColorTextureProcessor(texture, SkMatrix::I()); 1430 grPaint.addColorTextureProcessor(texture, SkMatrix::I());
1434 1431
1435 if (!SkPaint2GrPaintNoShader(this->context(), fRenderTarget, paint, 1432 if (!SkPaint2GrPaintNoShader(this->context(), paint,
1436 SkColor2GrColorJustAlpha(paint.getColor()), fal se, &grPaint)) { 1433 SkColor2GrColorJustAlpha(paint.getColor()), fal se, &grPaint)) {
1437 return; 1434 return;
1438 } 1435 }
1439 1436
1440 fDrawContext->drawNonAARectToRect(fRenderTarget, 1437 fDrawContext->drawNonAARectToRect(fRenderTarget,
1441 fClip, 1438 fClip,
1442 grPaint, 1439 grPaint,
1443 SkMatrix::I(), 1440 SkMatrix::I(),
1444 SkRect::MakeXYWH(SkIntToScalar(left), 1441 SkRect::MakeXYWH(SkIntToScalar(left),
1445 SkIntToScalar(top), 1442 SkIntToScalar(top),
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 x += offset.fX; 1537 x += offset.fX;
1541 y += offset.fY; 1538 y += offset.fY;
1542 } else { 1539 } else {
1543 return; 1540 return;
1544 } 1541 }
1545 } 1542 }
1546 1543
1547 GrPaint grPaint; 1544 GrPaint grPaint;
1548 grPaint.addColorTextureProcessor(devTex, SkMatrix::I()); 1545 grPaint.addColorTextureProcessor(devTex, SkMatrix::I());
1549 1546
1550 if (!SkPaint2GrPaintNoShader(this->context(), fRenderTarget, paint, 1547 if (!SkPaint2GrPaintNoShader(this->context(), paint,
1551 SkColor2GrColorJustAlpha(paint.getColor()), fal se, &grPaint)) { 1548 SkColor2GrColorJustAlpha(paint.getColor()), fal se, &grPaint)) {
1552 return; 1549 return;
1553 } 1550 }
1554 1551
1555 SkRect dstRect = SkRect::MakeXYWH(SkIntToScalar(x), 1552 SkRect dstRect = SkRect::MakeXYWH(SkIntToScalar(x),
1556 SkIntToScalar(y), 1553 SkIntToScalar(y),
1557 SkIntToScalar(w), 1554 SkIntToScalar(w),
1558 SkIntToScalar(h)); 1555 SkIntToScalar(h));
1559 1556
1560 // The device being drawn may not fill up its texture (e.g. saveLayer uses a pproximate 1557 // The device being drawn may not fill up its texture (e.g. saveLayer uses a pproximate
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 // If both textures and vertex-colors are nullptr, strokes hairlines with th e paint's color. 1674 // If both textures and vertex-colors are nullptr, strokes hairlines with th e paint's color.
1678 if ((nullptr == texs || nullptr == paint.getShader()) && nullptr == colors) { 1675 if ((nullptr == texs || nullptr == paint.getShader()) && nullptr == colors) {
1679 1676
1680 texs = nullptr; 1677 texs = nullptr;
1681 1678
1682 SkPaint copy(paint); 1679 SkPaint copy(paint);
1683 copy.setStyle(SkPaint::kStroke_Style); 1680 copy.setStyle(SkPaint::kStroke_Style);
1684 copy.setStrokeWidth(0); 1681 copy.setStrokeWidth(0);
1685 1682
1686 // we ignore the shader if texs is null. 1683 // we ignore the shader if texs is null.
1687 if (!SkPaint2GrPaintNoShader(this->context(), fRenderTarget, copy, 1684 if (!SkPaint2GrPaintNoShader(this->context(), copy,
1688 SkColor2GrColor(copy.getColor()), nullptr = = colors, &grPaint)) { 1685 SkColor2GrColor(copy.getColor()), nullptr = = colors, &grPaint)) {
1689 return; 1686 return;
1690 } 1687 }
1691 1688
1692 primType = kLines_GrPrimitiveType; 1689 primType = kLines_GrPrimitiveType;
1693 int triangleCount = 0; 1690 int triangleCount = 0;
1694 int n = (nullptr == indices) ? vertexCount : indexCount; 1691 int n = (nullptr == indices) ? vertexCount : indexCount;
1695 switch (vmode) { 1692 switch (vmode) {
1696 case SkCanvas::kTriangles_VertexMode: 1693 case SkCanvas::kTriangles_VertexMode:
1697 triangleCount = n / 3; 1694 triangleCount = n / 3;
(...skipping 21 matching lines...) Expand all
1719 auxIndices[i + 3] = state.f2; 1716 auxIndices[i + 3] = state.f2;
1720 auxIndices[i + 4] = state.f2; 1717 auxIndices[i + 4] = state.f2;
1721 auxIndices[i + 5] = state.f0; 1718 auxIndices[i + 5] = state.f0;
1722 i += 6; 1719 i += 6;
1723 } 1720 }
1724 } else { 1721 } else {
1725 outIndices = indices; 1722 outIndices = indices;
1726 primType = gVertexMode2PrimitiveType[vmode]; 1723 primType = gVertexMode2PrimitiveType[vmode];
1727 1724
1728 if (nullptr == texs || nullptr == paint.getShader()) { 1725 if (nullptr == texs || nullptr == paint.getShader()) {
1729 if (!SkPaint2GrPaintNoShader(this->context(), fRenderTarget, paint, 1726 if (!SkPaint2GrPaintNoShader(this->context(), paint,
1730 SkColor2GrColor(paint.getColor()), 1727 SkColor2GrColor(paint.getColor()),
1731 nullptr == colors, &grPaint)) { 1728 nullptr == colors, &grPaint)) {
1732 return; 1729 return;
1733 } 1730 }
1734 } else { 1731 } else {
1735 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fM atrix, 1732 if (!SkPaint2GrPaint(this->context(), paint, *draw.fMatrix,
1736 nullptr == colors, &grPaint)) { 1733 nullptr == colors, &grPaint)) {
1737 return; 1734 return;
1738 } 1735 }
1739 } 1736 }
1740 } 1737 }
1741 1738
1742 #if 0 1739 #if 0
1743 if (xmode && texs && colors) { 1740 if (xmode && texs && colors) {
1744 if (!SkXfermode::IsMode(xmode, SkXfermode::kModulate_Mode)) { 1741 if (!SkXfermode::IsMode(xmode, SkXfermode::kModulate_Mode)) {
1745 SkDebugf("Unsupported vertex-color/texture xfer mode.\n"); 1742 SkDebugf("Unsupported vertex-color/texture xfer mode.\n");
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 return; 1782 return;
1786 } 1783 }
1787 1784
1788 CHECK_SHOULD_DRAW(draw); 1785 CHECK_SHOULD_DRAW(draw);
1789 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawText", fContext); 1786 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawText", fContext);
1790 1787
1791 SkPaint p(paint); 1788 SkPaint p(paint);
1792 p.setShader(atlas->newShader(SkShader::kClamp_TileMode, SkShader::kClamp_Til eMode))->unref(); 1789 p.setShader(atlas->newShader(SkShader::kClamp_TileMode, SkShader::kClamp_Til eMode))->unref();
1793 1790
1794 GrPaint grPaint; 1791 GrPaint grPaint;
1795 if (!SkPaint2GrPaint(this->context(), fRenderTarget, p, *draw.fMatrix, !colo rs, &grPaint)) { 1792 if (!SkPaint2GrPaint(this->context(), p, *draw.fMatrix, !colors, &grPaint)) {
1796 return; 1793 return;
1797 } 1794 }
1798 1795
1799 SkDEBUGCODE(this->validate();) 1796 SkDEBUGCODE(this->validate();)
1800 1797
1801 #if 0 1798 #if 0
1802 if (colors) { 1799 if (colors) {
1803 if (SkXfermode::kModulate_Mode != mode) { 1800 if (SkXfermode::kModulate_Mode != mode) {
1804 SkDebugf("Unsupported vertex-color/texture xfer mode.\n"); 1801 SkDebugf("Unsupported vertex-color/texture xfer mode.\n");
1805 return; 1802 return;
1806 } 1803 }
1807 } 1804 }
1808 #endif 1805 #endif
1809 1806
1810 fDrawContext->drawAtlas(fRenderTarget, fClip, grPaint, *draw.fMatrix, 1807 fDrawContext->drawAtlas(fRenderTarget, fClip, grPaint, *draw.fMatrix,
1811 count, xform, texRect, colors); 1808 count, xform, texRect, colors);
1812 } 1809 }
1813 1810
1814 /////////////////////////////////////////////////////////////////////////////// 1811 ///////////////////////////////////////////////////////////////////////////////
1815 1812
1816 void SkGpuDevice::drawText(const SkDraw& draw, const void* text, 1813 void SkGpuDevice::drawText(const SkDraw& draw, const void* text,
1817 size_t byteLength, SkScalar x, SkScalar y, 1814 size_t byteLength, SkScalar x, SkScalar y,
1818 const SkPaint& paint) { 1815 const SkPaint& paint) {
1819 CHECK_SHOULD_DRAW(draw); 1816 CHECK_SHOULD_DRAW(draw);
1820 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawText", fContext); 1817 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawText", fContext);
1821 1818
1822 GrPaint grPaint; 1819 GrPaint grPaint;
1823 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t rue, &grPaint)) { 1820 if (!SkPaint2GrPaint(this->context(), paint, *draw.fMatrix, true, &grPaint)) {
1824 return; 1821 return;
1825 } 1822 }
1826 1823
1827 SkDEBUGCODE(this->validate();) 1824 SkDEBUGCODE(this->validate();)
1828 1825
1829 fDrawContext->drawText(fRenderTarget, fClip, grPaint, paint, *draw.fMatrix, 1826 fDrawContext->drawText(fRenderTarget, fClip, grPaint, paint, *draw.fMatrix,
1830 (const char *)text, byteLength, x, y, draw.fClip->get Bounds()); 1827 (const char *)text, byteLength, x, y, draw.fClip->get Bounds());
1831 } 1828 }
1832 1829
1833 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, size_t byteL ength, 1830 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, size_t byteL ength,
1834 const SkScalar pos[], int scalarsPerPos, 1831 const SkScalar pos[], int scalarsPerPos,
1835 const SkPoint& offset, const SkPaint& paint) { 1832 const SkPoint& offset, const SkPaint& paint) {
1836 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPosText", fContext); 1833 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPosText", fContext);
1837 CHECK_SHOULD_DRAW(draw); 1834 CHECK_SHOULD_DRAW(draw);
1838 1835
1839 GrPaint grPaint; 1836 GrPaint grPaint;
1840 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t rue, &grPaint)) { 1837 if (!SkPaint2GrPaint(this->context(), paint, *draw.fMatrix, true, &grPaint)) {
1841 return; 1838 return;
1842 } 1839 }
1843 1840
1844 SkDEBUGCODE(this->validate();) 1841 SkDEBUGCODE(this->validate();)
1845 1842
1846 fDrawContext->drawPosText(fRenderTarget, fClip, grPaint, paint, *draw.fMatri x, 1843 fDrawContext->drawPosText(fRenderTarget, fClip, grPaint, paint, *draw.fMatri x,
1847 (const char *)text, byteLength, pos, scalarsPerPos , offset, 1844 (const char *)text, byteLength, pos, scalarsPerPos , offset,
1848 draw.fClip->getBounds()); 1845 draw.fClip->getBounds());
1849 } 1846 }
1850 1847
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1978 #endif 1975 #endif
1979 } 1976 }
1980 1977
1981 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1978 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1982 // We always return a transient cache, so it is freed after each 1979 // We always return a transient cache, so it is freed after each
1983 // filter traversal. 1980 // filter traversal.
1984 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 1981 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
1985 } 1982 }
1986 1983
1987 #endif 1984 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrTextContext.cpp ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698