| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrContext.h" | 9 #include "GrContext.h" |
| 10 | 10 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 fPathRendererChain = NULL; | 96 fPathRendererChain = NULL; |
| 97 fSoftwarePathRenderer = NULL; | 97 fSoftwarePathRenderer = NULL; |
| 98 fResourceCache2 = NULL; | 98 fResourceCache2 = NULL; |
| 99 fFontCache = NULL; | 99 fFontCache = NULL; |
| 100 fDrawBuffer = NULL; | 100 fDrawBuffer = NULL; |
| 101 fDrawBufferVBAllocPool = NULL; | 101 fDrawBufferVBAllocPool = NULL; |
| 102 fDrawBufferIBAllocPool = NULL; | 102 fDrawBufferIBAllocPool = NULL; |
| 103 fFlushToReduceCacheSize = false; | 103 fFlushToReduceCacheSize = false; |
| 104 fAARectRenderer = NULL; | 104 fAARectRenderer = NULL; |
| 105 fOvalRenderer = NULL; | 105 fOvalRenderer = NULL; |
| 106 fViewMatrix.reset(); | |
| 107 fMaxTextureSizeOverride = 1 << 20; | 106 fMaxTextureSizeOverride = 1 << 20; |
| 108 } | 107 } |
| 109 | 108 |
| 110 bool GrContext::init(GrBackend backend, GrBackendContext backendContext) { | 109 bool GrContext::init(GrBackend backend, GrBackendContext backendContext) { |
| 111 SkASSERT(NULL == fGpu); | 110 SkASSERT(NULL == fGpu); |
| 112 | 111 |
| 113 fGpu = GrGpu::Create(backend, backendContext, this); | 112 fGpu = GrGpu::Create(backend, backendContext, this); |
| 114 if (NULL == fGpu) { | 113 if (NULL == fGpu) { |
| 115 return false; | 114 return false; |
| 116 } | 115 } |
| 117 this->initCommon(); | 116 this->initCommon(); |
| 118 return true; | 117 return true; |
| 119 } | 118 } |
| 120 | 119 |
| 121 void GrContext::initCommon() { | 120 void GrContext::initCommon() { |
| 122 fResourceCache2 = SkNEW(GrResourceCache2); | 121 fResourceCache2 = SkNEW(GrResourceCache2); |
| 123 fResourceCache2->setOverBudgetCallback(OverBudgetCB, this); | 122 fResourceCache2->setOverBudgetCallback(OverBudgetCB, this); |
| 124 | 123 |
| 125 fFontCache = SkNEW_ARGS(GrFontCache, (fGpu)); | 124 fFontCache = SkNEW_ARGS(GrFontCache, (fGpu)); |
| 126 | 125 |
| 127 fLayerCache.reset(SkNEW_ARGS(GrLayerCache, (this))); | 126 fLayerCache.reset(SkNEW_ARGS(GrLayerCache, (this))); |
| 128 | 127 |
| 129 fAARectRenderer = SkNEW_ARGS(GrAARectRenderer, (fGpu)); | 128 fAARectRenderer = SkNEW_ARGS(GrAARectRenderer, (fGpu)); |
| 130 fOvalRenderer = SkNEW(GrOvalRenderer); | 129 fOvalRenderer = SkNEW_ARGS(GrOvalRenderer, (fGpu)); |
| 131 | 130 |
| 132 fDidTestPMConversions = false; | 131 fDidTestPMConversions = false; |
| 133 | 132 |
| 134 this->setupDrawBuffer(); | 133 this->setupDrawBuffer(); |
| 135 } | 134 } |
| 136 | 135 |
| 137 GrContext::~GrContext() { | 136 GrContext::~GrContext() { |
| 138 if (NULL == fGpu) { | 137 if (NULL == fGpu) { |
| 139 return; | 138 return; |
| 140 } | 139 } |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 | 533 |
| 535 void GrContext::clear(const SkIRect* rect, | 534 void GrContext::clear(const SkIRect* rect, |
| 536 const GrColor color, | 535 const GrColor color, |
| 537 bool canIgnoreRect, | 536 bool canIgnoreRect, |
| 538 GrRenderTarget* renderTarget) { | 537 GrRenderTarget* renderTarget) { |
| 539 ASSERT_OWNED_RESOURCE(renderTarget); | 538 ASSERT_OWNED_RESOURCE(renderTarget); |
| 540 SkASSERT(renderTarget); | 539 SkASSERT(renderTarget); |
| 541 | 540 |
| 542 AutoCheckFlush acf(this); | 541 AutoCheckFlush acf(this); |
| 543 GR_CREATE_TRACE_MARKER_CONTEXT("GrContext::clear", this); | 542 GR_CREATE_TRACE_MARKER_CONTEXT("GrContext::clear", this); |
| 544 GrDrawTarget* target = this->prepareToDraw(NULL, NULL, &acf); | 543 GrDrawTarget* target = this->prepareToDraw(NULL, NULL, NULL, &acf); |
| 545 if (NULL == target) { | 544 if (NULL == target) { |
| 546 return; | 545 return; |
| 547 } | 546 } |
| 548 target->clear(rect, color, canIgnoreRect, renderTarget); | 547 target->clear(rect, color, canIgnoreRect, renderTarget); |
| 549 } | 548 } |
| 550 | 549 |
| 551 void GrContext::drawPaint(const GrPaint& origPaint) { | 550 void GrContext::drawPaint(const GrPaint& origPaint, const SkMatrix& viewMatrix)
{ |
| 552 // set rect to be big enough to fill the space, but not super-huge, so we | 551 // set rect to be big enough to fill the space, but not super-huge, so we |
| 553 // don't overflow fixed-point implementations | 552 // don't overflow fixed-point implementations |
| 554 SkRect r; | 553 SkRect r; |
| 555 r.setLTRB(0, 0, | 554 r.setLTRB(0, 0, |
| 556 SkIntToScalar(getRenderTarget()->width()), | 555 SkIntToScalar(getRenderTarget()->width()), |
| 557 SkIntToScalar(getRenderTarget()->height())); | 556 SkIntToScalar(getRenderTarget()->height())); |
| 558 SkMatrix inverse; | |
| 559 SkTCopyOnFirstWrite<GrPaint> paint(origPaint); | 557 SkTCopyOnFirstWrite<GrPaint> paint(origPaint); |
| 560 AutoMatrix am; | |
| 561 GR_CREATE_TRACE_MARKER_CONTEXT("GrContext::drawPaint", this); | 558 GR_CREATE_TRACE_MARKER_CONTEXT("GrContext::drawPaint", this); |
| 562 | 559 |
| 563 // We attempt to map r by the inverse matrix and draw that. mapRect will | 560 // We attempt to map r by the inverse matrix and draw that. mapRect will |
| 564 // map the four corners and bound them with a new rect. This will not | 561 // map the four corners and bound them with a new rect. This will not |
| 565 // produce a correct result for some perspective matrices. | 562 // produce a correct result for some perspective matrices. |
| 566 if (!this->getMatrix().hasPerspective()) { | 563 if (!viewMatrix.hasPerspective()) { |
| 567 if (!fViewMatrix.invert(&inverse)) { | 564 SkMatrix inverse; |
| 565 if (!viewMatrix.invert(&inverse)) { |
| 568 SkDebugf("Could not invert matrix\n"); | 566 SkDebugf("Could not invert matrix\n"); |
| 569 return; | 567 return; |
| 570 } | 568 } |
| 571 inverse.mapRect(&r); | 569 inverse.mapRect(&r); |
| 572 } else { | 570 } else { |
| 573 if (!am.setIdentity(this, paint.writable())) { | 571 if (!paint.writable()->localCoordChangeInverse(viewMatrix)) { |
| 574 SkDebugf("Could not invert matrix\n"); | 572 SkDebugf("Could not invert matrix\n"); |
| 575 return; | 573 return; |
| 576 } | 574 } |
| 577 } | 575 } |
| 578 // by definition this fills the entire clip, no need for AA | 576 // by definition this fills the entire clip, no need for AA |
| 579 if (paint->isAntiAlias()) { | 577 if (paint->isAntiAlias()) { |
| 580 paint.writable()->setAntiAlias(false); | 578 paint.writable()->setAntiAlias(false); |
| 581 } | 579 } |
| 582 this->drawRect(*paint, r); | 580 this->drawRect(*paint, viewMatrix.hasPerspective() ? SkMatrix::I() : viewMat
rix, r); |
| 583 } | 581 } |
| 584 | 582 |
| 585 #ifdef SK_DEVELOPER | 583 #ifdef SK_DEVELOPER |
| 586 void GrContext::dumpFontCache() const { | 584 void GrContext::dumpFontCache() const { |
| 587 fFontCache->dump(); | 585 fFontCache->dump(); |
| 588 } | 586 } |
| 589 #endif | 587 #endif |
| 590 | 588 |
| 591 //////////////////////////////////////////////////////////////////////////////// | 589 //////////////////////////////////////////////////////////////////////////////// |
| 592 | 590 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 | 660 |
| 663 return true; | 661 return true; |
| 664 } | 662 } |
| 665 | 663 |
| 666 static inline bool rect_contains_inclusive(const SkRect& rect, const SkPoint& po
int) { | 664 static inline bool rect_contains_inclusive(const SkRect& rect, const SkPoint& po
int) { |
| 667 return point.fX >= rect.fLeft && point.fX <= rect.fRight && | 665 return point.fX >= rect.fLeft && point.fX <= rect.fRight && |
| 668 point.fY >= rect.fTop && point.fY <= rect.fBottom; | 666 point.fY >= rect.fTop && point.fY <= rect.fBottom; |
| 669 } | 667 } |
| 670 | 668 |
| 671 void GrContext::drawRect(const GrPaint& paint, | 669 void GrContext::drawRect(const GrPaint& paint, |
| 670 const SkMatrix& viewMatrix, |
| 672 const SkRect& rect, | 671 const SkRect& rect, |
| 673 const GrStrokeInfo* strokeInfo) { | 672 const GrStrokeInfo* strokeInfo) { |
| 674 if (strokeInfo && strokeInfo->isDashed()) { | 673 if (strokeInfo && strokeInfo->isDashed()) { |
| 675 SkPath path; | 674 SkPath path; |
| 676 path.addRect(rect); | 675 path.addRect(rect); |
| 677 this->drawPath(paint, path, *strokeInfo); | 676 this->drawPath(paint, viewMatrix, path, *strokeInfo); |
| 678 return; | 677 return; |
| 679 } | 678 } |
| 680 | 679 |
| 681 AutoCheckFlush acf(this); | 680 AutoCheckFlush acf(this); |
| 682 GrDrawState drawState; | 681 GrDrawState drawState; |
| 683 GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &acf); | 682 GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &viewMatrix,
&acf); |
| 684 if (NULL == target) { | 683 if (NULL == target) { |
| 685 return; | 684 return; |
| 686 } | 685 } |
| 687 | 686 |
| 688 GR_CREATE_TRACE_MARKER("GrContext::drawRect", target); | 687 GR_CREATE_TRACE_MARKER("GrContext::drawRect", target); |
| 689 SkScalar width = NULL == strokeInfo ? -1 : strokeInfo->getStrokeRec().getWid
th(); | 688 SkScalar width = NULL == strokeInfo ? -1 : strokeInfo->getStrokeRec().getWid
th(); |
| 690 SkMatrix matrix = drawState.getViewMatrix(); | 689 SkMatrix matrix = drawState.getViewMatrix(); |
| 691 | 690 |
| 692 // Check if this is a full RT draw and can be replaced with a clear. We don'
t bother checking | 691 // Check if this is a full RT draw and can be replaced with a clear. We don'
t bother checking |
| 693 // cases where the RT is fully inside a stroke. | 692 // cases where the RT is fully inside a stroke. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 } | 789 } |
| 791 | 790 |
| 792 target->drawNonIndexed(&drawState, gp, primType, 0, vertCount); | 791 target->drawNonIndexed(&drawState, gp, primType, 0, vertCount); |
| 793 } else { | 792 } else { |
| 794 // filled BW rect | 793 // filled BW rect |
| 795 target->drawSimpleRect(&drawState, color, rect); | 794 target->drawSimpleRect(&drawState, color, rect); |
| 796 } | 795 } |
| 797 } | 796 } |
| 798 | 797 |
| 799 void GrContext::drawRectToRect(const GrPaint& paint, | 798 void GrContext::drawRectToRect(const GrPaint& paint, |
| 799 const SkMatrix& viewMatrix, |
| 800 const SkRect& dstRect, | 800 const SkRect& dstRect, |
| 801 const SkRect& localRect, | 801 const SkRect& localRect) { |
| 802 const SkMatrix* localMatrix) { | |
| 803 AutoCheckFlush acf(this); | 802 AutoCheckFlush acf(this); |
| 804 GrDrawState drawState; | 803 GrDrawState drawState; |
| 805 GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &acf); | 804 GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &viewMatrix,
&acf); |
| 806 if (NULL == target) { | 805 if (NULL == target) { |
| 807 return; | 806 return; |
| 808 } | 807 } |
| 809 | 808 |
| 810 GR_CREATE_TRACE_MARKER("GrContext::drawRectToRect", target); | 809 GR_CREATE_TRACE_MARKER("GrContext::drawRectToRect", target); |
| 811 | 810 |
| 812 target->drawRect(&drawState, paint.getColor(), dstRect, &localRect, localMat
rix); | 811 target->drawRect(&drawState, paint.getColor(), dstRect, &localRect, NULL); |
| 813 } | 812 } |
| 814 | 813 |
| 815 static const GrGeometryProcessor* set_vertex_attributes(const SkPoint* texCoords
, | 814 static const GrGeometryProcessor* set_vertex_attributes(const SkPoint* texCoords
, |
| 816 const GrColor* colors, | 815 const GrColor* colors, |
| 817 int* colorOffset, | 816 int* colorOffset, |
| 818 int* texOffset, | 817 int* texOffset, |
| 819 GrColor color) { | 818 GrColor color) { |
| 820 *texOffset = -1; | 819 *texOffset = -1; |
| 821 *colorOffset = -1; | 820 *colorOffset = -1; |
| 822 uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType; | 821 uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType; |
| 823 if (texCoords && colors) { | 822 if (texCoords && colors) { |
| 824 *colorOffset = sizeof(SkPoint); | 823 *colorOffset = sizeof(SkPoint); |
| 825 *texOffset = sizeof(SkPoint) + sizeof(GrColor); | 824 *texOffset = sizeof(SkPoint) + sizeof(GrColor); |
| 826 flags |= GrDefaultGeoProcFactory::kColor_GPType | | 825 flags |= GrDefaultGeoProcFactory::kColor_GPType | |
| 827 GrDefaultGeoProcFactory::kLocalCoord_GPType; | 826 GrDefaultGeoProcFactory::kLocalCoord_GPType; |
| 828 } else if (texCoords) { | 827 } else if (texCoords) { |
| 829 *texOffset = sizeof(SkPoint); | 828 *texOffset = sizeof(SkPoint); |
| 830 flags |= GrDefaultGeoProcFactory::kLocalCoord_GPType; | 829 flags |= GrDefaultGeoProcFactory::kLocalCoord_GPType; |
| 831 } else if (colors) { | 830 } else if (colors) { |
| 832 *colorOffset = sizeof(SkPoint); | 831 *colorOffset = sizeof(SkPoint); |
| 833 flags |= GrDefaultGeoProcFactory::kColor_GPType; | 832 flags |= GrDefaultGeoProcFactory::kColor_GPType; |
| 834 } | 833 } |
| 835 return GrDefaultGeoProcFactory::Create(color, flags); | 834 return GrDefaultGeoProcFactory::Create(color, flags); |
| 836 } | 835 } |
| 837 | 836 |
| 838 void GrContext::drawVertices(const GrPaint& paint, | 837 void GrContext::drawVertices(const GrPaint& paint, |
| 838 const SkMatrix& viewMatrix, |
| 839 GrPrimitiveType primitiveType, | 839 GrPrimitiveType primitiveType, |
| 840 int vertexCount, | 840 int vertexCount, |
| 841 const SkPoint positions[], | 841 const SkPoint positions[], |
| 842 const SkPoint texCoords[], | 842 const SkPoint texCoords[], |
| 843 const GrColor colors[], | 843 const GrColor colors[], |
| 844 const uint16_t indices[], | 844 const uint16_t indices[], |
| 845 int indexCount) { | 845 int indexCount) { |
| 846 AutoCheckFlush acf(this); | 846 AutoCheckFlush acf(this); |
| 847 GrDrawState drawState; | 847 GrDrawState drawState; |
| 848 GrDrawTarget::AutoReleaseGeometry geo; // must be inside AutoCheckFlush scop
e | 848 GrDrawTarget::AutoReleaseGeometry geo; // must be inside AutoCheckFlush scop
e |
| 849 | 849 |
| 850 GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &acf); | 850 GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &viewMatrix,
&acf); |
| 851 if (NULL == target) { | 851 if (NULL == target) { |
| 852 return; | 852 return; |
| 853 } | 853 } |
| 854 | 854 |
| 855 GR_CREATE_TRACE_MARKER("GrContext::drawVertices", target); | 855 GR_CREATE_TRACE_MARKER("GrContext::drawVertices", target); |
| 856 | 856 |
| 857 int colorOffset = -1, texOffset = -1; | 857 int colorOffset = -1, texOffset = -1; |
| 858 SkAutoTUnref<const GrGeometryProcessor> gp( | 858 SkAutoTUnref<const GrGeometryProcessor> gp( |
| 859 set_vertex_attributes(texCoords, colors, &colorOffset, &texOffset, p
aint.getColor())); | 859 set_vertex_attributes(texCoords, colors, &colorOffset, &texOffset, p
aint.getColor())); |
| 860 | 860 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 888 } | 888 } |
| 889 target->drawIndexed(&drawState, gp, primitiveType, 0, 0, vertexCount, in
dexCount); | 889 target->drawIndexed(&drawState, gp, primitiveType, 0, 0, vertexCount, in
dexCount); |
| 890 } else { | 890 } else { |
| 891 target->drawNonIndexed(&drawState, gp, primitiveType, 0, vertexCount); | 891 target->drawNonIndexed(&drawState, gp, primitiveType, 0, vertexCount); |
| 892 } | 892 } |
| 893 } | 893 } |
| 894 | 894 |
| 895 /////////////////////////////////////////////////////////////////////////////// | 895 /////////////////////////////////////////////////////////////////////////////// |
| 896 | 896 |
| 897 void GrContext::drawRRect(const GrPaint& paint, | 897 void GrContext::drawRRect(const GrPaint& paint, |
| 898 const SkMatrix& viewMatrix, |
| 898 const SkRRect& rrect, | 899 const SkRRect& rrect, |
| 899 const GrStrokeInfo& strokeInfo) { | 900 const GrStrokeInfo& strokeInfo) { |
| 900 if (rrect.isEmpty()) { | 901 if (rrect.isEmpty()) { |
| 901 return; | 902 return; |
| 902 } | 903 } |
| 903 | 904 |
| 904 if (strokeInfo.isDashed()) { | 905 if (strokeInfo.isDashed()) { |
| 905 SkPath path; | 906 SkPath path; |
| 906 path.addRRect(rrect); | 907 path.addRRect(rrect); |
| 907 this->drawPath(paint, path, strokeInfo); | 908 this->drawPath(paint, viewMatrix, path, strokeInfo); |
| 908 return; | 909 return; |
| 909 } | 910 } |
| 910 | 911 |
| 911 AutoCheckFlush acf(this); | 912 AutoCheckFlush acf(this); |
| 912 GrDrawState drawState; | 913 GrDrawState drawState; |
| 913 GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &acf); | 914 GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &viewMatrix,
&acf); |
| 914 if (NULL == target) { | 915 if (NULL == target) { |
| 915 return; | 916 return; |
| 916 } | 917 } |
| 917 | 918 |
| 918 GR_CREATE_TRACE_MARKER("GrContext::drawRRect", target); | 919 GR_CREATE_TRACE_MARKER("GrContext::drawRRect", target); |
| 919 | 920 |
| 920 const SkStrokeRec& strokeRec = strokeInfo.getStrokeRec(); | 921 const SkStrokeRec& strokeRec = strokeInfo.getStrokeRec(); |
| 921 | 922 |
| 922 GrColor color = paint.getColor(); | 923 GrColor color = paint.getColor(); |
| 923 if (!fOvalRenderer->drawRRect(target, &drawState, color, this, paint.isAntiA
lias(), rrect, | 924 if (!fOvalRenderer->drawRRect(target, &drawState, color, paint.isAntiAlias()
, rrect, |
| 924 strokeRec)) { | 925 strokeRec)) { |
| 925 SkPath path; | 926 SkPath path; |
| 926 path.addRRect(rrect); | 927 path.addRRect(rrect); |
| 927 this->internalDrawPath(target, &drawState, color, paint.isAntiAlias(), p
ath, strokeInfo); | 928 this->internalDrawPath(target, &drawState, viewMatrix, color, paint.isAn
tiAlias(), path, |
| 929 strokeInfo); |
| 928 } | 930 } |
| 929 } | 931 } |
| 930 | 932 |
| 931 /////////////////////////////////////////////////////////////////////////////// | 933 /////////////////////////////////////////////////////////////////////////////// |
| 932 | 934 |
| 933 void GrContext::drawDRRect(const GrPaint& paint, | 935 void GrContext::drawDRRect(const GrPaint& paint, |
| 936 const SkMatrix& viewMatrix, |
| 934 const SkRRect& outer, | 937 const SkRRect& outer, |
| 935 const SkRRect& inner) { | 938 const SkRRect& inner) { |
| 936 if (outer.isEmpty()) { | 939 if (outer.isEmpty()) { |
| 937 return; | 940 return; |
| 938 } | 941 } |
| 939 | 942 |
| 940 AutoCheckFlush acf(this); | 943 AutoCheckFlush acf(this); |
| 941 GrDrawState drawState; | 944 GrDrawState drawState; |
| 942 GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &acf); | 945 GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &viewMatrix,
&acf); |
| 943 | 946 |
| 944 GR_CREATE_TRACE_MARKER("GrContext::drawDRRect", target); | 947 GR_CREATE_TRACE_MARKER("GrContext::drawDRRect", target); |
| 945 | 948 |
| 946 GrColor color = paint.getColor(); | 949 GrColor color = paint.getColor(); |
| 947 if (!fOvalRenderer->drawDRRect(target, &drawState, color, this, paint.isAnti
Alias(), outer, | 950 if (!fOvalRenderer->drawDRRect(target, &drawState, color, paint.isAntiAlias(
), outer, inner)) { |
| 948 inner)) { | |
| 949 SkPath path; | 951 SkPath path; |
| 950 path.addRRect(inner); | 952 path.addRRect(inner); |
| 951 path.addRRect(outer); | 953 path.addRRect(outer); |
| 952 path.setFillType(SkPath::kEvenOdd_FillType); | 954 path.setFillType(SkPath::kEvenOdd_FillType); |
| 953 | 955 |
| 954 GrStrokeInfo fillRec(SkStrokeRec::kFill_InitStyle); | 956 GrStrokeInfo fillRec(SkStrokeRec::kFill_InitStyle); |
| 955 this->internalDrawPath(target, &drawState, color, paint.isAntiAlias(), p
ath, fillRec); | 957 this->internalDrawPath(target, &drawState, viewMatrix, color, paint.isAn
tiAlias(), path, |
| 958 fillRec); |
| 956 } | 959 } |
| 957 } | 960 } |
| 958 | 961 |
| 959 /////////////////////////////////////////////////////////////////////////////// | 962 /////////////////////////////////////////////////////////////////////////////// |
| 960 | 963 |
| 961 void GrContext::drawOval(const GrPaint& paint, | 964 void GrContext::drawOval(const GrPaint& paint, |
| 965 const SkMatrix& viewMatrix, |
| 962 const SkRect& oval, | 966 const SkRect& oval, |
| 963 const GrStrokeInfo& strokeInfo) { | 967 const GrStrokeInfo& strokeInfo) { |
| 964 if (oval.isEmpty()) { | 968 if (oval.isEmpty()) { |
| 965 return; | 969 return; |
| 966 } | 970 } |
| 967 | 971 |
| 968 if (strokeInfo.isDashed()) { | 972 if (strokeInfo.isDashed()) { |
| 969 SkPath path; | 973 SkPath path; |
| 970 path.addOval(oval); | 974 path.addOval(oval); |
| 971 this->drawPath(paint, path, strokeInfo); | 975 this->drawPath(paint, viewMatrix, path, strokeInfo); |
| 972 return; | 976 return; |
| 973 } | 977 } |
| 974 | 978 |
| 975 AutoCheckFlush acf(this); | 979 AutoCheckFlush acf(this); |
| 976 GrDrawState drawState; | 980 GrDrawState drawState; |
| 977 GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &acf); | 981 GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &viewMatrix,
&acf); |
| 978 if (NULL == target) { | 982 if (NULL == target) { |
| 979 return; | 983 return; |
| 980 } | 984 } |
| 981 | 985 |
| 982 GR_CREATE_TRACE_MARKER("GrContext::drawOval", target); | 986 GR_CREATE_TRACE_MARKER("GrContext::drawOval", target); |
| 983 | 987 |
| 984 const SkStrokeRec& strokeRec = strokeInfo.getStrokeRec(); | 988 const SkStrokeRec& strokeRec = strokeInfo.getStrokeRec(); |
| 985 | 989 |
| 986 GrColor color = paint.getColor(); | 990 GrColor color = paint.getColor(); |
| 987 if (!fOvalRenderer->drawOval(target, &drawState, color, this, paint.isAntiAl
ias(), oval, | 991 if (!fOvalRenderer->drawOval(target, &drawState, color, paint.isAntiAlias(),
oval, strokeRec)) { |
| 988 strokeRec)) { | |
| 989 SkPath path; | 992 SkPath path; |
| 990 path.addOval(oval); | 993 path.addOval(oval); |
| 991 this->internalDrawPath(target, &drawState, color, paint.isAntiAlias(), p
ath, strokeInfo); | 994 this->internalDrawPath(target, &drawState, viewMatrix, color, paint.isAn
tiAlias(), path, |
| 995 strokeInfo); |
| 992 } | 996 } |
| 993 } | 997 } |
| 994 | 998 |
| 995 // Can 'path' be drawn as a pair of filled nested rectangles? | 999 // Can 'path' be drawn as a pair of filled nested rectangles? |
| 996 static bool is_nested_rects(GrDrawTarget* target, | 1000 static bool is_nested_rects(GrDrawTarget* target, |
| 997 GrDrawState* drawState, | 1001 GrDrawState* drawState, |
| 998 GrColor color, | 1002 GrColor color, |
| 999 const SkPath& path, | 1003 const SkPath& path, |
| 1000 const SkStrokeRec& stroke, | 1004 const SkStrokeRec& stroke, |
| 1001 SkRect rects[2]) { | 1005 SkRect rects[2]) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 allGoE1 = false; | 1046 allGoE1 = false; |
| 1043 } | 1047 } |
| 1044 if (!SkScalarNearlyEqual(margin, temp)) { | 1048 if (!SkScalarNearlyEqual(margin, temp)) { |
| 1045 allEq = false; | 1049 allEq = false; |
| 1046 } | 1050 } |
| 1047 } | 1051 } |
| 1048 | 1052 |
| 1049 return allEq || allGoE1; | 1053 return allEq || allGoE1; |
| 1050 } | 1054 } |
| 1051 | 1055 |
| 1052 void GrContext::drawPath(const GrPaint& paint, const SkPath& path, const GrStrok
eInfo& strokeInfo) { | 1056 void GrContext::drawPath(const GrPaint& paint, |
| 1057 const SkMatrix& viewMatrix, |
| 1058 const SkPath& path, |
| 1059 const GrStrokeInfo& strokeInfo) { |
| 1053 | 1060 |
| 1054 if (path.isEmpty()) { | 1061 if (path.isEmpty()) { |
| 1055 if (path.isInverseFillType()) { | 1062 if (path.isInverseFillType()) { |
| 1056 this->drawPaint(paint); | 1063 this->drawPaint(paint, viewMatrix); |
| 1057 } | 1064 } |
| 1058 return; | 1065 return; |
| 1059 } | 1066 } |
| 1060 | 1067 |
| 1061 GrColor color = paint.getColor(); | 1068 GrColor color = paint.getColor(); |
| 1062 if (strokeInfo.isDashed()) { | 1069 if (strokeInfo.isDashed()) { |
| 1063 SkPoint pts[2]; | 1070 SkPoint pts[2]; |
| 1064 if (path.isLine(pts)) { | 1071 if (path.isLine(pts)) { |
| 1065 AutoCheckFlush acf(this); | 1072 AutoCheckFlush acf(this); |
| 1066 GrDrawState drawState; | 1073 GrDrawState drawState; |
| 1067 GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &acf)
; | 1074 GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &view
Matrix, &acf); |
| 1068 if (NULL == target) { | 1075 if (NULL == target) { |
| 1069 return; | 1076 return; |
| 1070 }; | 1077 }; |
| 1071 | 1078 |
| 1072 SkMatrix origViewMatrix = drawState.getViewMatrix(); | 1079 SkMatrix origViewMatrix = drawState.getViewMatrix(); |
| 1073 GrDrawState::AutoViewMatrixRestore avmr; | 1080 GrDrawState::AutoViewMatrixRestore avmr; |
| 1074 if (avmr.setIdentity(&drawState)) { | 1081 if (avmr.setIdentity(&drawState)) { |
| 1075 if (GrDashingEffect::DrawDashLine(fGpu, target, &drawState, colo
r, pts, paint, | 1082 if (GrDashingEffect::DrawDashLine(fGpu, target, &drawState, colo
r, pts, paint, |
| 1076 strokeInfo, origViewMatrix)) { | 1083 strokeInfo, origViewMatrix)) { |
| 1077 return; | 1084 return; |
| 1078 } | 1085 } |
| 1079 } | 1086 } |
| 1080 } | 1087 } |
| 1081 | 1088 |
| 1082 // Filter dashed path into new path with the dashing applied | 1089 // Filter dashed path into new path with the dashing applied |
| 1083 const SkPathEffect::DashInfo& info = strokeInfo.getDashInfo(); | 1090 const SkPathEffect::DashInfo& info = strokeInfo.getDashInfo(); |
| 1084 SkTLazy<SkPath> effectPath; | 1091 SkTLazy<SkPath> effectPath; |
| 1085 GrStrokeInfo newStrokeInfo(strokeInfo, false); | 1092 GrStrokeInfo newStrokeInfo(strokeInfo, false); |
| 1086 SkStrokeRec* stroke = newStrokeInfo.getStrokeRecPtr(); | 1093 SkStrokeRec* stroke = newStrokeInfo.getStrokeRecPtr(); |
| 1087 if (SkDashPath::FilterDashPath(effectPath.init(), path, stroke, NULL, in
fo)) { | 1094 if (SkDashPath::FilterDashPath(effectPath.init(), path, stroke, NULL, in
fo)) { |
| 1088 this->drawPath(paint, *effectPath.get(), newStrokeInfo); | 1095 this->drawPath(paint, viewMatrix, *effectPath.get(), newStrokeInfo); |
| 1089 return; | 1096 return; |
| 1090 } | 1097 } |
| 1091 | 1098 |
| 1092 this->drawPath(paint, path, newStrokeInfo); | 1099 this->drawPath(paint, viewMatrix, path, newStrokeInfo); |
| 1093 return; | 1100 return; |
| 1094 } | 1101 } |
| 1095 | 1102 |
| 1096 // Note that internalDrawPath may sw-rasterize the path into a scratch textu
re. | 1103 // Note that internalDrawPath may sw-rasterize the path into a scratch textu
re. |
| 1097 // Scratch textures can be recycled after they are returned to the texture | 1104 // Scratch textures can be recycled after they are returned to the texture |
| 1098 // cache. This presents a potential hazard for buffered drawing. However, | 1105 // cache. This presents a potential hazard for buffered drawing. However, |
| 1099 // the writePixels that uploads to the scratch will perform a flush so we're | 1106 // the writePixels that uploads to the scratch will perform a flush so we're |
| 1100 // OK. | 1107 // OK. |
| 1101 AutoCheckFlush acf(this); | 1108 AutoCheckFlush acf(this); |
| 1102 GrDrawState drawState; | 1109 GrDrawState drawState; |
| 1103 GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &acf); | 1110 GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &viewMatrix,
&acf); |
| 1104 if (NULL == target) { | 1111 if (NULL == target) { |
| 1105 return; | 1112 return; |
| 1106 } | 1113 } |
| 1107 | 1114 |
| 1108 GR_CREATE_TRACE_MARKER1("GrContext::drawPath", target, "Is Convex", path.isC
onvex()); | 1115 GR_CREATE_TRACE_MARKER1("GrContext::drawPath", target, "Is Convex", path.isC
onvex()); |
| 1109 | 1116 |
| 1110 const SkStrokeRec& strokeRec = strokeInfo.getStrokeRec(); | 1117 const SkStrokeRec& strokeRec = strokeInfo.getStrokeRec(); |
| 1111 | 1118 |
| 1112 bool useCoverageAA = paint.isAntiAlias() && !drawState.getRenderTarget()->is
Multisampled(); | 1119 bool useCoverageAA = paint.isAntiAlias() && !drawState.getRenderTarget()->is
Multisampled(); |
| 1113 | 1120 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1124 | 1131 |
| 1125 fAARectRenderer->fillAANestedRects(target, &drawState, color, rects,
origViewMatrix); | 1132 fAARectRenderer->fillAANestedRects(target, &drawState, color, rects,
origViewMatrix); |
| 1126 return; | 1133 return; |
| 1127 } | 1134 } |
| 1128 } | 1135 } |
| 1129 | 1136 |
| 1130 SkRect ovalRect; | 1137 SkRect ovalRect; |
| 1131 bool isOval = path.isOval(&ovalRect); | 1138 bool isOval = path.isOval(&ovalRect); |
| 1132 | 1139 |
| 1133 if (!isOval || path.isInverseFillType() | 1140 if (!isOval || path.isInverseFillType() |
| 1134 || !fOvalRenderer->drawOval(target, &drawState, color, this, paint.isAnt
iAlias(), ovalRect, | 1141 || !fOvalRenderer->drawOval(target, &drawState, color, paint.isAntiAlias
(), ovalRect, |
| 1135 strokeRec)) { | 1142 strokeRec)) { |
| 1136 this->internalDrawPath(target, &drawState, color, paint.isAntiAlias(), p
ath, strokeInfo); | 1143 this->internalDrawPath(target, &drawState, viewMatrix, color, paint.isAn
tiAlias(), path, |
| 1144 strokeInfo); |
| 1137 } | 1145 } |
| 1138 } | 1146 } |
| 1139 | 1147 |
| 1140 void GrContext::internalDrawPath(GrDrawTarget* target, | 1148 void GrContext::internalDrawPath(GrDrawTarget* target, |
| 1141 GrDrawState* drawState, | 1149 GrDrawState* drawState, |
| 1150 const SkMatrix& viewMatrix, |
| 1142 GrColor color, | 1151 GrColor color, |
| 1143 bool useAA, | 1152 bool useAA, |
| 1144 const SkPath& path, | 1153 const SkPath& path, |
| 1145 const GrStrokeInfo& strokeInfo) { | 1154 const GrStrokeInfo& strokeInfo) { |
| 1146 SkASSERT(!path.isEmpty()); | 1155 SkASSERT(!path.isEmpty()); |
| 1147 | 1156 |
| 1148 GR_CREATE_TRACE_MARKER("GrContext::internalDrawPath", target); | 1157 GR_CREATE_TRACE_MARKER("GrContext::internalDrawPath", target); |
| 1149 | 1158 |
| 1150 | 1159 |
| 1151 // An Assumption here is that path renderer would use some form of tweaking | 1160 // An Assumption here is that path renderer would use some form of tweaking |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1162 GrPathRendererChain::kColor_DrawType; | 1171 GrPathRendererChain::kColor_DrawType; |
| 1163 | 1172 |
| 1164 const SkPath* pathPtr = &path; | 1173 const SkPath* pathPtr = &path; |
| 1165 SkTLazy<SkPath> tmpPath; | 1174 SkTLazy<SkPath> tmpPath; |
| 1166 SkTCopyOnFirstWrite<SkStrokeRec> stroke(strokeInfo.getStrokeRec()); | 1175 SkTCopyOnFirstWrite<SkStrokeRec> stroke(strokeInfo.getStrokeRec()); |
| 1167 | 1176 |
| 1168 // Try a 1st time without stroking the path and without allowing the SW rend
erer | 1177 // Try a 1st time without stroking the path and without allowing the SW rend
erer |
| 1169 GrPathRenderer* pr = this->getPathRenderer(target, drawState, *pathPtr, *str
oke, false, type); | 1178 GrPathRenderer* pr = this->getPathRenderer(target, drawState, *pathPtr, *str
oke, false, type); |
| 1170 | 1179 |
| 1171 if (NULL == pr) { | 1180 if (NULL == pr) { |
| 1172 if (!GrPathRenderer::IsStrokeHairlineOrEquivalent(*stroke, this->getMatr
ix(), NULL)) { | 1181 if (!GrPathRenderer::IsStrokeHairlineOrEquivalent(*stroke, viewMatrix, N
ULL)) { |
| 1173 // It didn't work the 1st time, so try again with the stroked path | 1182 // It didn't work the 1st time, so try again with the stroked path |
| 1174 if (stroke->applyToPath(tmpPath.init(), *pathPtr)) { | 1183 if (stroke->applyToPath(tmpPath.init(), *pathPtr)) { |
| 1175 pathPtr = tmpPath.get(); | 1184 pathPtr = tmpPath.get(); |
| 1176 stroke.writable()->setFillStyle(); | 1185 stroke.writable()->setFillStyle(); |
| 1177 if (pathPtr->isEmpty()) { | 1186 if (pathPtr->isEmpty()) { |
| 1178 return; | 1187 return; |
| 1179 } | 1188 } |
| 1180 } | 1189 } |
| 1181 } | 1190 } |
| 1182 | 1191 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 } | 1328 } |
| 1320 | 1329 |
| 1321 SkMatrix matrix; | 1330 SkMatrix matrix; |
| 1322 matrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top)); | 1331 matrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top)); |
| 1323 | 1332 |
| 1324 // This function can be called in the midst of drawing another object (e.g.,
when uploading a | 1333 // This function can be called in the midst of drawing another object (e.g.,
when uploading a |
| 1325 // SW-rasterized clip while issuing a draw). So we push the current geometry
state before | 1334 // SW-rasterized clip while issuing a draw). So we push the current geometry
state before |
| 1326 // drawing a rect to the render target. | 1335 // drawing a rect to the render target. |
| 1327 // The bracket ensures we pop the stack if we wind up flushing below. | 1336 // The bracket ensures we pop the stack if we wind up flushing below. |
| 1328 { | 1337 { |
| 1329 GrDrawTarget* drawTarget = this->prepareToDraw(NULL, NULL, NULL); | 1338 GrDrawTarget* drawTarget = this->prepareToDraw(NULL, NULL, NULL, NULL); |
| 1330 GrDrawTarget::AutoGeometryPush agp(drawTarget); | 1339 GrDrawTarget::AutoGeometryPush agp(drawTarget); |
| 1331 | 1340 |
| 1332 GrDrawState drawState(matrix); | 1341 GrDrawState drawState(matrix); |
| 1333 drawState.addColorProcessor(fp); | 1342 drawState.addColorProcessor(fp); |
| 1334 drawState.setRenderTarget(renderTarget); | 1343 drawState.setRenderTarget(renderTarget); |
| 1335 drawTarget->drawSimpleRect(&drawState, GrColor_WHITE,SkRect::MakeWH(SkIn
tToScalar(width), | 1344 drawTarget->drawSimpleRect(&drawState, GrColor_WHITE,SkRect::MakeWH(SkIn
tToScalar(width), |
| 1336 SkIn
tToScalar(height))); | 1345 SkIn
tToScalar(height))); |
| 1337 } | 1346 } |
| 1338 | 1347 |
| 1339 if (kFlushWrites_PixelOp & pixelOpsFlags) { | 1348 if (kFlushWrites_PixelOp & pixelOpsFlags) { |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1500 GrRenderTarget* rt = surface->asRenderTarget(); | 1509 GrRenderTarget* rt = surface->asRenderTarget(); |
| 1501 if (fGpu && rt) { | 1510 if (fGpu && rt) { |
| 1502 fGpu->resolveRenderTarget(rt); | 1511 fGpu->resolveRenderTarget(rt); |
| 1503 } | 1512 } |
| 1504 } | 1513 } |
| 1505 | 1514 |
| 1506 void GrContext::discardRenderTarget(GrRenderTarget* renderTarget) { | 1515 void GrContext::discardRenderTarget(GrRenderTarget* renderTarget) { |
| 1507 SkASSERT(renderTarget); | 1516 SkASSERT(renderTarget); |
| 1508 ASSERT_OWNED_RESOURCE(renderTarget); | 1517 ASSERT_OWNED_RESOURCE(renderTarget); |
| 1509 AutoCheckFlush acf(this); | 1518 AutoCheckFlush acf(this); |
| 1510 GrDrawTarget* target = this->prepareToDraw(NULL, NULL, &acf); | 1519 GrDrawTarget* target = this->prepareToDraw(NULL, NULL, NULL, &acf); |
| 1511 if (NULL == target) { | 1520 if (NULL == target) { |
| 1512 return; | 1521 return; |
| 1513 } | 1522 } |
| 1514 target->discard(renderTarget); | 1523 target->discard(renderTarget); |
| 1515 } | 1524 } |
| 1516 | 1525 |
| 1517 void GrContext::copySurface(GrSurface* dst, GrSurface* src, const SkIRect& srcRe
ct, | 1526 void GrContext::copySurface(GrSurface* dst, GrSurface* src, const SkIRect& srcRe
ct, |
| 1518 const SkIPoint& dstPoint, uint32_t pixelOpsFlags) { | 1527 const SkIPoint& dstPoint, uint32_t pixelOpsFlags) { |
| 1519 if (NULL == src || NULL == dst) { | 1528 if (NULL == src || NULL == dst) { |
| 1520 return; | 1529 return; |
| 1521 } | 1530 } |
| 1522 ASSERT_OWNED_RESOURCE(src); | 1531 ASSERT_OWNED_RESOURCE(src); |
| 1523 ASSERT_OWNED_RESOURCE(dst); | 1532 ASSERT_OWNED_RESOURCE(dst); |
| 1524 | 1533 |
| 1525 // Since we're going to the draw target and not GPU, no need to check kNoFlu
sh | 1534 // Since we're going to the draw target and not GPU, no need to check kNoFlu
sh |
| 1526 // here. | 1535 // here. |
| 1527 | 1536 |
| 1528 GrDrawTarget* target = this->prepareToDraw(NULL, NULL, NULL); | 1537 GrDrawTarget* target = this->prepareToDraw(NULL, NULL, NULL, NULL); |
| 1529 if (NULL == target) { | 1538 if (NULL == target) { |
| 1530 return; | 1539 return; |
| 1531 } | 1540 } |
| 1532 target->copySurface(dst, src, srcRect, dstPoint); | 1541 target->copySurface(dst, src, srcRect, dstPoint); |
| 1533 | 1542 |
| 1534 if (kFlushWrites_PixelOp & pixelOpsFlags) { | 1543 if (kFlushWrites_PixelOp & pixelOpsFlags) { |
| 1535 this->flush(); | 1544 this->flush(); |
| 1536 } | 1545 } |
| 1537 } | 1546 } |
| 1538 | 1547 |
| 1539 void GrContext::flushSurfaceWrites(GrSurface* surface) { | 1548 void GrContext::flushSurfaceWrites(GrSurface* surface) { |
| 1540 if (surface->surfacePriv().hasPendingWrite()) { | 1549 if (surface->surfacePriv().hasPendingWrite()) { |
| 1541 this->flush(); | 1550 this->flush(); |
| 1542 } | 1551 } |
| 1543 } | 1552 } |
| 1544 | 1553 |
| 1545 GrDrawTarget* GrContext::prepareToDraw(GrDrawState* ds, | 1554 GrDrawTarget* GrContext::prepareToDraw(GrDrawState* ds, |
| 1546 const GrPaint* paint, | 1555 const GrPaint* paint, |
| 1556 const SkMatrix* viewMatrix, |
| 1547 const AutoCheckFlush* acf) { | 1557 const AutoCheckFlush* acf) { |
| 1548 if (NULL == fGpu) { | 1558 if (NULL == fGpu) { |
| 1549 return NULL; | 1559 return NULL; |
| 1550 } | 1560 } |
| 1551 | 1561 |
| 1552 ASSERT_OWNED_RESOURCE(fRenderTarget.get()); | 1562 ASSERT_OWNED_RESOURCE(fRenderTarget.get()); |
| 1553 if (ds) { | 1563 if (ds) { |
| 1564 SkASSERT(viewMatrix); |
| 1554 if (paint) { | 1565 if (paint) { |
| 1555 SkASSERT(acf); | 1566 SkASSERT(acf); |
| 1556 ds->setFromPaint(*paint, fViewMatrix, fRenderTarget.get()); | 1567 ds->setFromPaint(*paint, *viewMatrix, fRenderTarget.get()); |
| 1557 #if GR_DEBUG_PARTIAL_COVERAGE_CHECK | 1568 #if GR_DEBUG_PARTIAL_COVERAGE_CHECK |
| 1558 if ((paint->hasMask()) && | 1569 if ((paint->hasMask()) && |
| 1559 !fDrawState->canUseFracCoveragePrimProc(paint.getColor(), fGpu->
caps())) { | 1570 !fDrawState->canUseFracCoveragePrimProc(paint.getColor(), fGpu->
caps())) { |
| 1560 SkDebugf("Partial pixel coverage will be incorrectly blended.\n"
); | 1571 SkDebugf("Partial pixel coverage will be incorrectly blended.\n"
); |
| 1561 } | 1572 } |
| 1562 #endif | 1573 #endif |
| 1563 } else { | 1574 } else { |
| 1564 ds->reset(fViewMatrix); | 1575 ds->reset(*viewMatrix); |
| 1565 ds->setRenderTarget(fRenderTarget.get()); | 1576 ds->setRenderTarget(fRenderTarget.get()); |
| 1566 } | 1577 } |
| 1567 ds->setState(GrDrawState::kClip_StateBit, fClip && !fClip->fClipStack->i
sWideOpen()); | 1578 ds->setState(GrDrawState::kClip_StateBit, fClip && !fClip->fClipStack->i
sWideOpen()); |
| 1568 } | 1579 } |
| 1569 fDrawBuffer->setClip(fClip); | 1580 fDrawBuffer->setClip(fClip); |
| 1570 return fDrawBuffer; | 1581 return fDrawBuffer; |
| 1571 } | 1582 } |
| 1572 | 1583 |
| 1573 /* | 1584 /* |
| 1574 * This method finds a path renderer that can draw the specified path on | 1585 * This method finds a path renderer that can draw the specified path on |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1640 SkNEW_ARGS(GrIndexBufferAllocPool, (fGpu, false, | 1651 SkNEW_ARGS(GrIndexBufferAllocPool, (fGpu, false, |
| 1641 DRAW_BUFFER_IBPOOL_BUFFER_SIZE, | 1652 DRAW_BUFFER_IBPOOL_BUFFER_SIZE, |
| 1642 DRAW_BUFFER_IBPOOL_PREALLOC_BUFFERS)); | 1653 DRAW_BUFFER_IBPOOL_PREALLOC_BUFFERS)); |
| 1643 | 1654 |
| 1644 fDrawBuffer = SkNEW_ARGS(GrInOrderDrawBuffer, (fGpu, | 1655 fDrawBuffer = SkNEW_ARGS(GrInOrderDrawBuffer, (fGpu, |
| 1645 fDrawBufferVBAllocPool, | 1656 fDrawBufferVBAllocPool, |
| 1646 fDrawBufferIBAllocPool)); | 1657 fDrawBufferIBAllocPool)); |
| 1647 } | 1658 } |
| 1648 | 1659 |
| 1649 GrDrawTarget* GrContext::getTextTarget() { | 1660 GrDrawTarget* GrContext::getTextTarget() { |
| 1650 return this->prepareToDraw(NULL, NULL, NULL); | 1661 return this->prepareToDraw(NULL, NULL, NULL, NULL); |
| 1651 } | 1662 } |
| 1652 | 1663 |
| 1653 const GrIndexBuffer* GrContext::getQuadIndexBuffer() const { | 1664 const GrIndexBuffer* GrContext::getQuadIndexBuffer() const { |
| 1654 return fGpu->getQuadIndexBuffer(); | 1665 return fGpu->getQuadIndexBuffer(); |
| 1655 } | 1666 } |
| 1656 | 1667 |
| 1657 namespace { | 1668 namespace { |
| 1658 void test_pm_conversions(GrContext* ctx, int* pmToUPMValue, int* upmToPMValue) { | 1669 void test_pm_conversions(GrContext* ctx, int* pmToUPMValue, int* upmToPMValue) { |
| 1659 GrConfigConversionEffect::PMConversion pmToUPM; | 1670 GrConfigConversionEffect::PMConversion pmToUPM; |
| 1660 GrConfigConversionEffect::PMConversion upmToPM; | 1671 GrConfigConversionEffect::PMConversion upmToPM; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1724 fResourceCache2->printStats(); | 1735 fResourceCache2->printStats(); |
| 1725 } | 1736 } |
| 1726 #endif | 1737 #endif |
| 1727 | 1738 |
| 1728 #if GR_GPU_STATS | 1739 #if GR_GPU_STATS |
| 1729 const GrContext::GPUStats* GrContext::gpuStats() const { | 1740 const GrContext::GPUStats* GrContext::gpuStats() const { |
| 1730 return fGpu->gpuStats(); | 1741 return fGpu->gpuStats(); |
| 1731 } | 1742 } |
| 1732 #endif | 1743 #endif |
| 1733 | 1744 |
| OLD | NEW |