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 | 9 |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 delete reinterpret_cast<int*>(v); | 84 delete reinterpret_cast<int*>(v); |
85 } | 85 } |
86 #define THREAD_INSTANCE_COUNT \ | 86 #define THREAD_INSTANCE_COUNT \ |
87 (*reinterpret_cast<int*>(SkTLS::Get(CreateThreadInstanceCount, DeleteThreadI nstanceCount))) | 87 (*reinterpret_cast<int*>(SkTLS::Get(CreateThreadInstanceCount, DeleteThreadI nstanceCount))) |
88 } | 88 } |
89 | 89 |
90 GrContext::GrContext() { | 90 GrContext::GrContext() { |
91 ++THREAD_INSTANCE_COUNT; | 91 ++THREAD_INSTANCE_COUNT; |
92 fDrawState = NULL; | 92 fDrawState = NULL; |
93 fGpu = NULL; | 93 fGpu = NULL; |
94 fClip = NULL; | |
94 fPathRendererChain = NULL; | 95 fPathRendererChain = NULL; |
95 fSoftwarePathRenderer = NULL; | 96 fSoftwarePathRenderer = NULL; |
96 fTextureCache = NULL; | 97 fTextureCache = NULL; |
97 fFontCache = NULL; | 98 fFontCache = NULL; |
98 fDrawBuffer = NULL; | 99 fDrawBuffer = NULL; |
99 fDrawBufferVBAllocPool = NULL; | 100 fDrawBufferVBAllocPool = NULL; |
100 fDrawBufferIBAllocPool = NULL; | 101 fDrawBufferIBAllocPool = NULL; |
101 fAARectRenderer = NULL; | 102 fAARectRenderer = NULL; |
102 fOvalRenderer = NULL; | 103 fOvalRenderer = NULL; |
jvanverth1
2013/05/28 15:28:59
Any init for RenderTarget needed?
bsalomon
2013/05/28 15:33:29
SkAutoTUnref defaults to NULL.
| |
104 fViewMatrix.reset(); | |
103 } | 105 } |
104 | 106 |
105 bool GrContext::init(GrBackend backend, GrBackendContext backendContext) { | 107 bool GrContext::init(GrBackend backend, GrBackendContext backendContext) { |
106 GrAssert(NULL == fGpu); | 108 GrAssert(NULL == fGpu); |
107 | 109 |
108 fGpu = GrGpu::Create(backend, backendContext, this); | 110 fGpu = GrGpu::Create(backend, backendContext, this); |
109 if (NULL == fGpu) { | 111 if (NULL == fGpu) { |
110 return false; | 112 return false; |
111 } | 113 } |
112 | 114 |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
587 | 589 |
588 if (!isPow2) { | 590 if (!isPow2) { |
589 bool tiled = NULL != params && params->isTiled(); | 591 bool tiled = NULL != params && params->isTiled(); |
590 if (tiled && !caps->npotTextureTileSupport()) { | 592 if (tiled && !caps->npotTextureTileSupport()) { |
591 return false; | 593 return false; |
592 } | 594 } |
593 } | 595 } |
594 return true; | 596 return true; |
595 } | 597 } |
596 | 598 |
597 //////////////////////////////////////////////////////////////////////////////// | |
598 | |
599 const GrClipData* GrContext::getClip() const { | |
600 return fGpu->getClip(); | |
601 } | |
602 | |
603 void GrContext::setClip(const GrClipData* clipData) { | |
604 fGpu->setClip(clipData); | |
605 | |
606 fDrawState->setState(GrDrawState::kClip_StateBit, | |
607 clipData && clipData->fClipStack && !clipData->fClipSta ck->isWideOpen()); | |
608 } | |
609 | 599 |
610 //////////////////////////////////////////////////////////////////////////////// | 600 //////////////////////////////////////////////////////////////////////////////// |
611 | 601 |
612 void GrContext::clear(const GrIRect* rect, | 602 void GrContext::clear(const GrIRect* rect, |
613 const GrColor color, | 603 const GrColor color, |
614 GrRenderTarget* target) { | 604 GrRenderTarget* target) { |
615 this->prepareToDraw(NULL, BUFFERED_DRAW)->clear(rect, color, target); | 605 this->prepareToDraw(NULL, BUFFERED_DRAW)->clear(rect, color, target); |
616 } | 606 } |
617 | 607 |
618 void GrContext::drawPaint(const GrPaint& origPaint) { | 608 void GrContext::drawPaint(const GrPaint& origPaint) { |
619 // set rect to be big enough to fill the space, but not super-huge, so we | 609 // set rect to be big enough to fill the space, but not super-huge, so we |
620 // don't overflow fixed-point implementations | 610 // don't overflow fixed-point implementations |
621 GrRect r; | 611 GrRect r; |
622 r.setLTRB(0, 0, | 612 r.setLTRB(0, 0, |
623 SkIntToScalar(getRenderTarget()->width()), | 613 SkIntToScalar(getRenderTarget()->width()), |
624 SkIntToScalar(getRenderTarget()->height())); | 614 SkIntToScalar(getRenderTarget()->height())); |
625 SkMatrix inverse; | 615 SkMatrix inverse; |
626 SkTCopyOnFirstWrite<GrPaint> paint(origPaint); | 616 SkTCopyOnFirstWrite<GrPaint> paint(origPaint); |
627 AutoMatrix am; | 617 AutoMatrix am; |
628 | 618 |
629 // We attempt to map r by the inverse matrix and draw that. mapRect will | 619 // We attempt to map r by the inverse matrix and draw that. mapRect will |
630 // map the four corners and bound them with a new rect. This will not | 620 // map the four corners and bound them with a new rect. This will not |
631 // produce a correct result for some perspective matrices. | 621 // produce a correct result for some perspective matrices. |
632 if (!this->getMatrix().hasPerspective()) { | 622 if (!this->getMatrix().hasPerspective()) { |
633 if (!fDrawState->getViewInverse(&inverse)) { | 623 if (!fViewMatrix.invert(&inverse)) { |
634 GrPrintf("Could not invert matrix\n"); | 624 GrPrintf("Could not invert matrix\n"); |
635 return; | 625 return; |
636 } | 626 } |
637 inverse.mapRect(&r); | 627 inverse.mapRect(&r); |
638 } else { | 628 } else { |
639 if (!am.setIdentity(this, paint.writable())) { | 629 if (!am.setIdentity(this, paint.writable())) { |
640 GrPrintf("Could not invert matrix\n"); | 630 GrPrintf("Could not invert matrix\n"); |
641 return; | 631 return; |
642 } | 632 } |
643 } | 633 } |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
775 const SkMatrix* matrix) { | 765 const SkMatrix* matrix) { |
776 SK_TRACE_EVENT0("GrContext::drawRect"); | 766 SK_TRACE_EVENT0("GrContext::drawRect"); |
777 | 767 |
778 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW); | 768 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW); |
779 GrDrawState::AutoStageDisable atr(fDrawState); | 769 GrDrawState::AutoStageDisable atr(fDrawState); |
780 | 770 |
781 GrRect devRect; | 771 GrRect devRect; |
782 SkMatrix combinedMatrix; | 772 SkMatrix combinedMatrix; |
783 bool useVertexCoverage; | 773 bool useVertexCoverage; |
784 bool needAA = paint.isAntiAlias() && | 774 bool needAA = paint.isAntiAlias() && |
785 !this->getRenderTarget()->isMultisampled(); | 775 !target->getDrawState().getRenderTarget()->isMultisampled(); |
786 bool doAA = needAA && apply_aa_to_rect(target, rect, width, matrix, | 776 bool doAA = needAA && apply_aa_to_rect(target, rect, width, matrix, |
787 &combinedMatrix, &devRect, | 777 &combinedMatrix, &devRect, |
788 &useVertexCoverage); | 778 &useVertexCoverage); |
789 if (doAA) { | 779 if (doAA) { |
790 GrDrawState::AutoDeviceCoordDraw adcd(target->drawState()); | 780 GrDrawState::AutoDeviceCoordDraw adcd(target->drawState()); |
791 if (!adcd.succeeded()) { | 781 if (!adcd.succeeded()) { |
792 return; | 782 return; |
793 } | 783 } |
794 if (width >= 0) { | 784 if (width >= 0) { |
795 fAARectRenderer->strokeAARect(this->getGpu(), target, | 785 fAARectRenderer->strokeAARect(this->getGpu(), target, |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
959 /////////////////////////////////////////////////////////////////////////////// | 949 /////////////////////////////////////////////////////////////////////////////// |
960 | 950 |
961 void GrContext::drawRRect(const GrPaint& paint, | 951 void GrContext::drawRRect(const GrPaint& paint, |
962 const SkRRect& rect, | 952 const SkRRect& rect, |
963 const SkStrokeRec& stroke) { | 953 const SkStrokeRec& stroke) { |
964 | 954 |
965 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW); | 955 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW); |
966 GrDrawState::AutoStageDisable atr(fDrawState); | 956 GrDrawState::AutoStageDisable atr(fDrawState); |
967 | 957 |
968 bool useAA = paint.isAntiAlias() && | 958 bool useAA = paint.isAntiAlias() && |
969 !this->getRenderTarget()->isMultisampled() && | 959 !target->getDrawState().getRenderTarget()->isMultisampled() && |
970 !disable_coverage_aa_for_blend(target); | 960 !disable_coverage_aa_for_blend(target); |
971 | 961 |
972 if (!fOvalRenderer->drawSimpleRRect(target, this, useAA, rect, stroke)) { | 962 if (!fOvalRenderer->drawSimpleRRect(target, this, useAA, rect, stroke)) { |
973 SkPath path; | 963 SkPath path; |
974 path.addRRect(rect); | 964 path.addRRect(rect); |
975 this->internalDrawPath(target, useAA, path, stroke); | 965 this->internalDrawPath(target, useAA, path, stroke); |
976 } | 966 } |
977 } | 967 } |
978 | 968 |
979 /////////////////////////////////////////////////////////////////////////////// | 969 /////////////////////////////////////////////////////////////////////////////// |
980 | 970 |
981 void GrContext::drawOval(const GrPaint& paint, | 971 void GrContext::drawOval(const GrPaint& paint, |
982 const GrRect& oval, | 972 const GrRect& oval, |
983 const SkStrokeRec& stroke) { | 973 const SkStrokeRec& stroke) { |
984 | 974 |
985 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW); | 975 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW); |
986 GrDrawState::AutoStageDisable atr(fDrawState); | 976 GrDrawState::AutoStageDisable atr(fDrawState); |
987 | 977 |
988 bool useAA = paint.isAntiAlias() && | 978 bool useAA = paint.isAntiAlias() && |
989 !this->getRenderTarget()->isMultisampled() && | 979 !target->getDrawState().getRenderTarget()->isMultisampled() && |
990 !disable_coverage_aa_for_blend(target); | 980 !disable_coverage_aa_for_blend(target); |
991 | 981 |
992 if (!fOvalRenderer->drawOval(target, this, useAA, oval, stroke)) { | 982 if (!fOvalRenderer->drawOval(target, this, useAA, oval, stroke)) { |
993 SkPath path; | 983 SkPath path; |
994 path.addOval(oval); | 984 path.addOval(oval); |
995 this->internalDrawPath(target, useAA, path, stroke); | 985 this->internalDrawPath(target, useAA, path, stroke); |
996 } | 986 } |
997 } | 987 } |
998 | 988 |
999 namespace { | 989 namespace { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1135 } | 1125 } |
1136 | 1126 |
1137 //////////////////////////////////////////////////////////////////////////////// | 1127 //////////////////////////////////////////////////////////////////////////////// |
1138 | 1128 |
1139 void GrContext::flush(int flagsBitfield) { | 1129 void GrContext::flush(int flagsBitfield) { |
1140 if (kDiscard_FlushBit & flagsBitfield) { | 1130 if (kDiscard_FlushBit & flagsBitfield) { |
1141 fDrawBuffer->reset(); | 1131 fDrawBuffer->reset(); |
1142 } else { | 1132 } else { |
1143 this->flushDrawBuffer(); | 1133 this->flushDrawBuffer(); |
1144 } | 1134 } |
1135 // TODO: Remove this flag | |
1145 if (kForceCurrentRenderTarget_FlushBit & flagsBitfield) { | 1136 if (kForceCurrentRenderTarget_FlushBit & flagsBitfield) { |
1137 fGpu->drawState()->setRenderTarget(this->getRenderTarget()); | |
1146 fGpu->forceRenderTargetFlush(); | 1138 fGpu->forceRenderTargetFlush(); |
1147 } | 1139 } |
1148 } | 1140 } |
1149 | 1141 |
1150 void GrContext::flushDrawBuffer() { | 1142 void GrContext::flushDrawBuffer() { |
1151 if (NULL != fDrawBuffer && !fDrawBuffer->isFlushing()) { | 1143 if (NULL != fDrawBuffer && !fDrawBuffer->isFlushing()) { |
1152 fDrawBuffer->flush(); | 1144 fDrawBuffer->flush(); |
1153 } | 1145 } |
1154 } | 1146 } |
1155 | 1147 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1249 } | 1241 } |
1250 | 1242 |
1251 bool GrContext::readRenderTargetPixels(GrRenderTarget* target, | 1243 bool GrContext::readRenderTargetPixels(GrRenderTarget* target, |
1252 int left, int top, int width, int height, | 1244 int left, int top, int width, int height, |
1253 GrPixelConfig dstConfig, void* buffer, si ze_t rowBytes, | 1245 GrPixelConfig dstConfig, void* buffer, si ze_t rowBytes, |
1254 uint32_t flags) { | 1246 uint32_t flags) { |
1255 SK_TRACE_EVENT0("GrContext::readRenderTargetPixels"); | 1247 SK_TRACE_EVENT0("GrContext::readRenderTargetPixels"); |
1256 ASSERT_OWNED_RESOURCE(target); | 1248 ASSERT_OWNED_RESOURCE(target); |
1257 | 1249 |
1258 if (NULL == target) { | 1250 if (NULL == target) { |
1259 target = fDrawState->getRenderTarget(); | 1251 target = fRenderTarget.get(); |
1260 if (NULL == target) { | 1252 if (NULL == target) { |
1261 return false; | 1253 return false; |
1262 } | 1254 } |
1263 } | 1255 } |
1264 | 1256 |
1265 if (!(kDontFlush_PixelOpsFlag & flags)) { | 1257 if (!(kDontFlush_PixelOpsFlag & flags)) { |
1266 this->flush(); | 1258 this->flush(); |
1267 } | 1259 } |
1268 | 1260 |
1269 // Determine which conversions have to be applied: flipY, swapRAnd, and/or u npremul. | 1261 // Determine which conversions have to be applied: flipY, swapRAnd, and/or u npremul. |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1436 bool GrContext::writeRenderTargetPixels(GrRenderTarget* target, | 1428 bool GrContext::writeRenderTargetPixels(GrRenderTarget* target, |
1437 int left, int top, int width, int height , | 1429 int left, int top, int width, int height , |
1438 GrPixelConfig srcConfig, | 1430 GrPixelConfig srcConfig, |
1439 const void* buffer, | 1431 const void* buffer, |
1440 size_t rowBytes, | 1432 size_t rowBytes, |
1441 uint32_t flags) { | 1433 uint32_t flags) { |
1442 SK_TRACE_EVENT0("GrContext::writeRenderTargetPixels"); | 1434 SK_TRACE_EVENT0("GrContext::writeRenderTargetPixels"); |
1443 ASSERT_OWNED_RESOURCE(target); | 1435 ASSERT_OWNED_RESOURCE(target); |
1444 | 1436 |
1445 if (NULL == target) { | 1437 if (NULL == target) { |
1446 target = fDrawState->getRenderTarget(); | 1438 target = fRenderTarget.get(); |
1447 if (NULL == target) { | 1439 if (NULL == target) { |
1448 return false; | 1440 return false; |
1449 } | 1441 } |
1450 } | 1442 } |
1451 | 1443 |
1452 // TODO: when underlying api has a direct way to do this we should use it (e .g. glDrawPixels on | 1444 // TODO: when underlying api has a direct way to do this we should use it (e .g. glDrawPixels on |
1453 // desktop GL). | 1445 // desktop GL). |
1454 | 1446 |
1455 // We will always call some form of writeTexturePixels and we will pass our flags on to it. | 1447 // We will always call some form of writeTexturePixels and we will pass our flags on to it. |
1456 // Thus, we don't perform a flush here since that call will do it (if the kN oFlush flag isn't | 1448 // Thus, we don't perform a flush here since that call will do it (if the kN oFlush flag isn't |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1553 fGpu->drawSimpleRect(GrRect::MakeWH(SkIntToScalar(width), SkIntToScalar(heig ht)), NULL); | 1545 fGpu->drawSimpleRect(GrRect::MakeWH(SkIntToScalar(width), SkIntToScalar(heig ht)), NULL); |
1554 return true; | 1546 return true; |
1555 } | 1547 } |
1556 //////////////////////////////////////////////////////////////////////////////// | 1548 //////////////////////////////////////////////////////////////////////////////// |
1557 | 1549 |
1558 GrDrawTarget* GrContext::prepareToDraw(const GrPaint* paint, BufferedDraw buffer ed) { | 1550 GrDrawTarget* GrContext::prepareToDraw(const GrPaint* paint, BufferedDraw buffer ed) { |
1559 if (kNo_BufferedDraw == buffered && kYes_BufferedDraw == fLastDrawWasBuffere d) { | 1551 if (kNo_BufferedDraw == buffered && kYes_BufferedDraw == fLastDrawWasBuffere d) { |
1560 this->flushDrawBuffer(); | 1552 this->flushDrawBuffer(); |
1561 fLastDrawWasBuffered = kNo_BufferedDraw; | 1553 fLastDrawWasBuffered = kNo_BufferedDraw; |
1562 } | 1554 } |
1555 ASSERT_OWNED_RESOURCE(fRenderTarget.get()); | |
1563 if (NULL != paint) { | 1556 if (NULL != paint) { |
1564 GrAssert(fDrawState->stagesDisabled()); | 1557 GrAssert(fDrawState->stagesDisabled()); |
1565 fDrawState->setFromPaint(*paint); | 1558 fDrawState->setFromPaint(*paint, fViewMatrix, fRenderTarget.get()); |
1566 #if GR_DEBUG_PARTIAL_COVERAGE_CHECK | 1559 #if GR_DEBUG_PARTIAL_COVERAGE_CHECK |
1567 if ((paint->hasMask() || 0xff != paint->fCoverage) && | 1560 if ((paint->hasMask() || 0xff != paint->fCoverage) && |
1568 !fGpu->canApplyCoverage()) { | 1561 !fGpu->canApplyCoverage()) { |
1569 GrPrintf("Partial pixel coverage will be incorrectly blended.\n"); | 1562 GrPrintf("Partial pixel coverage will be incorrectly blended.\n"); |
1570 } | 1563 } |
1571 #endif | 1564 #endif |
1565 } else { | |
1566 fDrawState->reset(); | |
1567 *fDrawState->viewMatrix() = fViewMatrix; | |
jvanverth1
2013/05/28 15:28:59
While legal this seems a bit squirrely to me. Add
bsalomon
2013/05/28 15:33:29
My next CL removes this viewMatrix() function and
| |
1568 fDrawState->setRenderTarget(fRenderTarget.get()); | |
1572 } | 1569 } |
1570 GrDrawTarget* target; | |
1573 if (kYes_BufferedDraw == buffered) { | 1571 if (kYes_BufferedDraw == buffered) { |
1574 fDrawBuffer->setClip(fGpu->getClip()); | |
1575 fLastDrawWasBuffered = kYes_BufferedDraw; | 1572 fLastDrawWasBuffered = kYes_BufferedDraw; |
1576 return fDrawBuffer; | 1573 target = fDrawBuffer; |
1577 } else { | 1574 } else { |
1578 GrAssert(kNo_BufferedDraw == buffered); | 1575 GrAssert(kNo_BufferedDraw == buffered); |
1579 return fGpu; | 1576 fLastDrawWasBuffered = kNo_BufferedDraw; |
1577 target = fGpu; | |
1580 } | 1578 } |
1579 fDrawState->setState(GrDrawState::kClip_StateBit, NULL != fClip && | |
1580 !fClip->fClipStack->isWideO pen()); | |
1581 target->setClip(fClip); | |
1582 GrAssert(fDrawState == target->drawState()); | |
1583 return target; | |
1581 } | 1584 } |
1582 | 1585 |
1583 /* | 1586 /* |
1584 * This method finds a path renderer that can draw the specified path on | 1587 * This method finds a path renderer that can draw the specified path on |
1585 * the provided target. | 1588 * the provided target. |
1586 * Due to its expense, the software path renderer has split out so it can | 1589 * Due to its expense, the software path renderer has split out so it can |
1587 * can be individually allowed/disallowed via the "allowSW" boolean. | 1590 * can be individually allowed/disallowed via the "allowSW" boolean. |
1588 */ | 1591 */ |
1589 GrPathRenderer* GrContext::getPathRenderer(const SkPath& path, | 1592 GrPathRenderer* GrContext::getPathRenderer(const SkPath& path, |
1590 const SkStrokeRec& stroke, | 1593 const SkStrokeRec& stroke, |
(...skipping 17 matching lines...) Expand all Loading... | |
1608 fSoftwarePathRenderer = SkNEW_ARGS(GrSoftwarePathRenderer, (this)); | 1611 fSoftwarePathRenderer = SkNEW_ARGS(GrSoftwarePathRenderer, (this)); |
1609 } | 1612 } |
1610 pr = fSoftwarePathRenderer; | 1613 pr = fSoftwarePathRenderer; |
1611 } | 1614 } |
1612 | 1615 |
1613 return pr; | 1616 return pr; |
1614 } | 1617 } |
1615 | 1618 |
1616 //////////////////////////////////////////////////////////////////////////////// | 1619 //////////////////////////////////////////////////////////////////////////////// |
1617 | 1620 |
1618 void GrContext::setRenderTarget(GrRenderTarget* target) { | |
1619 ASSERT_OWNED_RESOURCE(target); | |
1620 fDrawState->setRenderTarget(target); | |
1621 } | |
1622 | |
1623 GrRenderTarget* GrContext::getRenderTarget() { | |
1624 return fDrawState->getRenderTarget(); | |
1625 } | |
1626 | |
1627 const GrRenderTarget* GrContext::getRenderTarget() const { | |
1628 return fDrawState->getRenderTarget(); | |
1629 } | |
1630 | |
1631 bool GrContext::isConfigRenderable(GrPixelConfig config) const { | 1621 bool GrContext::isConfigRenderable(GrPixelConfig config) const { |
1632 return fGpu->isConfigRenderable(config); | 1622 return fGpu->isConfigRenderable(config); |
1633 } | 1623 } |
1634 | 1624 |
1635 const SkMatrix& GrContext::getMatrix() const { | |
1636 return fDrawState->getViewMatrix(); | |
1637 } | |
1638 | |
1639 void GrContext::setMatrix(const SkMatrix& m) { | |
1640 fDrawState->setViewMatrix(m); | |
1641 } | |
1642 | |
1643 void GrContext::setIdentityMatrix() { | |
1644 fDrawState->viewMatrix()->reset(); | |
1645 } | |
1646 | |
1647 void GrContext::concatMatrix(const SkMatrix& m) const { | |
1648 fDrawState->preConcatViewMatrix(m); | |
1649 } | |
1650 | |
1651 static inline intptr_t setOrClear(intptr_t bits, int shift, intptr_t pred) { | 1625 static inline intptr_t setOrClear(intptr_t bits, int shift, intptr_t pred) { |
1652 intptr_t mask = 1 << shift; | 1626 intptr_t mask = 1 << shift; |
1653 if (pred) { | 1627 if (pred) { |
1654 bits |= mask; | 1628 bits |= mask; |
1655 } else { | 1629 } else { |
1656 bits &= ~mask; | 1630 bits &= ~mask; |
1657 } | 1631 } |
1658 return bits; | 1632 return bits; |
1659 } | 1633 } |
1660 | 1634 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1861 return srcTexture; | 1835 return srcTexture; |
1862 } | 1836 } |
1863 } | 1837 } |
1864 | 1838 |
1865 /////////////////////////////////////////////////////////////////////////////// | 1839 /////////////////////////////////////////////////////////////////////////////// |
1866 #if GR_CACHE_STATS | 1840 #if GR_CACHE_STATS |
1867 void GrContext::printCacheStats() const { | 1841 void GrContext::printCacheStats() const { |
1868 fTextureCache->printStats(); | 1842 fTextureCache->printStats(); |
1869 } | 1843 } |
1870 #endif | 1844 #endif |
OLD | NEW |