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 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 target->drawIndexed(primitiveType, 0, 0, vertexCount, indexCount); | 995 target->drawIndexed(primitiveType, 0, 0, vertexCount, indexCount); |
996 target->resetIndexSource(); | 996 target->resetIndexSource(); |
997 } else { | 997 } else { |
998 target->drawNonIndexed(primitiveType, 0, vertexCount); | 998 target->drawNonIndexed(primitiveType, 0, vertexCount); |
999 } | 999 } |
1000 } | 1000 } |
1001 | 1001 |
1002 /////////////////////////////////////////////////////////////////////////////// | 1002 /////////////////////////////////////////////////////////////////////////////// |
1003 | 1003 |
1004 void GrContext::drawRRect(const GrPaint& paint, | 1004 void GrContext::drawRRect(const GrPaint& paint, |
1005 const SkRRect& rect, | 1005 const SkRRect& rrect, |
1006 const SkStrokeRec& stroke) { | 1006 const SkStrokeRec& stroke) { |
1007 if (rect.isEmpty()) { | 1007 if (rrect.isEmpty()) { |
1008 return; | 1008 return; |
1009 } | 1009 } |
1010 | 1010 |
1011 AutoRestoreEffects are; | 1011 AutoRestoreEffects are; |
1012 AutoCheckFlush acf(this); | 1012 AutoCheckFlush acf(this); |
1013 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are, &acf
); | 1013 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are, &acf
); |
1014 | 1014 |
1015 GR_CREATE_TRACE_MARKER("GrContext::drawRRect", target); | 1015 GR_CREATE_TRACE_MARKER("GrContext::drawRRect", target); |
1016 | 1016 |
1017 if (!fOvalRenderer->drawSimpleRRect(target, this, paint.isAntiAlias(), rect,
stroke)) { | 1017 if (!fOvalRenderer->drawRRect(target, this, paint.isAntiAlias(), rrect, stro
ke)) { |
1018 SkPath path; | 1018 SkPath path; |
1019 path.addRRect(rect); | 1019 path.addRRect(rrect); |
1020 this->internalDrawPath(target, paint.isAntiAlias(), path, stroke); | 1020 this->internalDrawPath(target, paint.isAntiAlias(), path, stroke); |
1021 } | 1021 } |
1022 } | 1022 } |
1023 | 1023 |
1024 /////////////////////////////////////////////////////////////////////////////// | 1024 /////////////////////////////////////////////////////////////////////////////// |
1025 | 1025 |
| 1026 void GrContext::drawDRRect(const GrPaint& paint, |
| 1027 const SkRRect& outer, |
| 1028 const SkRRect& inner) { |
| 1029 if (outer.isEmpty()) { |
| 1030 return; |
| 1031 } |
| 1032 |
| 1033 AutoRestoreEffects are; |
| 1034 AutoCheckFlush acf(this); |
| 1035 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are, &acf
); |
| 1036 |
| 1037 GR_CREATE_TRACE_MARKER("GrContext::drawDRRect", target); |
| 1038 |
| 1039 if (!fOvalRenderer->drawDRRect(target, this, paint.isAntiAlias(), outer, inn
er)) { |
| 1040 SkPath path; |
| 1041 path.addRRect(inner); |
| 1042 path.addRRect(outer); |
| 1043 path.setFillType(SkPath::kEvenOdd_FillType); |
| 1044 |
| 1045 SkStrokeRec fillRec(SkStrokeRec::kFill_InitStyle); |
| 1046 this->internalDrawPath(target, paint.isAntiAlias(), path, fillRec); |
| 1047 } |
| 1048 } |
| 1049 |
| 1050 /////////////////////////////////////////////////////////////////////////////// |
| 1051 |
1026 void GrContext::drawOval(const GrPaint& paint, | 1052 void GrContext::drawOval(const GrPaint& paint, |
1027 const SkRect& oval, | 1053 const SkRect& oval, |
1028 const SkStrokeRec& stroke) { | 1054 const SkStrokeRec& stroke) { |
1029 if (oval.isEmpty()) { | 1055 if (oval.isEmpty()) { |
1030 return; | 1056 return; |
1031 } | 1057 } |
1032 | 1058 |
1033 AutoRestoreEffects are; | 1059 AutoRestoreEffects are; |
1034 AutoCheckFlush acf(this); | 1060 AutoCheckFlush acf(this); |
1035 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are, &acf
); | 1061 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are, &acf
); |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1798 } | 1824 } |
1799 return path; | 1825 return path; |
1800 } | 1826 } |
1801 | 1827 |
1802 /////////////////////////////////////////////////////////////////////////////// | 1828 /////////////////////////////////////////////////////////////////////////////// |
1803 #if GR_CACHE_STATS | 1829 #if GR_CACHE_STATS |
1804 void GrContext::printCacheStats() const { | 1830 void GrContext::printCacheStats() const { |
1805 fTextureCache->printStats(); | 1831 fTextureCache->printStats(); |
1806 } | 1832 } |
1807 #endif | 1833 #endif |
OLD | NEW |