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

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

Issue 1884873006: Rename lots of things from 'sRGB' to 'GammaCorrect', where appropriate (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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
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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 390
391 /////////////////////////////////////////////////////////////////////////////// 391 ///////////////////////////////////////////////////////////////////////////////
392 392
393 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { 393 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
394 ASSERT_SINGLE_OWNER 394 ASSERT_SINGLE_OWNER
395 CHECK_SHOULD_DRAW(draw); 395 CHECK_SHOULD_DRAW(draw);
396 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPaint", fContext); 396 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPaint", fContext);
397 397
398 GrPaint grPaint; 398 GrPaint grPaint;
399 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, 399 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
400 this->surfaceProps().allowSRGBInputs(), &grPaint)) { 400 this->surfaceProps().isGammaCorrect(), &grPaint)) {
401 return; 401 return;
402 } 402 }
403 403
404 fDrawContext->drawPaint(fClip, grPaint, *draw.fMatrix); 404 fDrawContext->drawPaint(fClip, grPaint, *draw.fMatrix);
405 } 405 }
406 406
407 // must be in SkCanvas::PointMode order 407 // must be in SkCanvas::PointMode order
408 static const GrPrimitiveType gPointMode2PrimtiveType[] = { 408 static const GrPrimitiveType gPointMode2PrimtiveType[] = {
409 kPoints_GrPrimitiveType, 409 kPoints_GrPrimitiveType,
410 kLines_GrPrimitiveType, 410 kLines_GrPrimitiveType,
(...skipping 30 matching lines...) Expand all
441 441
442 SkScalar width = paint.getStrokeWidth(); 442 SkScalar width = paint.getStrokeWidth();
443 if (width < 0) { 443 if (width < 0) {
444 return; 444 return;
445 } 445 }
446 446
447 if (paint.getPathEffect() && 2 == count && SkCanvas::kLines_PointMode == mod e) { 447 if (paint.getPathEffect() && 2 == count && SkCanvas::kLines_PointMode == mod e) {
448 GrStrokeInfo strokeInfo(paint, SkPaint::kStroke_Style); 448 GrStrokeInfo strokeInfo(paint, SkPaint::kStroke_Style);
449 GrPaint grPaint; 449 GrPaint grPaint;
450 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, 450 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
451 this->surfaceProps().allowSRGBInputs(), &grPaint)) { 451 this->surfaceProps().isGammaCorrect(), &grPaint)) {
452 return; 452 return;
453 } 453 }
454 SkPath path; 454 SkPath path;
455 path.setIsVolatile(true); 455 path.setIsVolatile(true);
456 path.moveTo(pts[0]); 456 path.moveTo(pts[0]);
457 path.lineTo(pts[1]); 457 path.lineTo(pts[1]);
458 fDrawContext->drawPath(fClip, grPaint, *draw.fMatrix, path, strokeInfo); 458 fDrawContext->drawPath(fClip, grPaint, *draw.fMatrix, path, strokeInfo);
459 return; 459 return;
460 } 460 }
461 461
462 // we only handle non-antialiased hairlines and paints without path effects or mask filters, 462 // we only handle non-antialiased hairlines and paints without path effects or mask filters,
463 // else we let the SkDraw call our drawPath() 463 // else we let the SkDraw call our drawPath()
464 if (width > 0 || paint.getPathEffect() || paint.getMaskFilter() || 464 if (width > 0 || paint.getPathEffect() || paint.getMaskFilter() ||
465 (paint.isAntiAlias() && needs_antialiasing(mode, count, pts))) { 465 (paint.isAntiAlias() && needs_antialiasing(mode, count, pts))) {
466 draw.drawPoints(mode, count, pts, paint, true); 466 draw.drawPoints(mode, count, pts, paint, true);
467 return; 467 return;
468 } 468 }
469 469
470 GrPaint grPaint; 470 GrPaint grPaint;
471 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, 471 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
472 this->surfaceProps().allowSRGBInputs(), &grPaint)) { 472 this->surfaceProps().isGammaCorrect(), &grPaint)) {
473 return; 473 return;
474 } 474 }
475 475
476 fDrawContext->drawVertices(fClip, 476 fDrawContext->drawVertices(fClip,
477 grPaint, 477 grPaint,
478 *draw.fMatrix, 478 *draw.fMatrix,
479 gPointMode2PrimtiveType[mode], 479 gPointMode2PrimtiveType[mode],
480 SkToS32(count), 480 SkToS32(count),
481 (SkPoint*)pts, 481 (SkPoint*)pts,
482 nullptr, 482 nullptr,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 path.addRect(rect); 515 path.addRect(rect);
516 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext, 516 GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext,
517 fClip, path, paint, 517 fClip, path, paint,
518 *draw.fMatrix, nullptr, 518 *draw.fMatrix, nullptr,
519 draw.fClip->getBounds(), true); 519 draw.fClip->getBounds(), true);
520 return; 520 return;
521 } 521 }
522 522
523 GrPaint grPaint; 523 GrPaint grPaint;
524 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, 524 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
525 this->surfaceProps().allowSRGBInputs(), &grPaint)) { 525 this->surfaceProps().isGammaCorrect(), &grPaint)) {
526 return; 526 return;
527 } 527 }
528 528
529 GrStrokeInfo strokeInfo(paint); 529 GrStrokeInfo strokeInfo(paint);
530 530
531 fDrawContext->drawRect(fClip, grPaint, *draw.fMatrix, rect, &strokeInfo); 531 fDrawContext->drawRect(fClip, grPaint, *draw.fMatrix, rect, &strokeInfo);
532 } 532 }
533 533
534 /////////////////////////////////////////////////////////////////////////////// 534 ///////////////////////////////////////////////////////////////////////////////
535 535
536 void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect, 536 void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect,
537 const SkPaint& paint) { 537 const SkPaint& paint) {
538 ASSERT_SINGLE_OWNER 538 ASSERT_SINGLE_OWNER
539 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawRRect", fContext); 539 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawRRect", fContext);
540 CHECK_SHOULD_DRAW(draw); 540 CHECK_SHOULD_DRAW(draw);
541 541
542 GrPaint grPaint; 542 GrPaint grPaint;
543 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, 543 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
544 this->surfaceProps().allowSRGBInputs(), &grPaint)) { 544 this->surfaceProps().isGammaCorrect(), &grPaint)) {
545 return; 545 return;
546 } 546 }
547 547
548 GrStrokeInfo strokeInfo(paint); 548 GrStrokeInfo strokeInfo(paint);
549 if (paint.getMaskFilter()) { 549 if (paint.getMaskFilter()) {
550 // try to hit the fast path for drawing filtered round rects 550 // try to hit the fast path for drawing filtered round rects
551 551
552 SkRRect devRRect; 552 SkRRect devRRect;
553 if (rect.transform(*draw.fMatrix, &devRRect)) { 553 if (rect.transform(*draw.fMatrix, &devRRect)) {
554 if (devRRect.allCornersCircular()) { 554 if (devRRect.allCornersCircular()) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 610
611 if (inner.isEmpty()) { 611 if (inner.isEmpty()) {
612 return this->drawRRect(draw, outer, paint); 612 return this->drawRRect(draw, outer, paint);
613 } 613 }
614 614
615 SkStrokeRec stroke(paint); 615 SkStrokeRec stroke(paint);
616 616
617 if (stroke.isFillStyle() && !paint.getMaskFilter() && !paint.getPathEffect() ) { 617 if (stroke.isFillStyle() && !paint.getMaskFilter() && !paint.getPathEffect() ) {
618 GrPaint grPaint; 618 GrPaint grPaint;
619 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, 619 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
620 this->surfaceProps().allowSRGBInputs(), &grPaint)) { 620 this->surfaceProps().isGammaCorrect(), &grPaint)) {
621 return; 621 return;
622 } 622 }
623 623
624 fDrawContext->drawDRRect(fClip, grPaint, *draw.fMatrix, outer, inner); 624 fDrawContext->drawDRRect(fClip, grPaint, *draw.fMatrix, outer, inner);
625 return; 625 return;
626 } 626 }
627 627
628 SkPath path; 628 SkPath path;
629 path.setIsVolatile(true); 629 path.setIsVolatile(true);
630 path.addRRect(outer); 630 path.addRRect(outer);
(...skipping 24 matching lines...) Expand all
655 } 655 }
656 656
657 if (paint.getMaskFilter()) { 657 if (paint.getMaskFilter()) {
658 // The RRect path can handle special case blurring 658 // The RRect path can handle special case blurring
659 SkRRect rr = SkRRect::MakeOval(oval); 659 SkRRect rr = SkRRect::MakeOval(oval);
660 return this->drawRRect(draw, rr, paint); 660 return this->drawRRect(draw, rr, paint);
661 } 661 }
662 662
663 GrPaint grPaint; 663 GrPaint grPaint;
664 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, 664 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
665 this->surfaceProps().allowSRGBInputs(), &grPaint)) { 665 this->surfaceProps().isGammaCorrect(), &grPaint)) {
666 return; 666 return;
667 } 667 }
668 668
669 GrStrokeInfo strokeInfo(paint); 669 GrStrokeInfo strokeInfo(paint);
670 SkASSERT(!strokeInfo.isDashed()); 670 SkASSERT(!strokeInfo.isDashed());
671 671
672 fDrawContext->drawOval(fClip, grPaint, *draw.fMatrix, oval, strokeInfo); 672 fDrawContext->drawOval(fClip, grPaint, *draw.fMatrix, oval, strokeInfo);
673 } 673 }
674 674
675 #include "SkMaskFilter.h" 675 #include "SkMaskFilter.h"
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 SkASSERT(GrTextureParams::kNone_FilterMode == params.filterMode()); 1140 SkASSERT(GrTextureParams::kNone_FilterMode == params.filterMode());
1141 SkShader::TileMode tileModes[2] = { params.getTileModeX(), params.getTil eModeY() }; 1141 SkShader::TileMode tileModes[2] = { params.getTileModeX(), params.getTil eModeY() };
1142 fp.reset(GrBicubicEffect::Create(texture, texMatrix, tileModes)); 1142 fp.reset(GrBicubicEffect::Create(texture, texMatrix, tileModes));
1143 } else { 1143 } else {
1144 fp.reset(GrSimpleTextureEffect::Create(texture, texMatrix, params)); 1144 fp.reset(GrSimpleTextureEffect::Create(texture, texMatrix, params));
1145 } 1145 }
1146 1146
1147 GrPaint grPaint; 1147 GrPaint grPaint;
1148 if (!SkPaintToGrPaintWithTexture(this->context(), paint, viewMatrix, fp, 1148 if (!SkPaintToGrPaintWithTexture(this->context(), paint, viewMatrix, fp,
1149 kAlpha_8_SkColorType == bitmap.colorType(), 1149 kAlpha_8_SkColorType == bitmap.colorType(),
1150 this->surfaceProps().allowSRGBInputs(), &gr Paint)) { 1150 this->surfaceProps().isGammaCorrect(), &grP aint)) {
1151 return; 1151 return;
1152 } 1152 }
1153 1153
1154 if (kAlpha_8_SkColorType == bitmap.colorType() && paint.getShader()) { 1154 if (kAlpha_8_SkColorType == bitmap.colorType() && paint.getShader()) {
1155 // We don't have local coords in this case and have previously set the t ransform 1155 // We don't have local coords in this case and have previously set the t ransform
1156 // matrices directly on the texture processor. 1156 // matrices directly on the texture processor.
1157 fDrawContext->drawRect(fClip, grPaint, viewMatrix, dstRect); 1157 fDrawContext->drawRect(fClip, grPaint, viewMatrix, dstRect);
1158 } else { 1158 } else {
1159 fDrawContext->fillRectToRect(fClip, grPaint, viewMatrix, dstRect, paintR ect); 1159 fDrawContext->fillRectToRect(fClip, grPaint, viewMatrix, dstRect, paintR ect);
1160 } 1160 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 1235
1236 GrPaint grPaint; 1236 GrPaint grPaint;
1237 SkAutoTUnref<const GrFragmentProcessor> fp( 1237 SkAutoTUnref<const GrFragmentProcessor> fp(
1238 GrSimpleTextureEffect::Create(texture, SkMatrix::I())); 1238 GrSimpleTextureEffect::Create(texture, SkMatrix::I()));
1239 if (alphaOnly) { 1239 if (alphaOnly) {
1240 fp.reset(GrFragmentProcessor::MulOutputByInputUnpremulColor(fp)); 1240 fp.reset(GrFragmentProcessor::MulOutputByInputUnpremulColor(fp));
1241 } else { 1241 } else {
1242 fp.reset(GrFragmentProcessor::MulOutputByInputAlpha(fp)); 1242 fp.reset(GrFragmentProcessor::MulOutputByInputAlpha(fp));
1243 } 1243 }
1244 if (!SkPaintToGrPaintReplaceShader(this->context(), paint, fp, 1244 if (!SkPaintToGrPaintReplaceShader(this->context(), paint, fp,
1245 this->surfaceProps().allowSRGBInputs(), & grPaint)) { 1245 this->surfaceProps().isGammaCorrect(), &g rPaint)) {
1246 return; 1246 return;
1247 } 1247 }
1248 1248
1249 fDrawContext->fillRectToRect(fClip, 1249 fDrawContext->fillRectToRect(fClip,
1250 grPaint, 1250 grPaint,
1251 SkMatrix::I(), 1251 SkMatrix::I(),
1252 SkRect::MakeXYWH(SkIntToScalar(left), 1252 SkRect::MakeXYWH(SkIntToScalar(left),
1253 SkIntToScalar(top), 1253 SkIntToScalar(top),
1254 SkIntToScalar(w), 1254 SkIntToScalar(w),
1255 SkIntToScalar(h)), 1255 SkIntToScalar(h)),
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 SkAutoTUnref<const GrFragmentProcessor> fp( 1396 SkAutoTUnref<const GrFragmentProcessor> fp(
1397 GrSimpleTextureEffect::Create(devTex, SkMatrix::I())); 1397 GrSimpleTextureEffect::Create(devTex, SkMatrix::I()));
1398 if (GrPixelConfigIsAlphaOnly(devTex->config())) { 1398 if (GrPixelConfigIsAlphaOnly(devTex->config())) {
1399 // Can this happen? 1399 // Can this happen?
1400 fp.reset(GrFragmentProcessor::MulOutputByInputUnpremulColor(fp)); 1400 fp.reset(GrFragmentProcessor::MulOutputByInputUnpremulColor(fp));
1401 } else { 1401 } else {
1402 fp.reset(GrFragmentProcessor::MulOutputByInputAlpha(fp)); 1402 fp.reset(GrFragmentProcessor::MulOutputByInputAlpha(fp));
1403 } 1403 }
1404 1404
1405 if (!SkPaintToGrPaintReplaceShader(this->context(), paint, fp, 1405 if (!SkPaintToGrPaintReplaceShader(this->context(), paint, fp,
1406 this->surfaceProps().allowSRGBInputs(), & grPaint)) { 1406 this->surfaceProps().isGammaCorrect(), &g rPaint)) {
1407 return; 1407 return;
1408 } 1408 }
1409 1409
1410 SkRect dstRect = SkRect::MakeXYWH(SkIntToScalar(x), 1410 SkRect dstRect = SkRect::MakeXYWH(SkIntToScalar(x),
1411 SkIntToScalar(y), 1411 SkIntToScalar(y),
1412 SkIntToScalar(w), 1412 SkIntToScalar(w),
1413 SkIntToScalar(h)); 1413 SkIntToScalar(h));
1414 1414
1415 // The device being drawn may not fill up its texture (e.g. saveLayer uses a pproximate 1415 // The device being drawn may not fill up its texture (e.g. saveLayer uses a pproximate
1416 // scratch texture). 1416 // scratch texture).
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1536 1536
1537 static const GrTextureParams::FilterMode kMode = GrTextureParams::kNone_Filt erMode; 1537 static const GrTextureParams::FilterMode kMode = GrTextureParams::kNone_Filt erMode;
1538 SkAutoTUnref<const GrFragmentProcessor> fp( 1538 SkAutoTUnref<const GrFragmentProcessor> fp(
1539 producer->createFragmentProcessor(SkMatrix::I(), 1539 producer->createFragmentProcessor(SkMatrix::I(),
1540 SkRect::MakeIWH(producer->width(), pro ducer->height()), 1540 SkRect::MakeIWH(producer->width(), pro ducer->height()),
1541 GrTextureProducer::kNo_FilterConstrain t, true, 1541 GrTextureProducer::kNo_FilterConstrain t, true,
1542 &kMode)); 1542 &kMode));
1543 GrPaint grPaint; 1543 GrPaint grPaint;
1544 if (!SkPaintToGrPaintWithTexture(this->context(), paint, *draw.fMatrix, fp, 1544 if (!SkPaintToGrPaintWithTexture(this->context(), paint, *draw.fMatrix, fp,
1545 producer->isAlphaOnly(), 1545 producer->isAlphaOnly(),
1546 this->surfaceProps().allowSRGBInputs(), &gr Paint)) { 1546 this->surfaceProps().isGammaCorrect(), &grP aint)) {
1547 return; 1547 return;
1548 } 1548 }
1549 1549
1550 fDrawContext->drawImageNine(fClip, grPaint, *draw.fMatrix, producer->width() , 1550 fDrawContext->drawImageNine(fClip, grPaint, *draw.fMatrix, producer->width() ,
1551 producer->height(), center, dst); 1551 producer->height(), center, dst);
1552 } 1552 }
1553 1553
1554 void SkGpuDevice::drawImageNine(const SkDraw& draw, const SkImage* image, 1554 void SkGpuDevice::drawImageNine(const SkDraw& draw, const SkImage* image,
1555 const SkIRect& center, const SkRect& dst, const SkPaint& paint) { 1555 const SkIRect& center, const SkRect& dst, const SkPaint& paint) {
1556 ASSERT_SINGLE_OWNER 1556 ASSERT_SINGLE_OWNER
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 1604
1605 texs = nullptr; 1605 texs = nullptr;
1606 1606
1607 SkPaint copy(paint); 1607 SkPaint copy(paint);
1608 copy.setStyle(SkPaint::kStroke_Style); 1608 copy.setStyle(SkPaint::kStroke_Style);
1609 copy.setStrokeWidth(0); 1609 copy.setStrokeWidth(0);
1610 1610
1611 GrPaint grPaint; 1611 GrPaint grPaint;
1612 // we ignore the shader if texs is null. 1612 // we ignore the shader if texs is null.
1613 if (!SkPaintToGrPaintNoShader(this->context(), copy, 1613 if (!SkPaintToGrPaintNoShader(this->context(), copy,
1614 this->surfaceProps().allowSRGBInputs(), &g rPaint)) { 1614 this->surfaceProps().isGammaCorrect(), &gr Paint)) {
1615 return; 1615 return;
1616 } 1616 }
1617 1617
1618 int triangleCount = 0; 1618 int triangleCount = 0;
1619 int n = (nullptr == indices) ? vertexCount : indexCount; 1619 int n = (nullptr == indices) ? vertexCount : indexCount;
1620 switch (vmode) { 1620 switch (vmode) {
1621 case SkCanvas::kTriangles_VertexMode: 1621 case SkCanvas::kTriangles_VertexMode:
1622 triangleCount = n / 3; 1622 triangleCount = n / 3;
1623 break; 1623 break;
1624 case SkCanvas::kTriangleStrip_VertexMode: 1624 case SkCanvas::kTriangleStrip_VertexMode:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1676 // xmode is defined to mean modulate. 1676 // xmode is defined to mean modulate.
1677 SkXfermode::Mode colorMode; 1677 SkXfermode::Mode colorMode;
1678 if (xmode) { 1678 if (xmode) {
1679 if (!xmode->asMode(&colorMode)) { 1679 if (!xmode->asMode(&colorMode)) {
1680 return; 1680 return;
1681 } 1681 }
1682 } else { 1682 } else {
1683 colorMode = SkXfermode::kModulate_Mode; 1683 colorMode = SkXfermode::kModulate_Mode;
1684 } 1684 }
1685 if (!SkPaintToGrPaintWithXfermode(this->context(), paint, *draw.fMat rix, colorMode, 1685 if (!SkPaintToGrPaintWithXfermode(this->context(), paint, *draw.fMat rix, colorMode,
1686 false, this->surfaceProps().allowS RGBInputs(), 1686 false, this->surfaceProps().isGamm aCorrect(),
1687 &grPaint)) { 1687 &grPaint)) {
1688 return; 1688 return;
1689 } 1689 }
1690 } else { 1690 } else {
1691 // We have a shader, but no colors to blend it against. 1691 // We have a shader, but no colors to blend it against.
1692 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, 1692 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
1693 this->surfaceProps().allowSRGBInputs(), &grPai nt)) { 1693 this->surfaceProps().isGammaCorrect(), &grPain t)) {
1694 return; 1694 return;
1695 } 1695 }
1696 } 1696 }
1697 } else { 1697 } else {
1698 if (colors) { 1698 if (colors) {
1699 // We have colors, but either have no shader or no texture coords (w hich implies that 1699 // We have colors, but either have no shader or no texture coords (w hich implies that
1700 // we should ignore the shader). 1700 // we should ignore the shader).
1701 if (!SkPaintToGrPaintWithPrimitiveColor(this->context(), paint, 1701 if (!SkPaintToGrPaintWithPrimitiveColor(this->context(), paint,
1702 this->surfaceProps().allowSR GBInputs(), 1702 this->surfaceProps().isGamma Correct(),
1703 &grPaint)) { 1703 &grPaint)) {
1704 return; 1704 return;
1705 } 1705 }
1706 } else { 1706 } else {
1707 // No colors and no shaders. Just draw with the paint color. 1707 // No colors and no shaders. Just draw with the paint color.
1708 if (!SkPaintToGrPaintNoShader(this->context(), paint, 1708 if (!SkPaintToGrPaintNoShader(this->context(), paint,
1709 this->surfaceProps().allowSRGBInputs() , &grPaint)) { 1709 this->surfaceProps().isGammaCorrect(), &grPaint)) {
1710 return; 1710 return;
1711 } 1711 }
1712 } 1712 }
1713 } 1713 }
1714 1714
1715 fDrawContext->drawVertices(fClip, 1715 fDrawContext->drawVertices(fClip,
1716 grPaint, 1716 grPaint,
1717 *draw.fMatrix, 1717 *draw.fMatrix,
1718 primType, 1718 primType,
1719 vertexCount, 1719 vertexCount,
(...skipping 17 matching lines...) Expand all
1737 1737
1738 CHECK_SHOULD_DRAW(draw); 1738 CHECK_SHOULD_DRAW(draw);
1739 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawText", fContext); 1739 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawText", fContext);
1740 1740
1741 SkPaint p(paint); 1741 SkPaint p(paint);
1742 p.setShader(atlas->makeShader(SkShader::kClamp_TileMode, SkShader::kClamp_Ti leMode)); 1742 p.setShader(atlas->makeShader(SkShader::kClamp_TileMode, SkShader::kClamp_Ti leMode));
1743 1743
1744 GrPaint grPaint; 1744 GrPaint grPaint;
1745 if (colors) { 1745 if (colors) {
1746 if (!SkPaintToGrPaintWithXfermode(this->context(), p, *draw.fMatrix, mod e, true, 1746 if (!SkPaintToGrPaintWithXfermode(this->context(), p, *draw.fMatrix, mod e, true,
1747 this->surfaceProps().allowSRGBInputs() , &grPaint)) { 1747 this->surfaceProps().isGammaCorrect(), &grPaint)) {
1748 return; 1748 return;
1749 } 1749 }
1750 } else { 1750 } else {
1751 if (!SkPaintToGrPaint(this->context(), p, *draw.fMatrix, 1751 if (!SkPaintToGrPaint(this->context(), p, *draw.fMatrix,
1752 this->surfaceProps().allowSRGBInputs(), &grPaint)) { 1752 this->surfaceProps().isGammaCorrect(), &grPaint)) {
1753 return; 1753 return;
1754 } 1754 }
1755 } 1755 }
1756 1756
1757 SkDEBUGCODE(this->validate();) 1757 SkDEBUGCODE(this->validate();)
1758 fDrawContext->drawAtlas(fClip, grPaint, *draw.fMatrix, count, xform, texRect , colors); 1758 fDrawContext->drawAtlas(fClip, grPaint, *draw.fMatrix, count, xform, texRect , colors);
1759 } 1759 }
1760 1760
1761 /////////////////////////////////////////////////////////////////////////////// 1761 ///////////////////////////////////////////////////////////////////////////////
1762 1762
1763 void SkGpuDevice::drawText(const SkDraw& draw, const void* text, 1763 void SkGpuDevice::drawText(const SkDraw& draw, const void* text,
1764 size_t byteLength, SkScalar x, SkScalar y, 1764 size_t byteLength, SkScalar x, SkScalar y,
1765 const SkPaint& paint) { 1765 const SkPaint& paint) {
1766 ASSERT_SINGLE_OWNER 1766 ASSERT_SINGLE_OWNER
1767 CHECK_SHOULD_DRAW(draw); 1767 CHECK_SHOULD_DRAW(draw);
1768 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawText", fContext); 1768 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawText", fContext);
1769 1769
1770 GrPaint grPaint; 1770 GrPaint grPaint;
1771 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, 1771 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
1772 this->surfaceProps().allowSRGBInputs(), &grPaint)) { 1772 this->surfaceProps().isGammaCorrect(), &grPaint)) {
1773 return; 1773 return;
1774 } 1774 }
1775 1775
1776 SkDEBUGCODE(this->validate();) 1776 SkDEBUGCODE(this->validate();)
1777 1777
1778 fDrawContext->drawText(fClip, grPaint, paint, *draw.fMatrix, 1778 fDrawContext->drawText(fClip, grPaint, paint, *draw.fMatrix,
1779 (const char *)text, byteLength, x, y, draw.fClip->get Bounds()); 1779 (const char *)text, byteLength, x, y, draw.fClip->get Bounds());
1780 } 1780 }
1781 1781
1782 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, size_t byteL ength, 1782 void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, size_t byteL ength,
1783 const SkScalar pos[], int scalarsPerPos, 1783 const SkScalar pos[], int scalarsPerPos,
1784 const SkPoint& offset, const SkPaint& paint) { 1784 const SkPoint& offset, const SkPaint& paint) {
1785 ASSERT_SINGLE_OWNER 1785 ASSERT_SINGLE_OWNER
1786 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPosText", fContext); 1786 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPosText", fContext);
1787 CHECK_SHOULD_DRAW(draw); 1787 CHECK_SHOULD_DRAW(draw);
1788 1788
1789 GrPaint grPaint; 1789 GrPaint grPaint;
1790 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix, 1790 if (!SkPaintToGrPaint(this->context(), paint, *draw.fMatrix,
1791 this->surfaceProps().allowSRGBInputs(), &grPaint)) { 1791 this->surfaceProps().isGammaCorrect(), &grPaint)) {
1792 return; 1792 return;
1793 } 1793 }
1794 1794
1795 SkDEBUGCODE(this->validate();) 1795 SkDEBUGCODE(this->validate();)
1796 1796
1797 fDrawContext->drawPosText(fClip, grPaint, paint, *draw.fMatrix, 1797 fDrawContext->drawPosText(fClip, grPaint, paint, *draw.fMatrix,
1798 (const char *)text, byteLength, pos, scalarsPerPos , offset, 1798 (const char *)text, byteLength, pos, scalarsPerPos , offset,
1799 draw.fClip->getBounds()); 1799 draw.fClip->getBounds());
1800 } 1800 }
1801 1801
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1942 } 1942 }
1943 1943
1944 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1944 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1945 ASSERT_SINGLE_OWNER 1945 ASSERT_SINGLE_OWNER
1946 // We always return a transient cache, so it is freed after each 1946 // We always return a transient cache, so it is freed after each
1947 // filter traversal. 1947 // filter traversal.
1948 return SkGpuDevice::NewImageFilterCache(); 1948 return SkGpuDevice::NewImageFilterCache();
1949 } 1949 }
1950 1950
1951 #endif 1951 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698