OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 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 | 10 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 82 } |
83 | 83 |
84 //////////////////////////////////////////////////////////////////////////////// | 84 //////////////////////////////////////////////////////////////////////////////// |
85 | 85 |
86 #define DEBUG_INVAL_BUFFER 0xdeadcafe | 86 #define DEBUG_INVAL_BUFFER 0xdeadcafe |
87 #define DEBUG_INVAL_START_IDX -1 | 87 #define DEBUG_INVAL_START_IDX -1 |
88 | 88 |
89 GrDrawTarget::GrDrawTarget(GrContext* context) | 89 GrDrawTarget::GrDrawTarget(GrContext* context) |
90 : fClip(NULL) | 90 : fClip(NULL) |
91 , fContext(context) | 91 , fContext(context) |
92 , fPushGpuTraceCount(0) { | 92 , fGpuTraceMarkerCount(0) { |
93 SkASSERT(NULL != context); | 93 SkASSERT(NULL != context); |
94 | 94 |
95 fDrawState = &fDefaultDrawState; | 95 fDrawState = &fDefaultDrawState; |
96 // We assume that fDrawState always owns a ref to the object it points at. | 96 // We assume that fDrawState always owns a ref to the object it points at. |
97 fDefaultDrawState.ref(); | 97 fDefaultDrawState.ref(); |
98 GeometrySrcState& geoSrc = fGeoSrcStateStack.push_back(); | 98 GeometrySrcState& geoSrc = fGeoSrcStateStack.push_back(); |
99 #ifdef SK_DEBUG | 99 #ifdef SK_DEBUG |
100 geoSrc.fVertexCount = DEBUG_INVAL_START_IDX; | 100 geoSrc.fVertexCount = DEBUG_INVAL_START_IDX; |
101 geoSrc.fVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER; | 101 geoSrc.fVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER; |
102 geoSrc.fIndexCount = DEBUG_INVAL_START_IDX; | 102 geoSrc.fIndexCount = DEBUG_INVAL_START_IDX; |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 | 571 |
572 GrDeviceCoordTexture dstCopy; | 572 GrDeviceCoordTexture dstCopy; |
573 if (!this->setupDstReadIfNecessary(&dstCopy, &devBounds)) { | 573 if (!this->setupDstReadIfNecessary(&dstCopy, &devBounds)) { |
574 return; | 574 return; |
575 } | 575 } |
576 | 576 |
577 this->onDrawPaths(pathCount, paths, transforms, fill, stroke, | 577 this->onDrawPaths(pathCount, paths, transforms, fill, stroke, |
578 dstCopy.texture() ? &dstCopy : NULL); | 578 dstCopy.texture() ? &dstCopy : NULL); |
579 } | 579 } |
580 | 580 |
581 void GrDrawTarget::instantGpuTraceEvent(const char* marker) { | 581 void GrDrawTarget::addGpuTraceMarker(GrGpuTraceMarker* marker) { |
582 if (this->caps()->gpuTracingSupport()) { | 582 if (this->caps()->gpuTracingSupport()) { |
583 this->onInstantGpuTraceEvent(marker); | 583 SkASSERT(fGpuTraceMarkerCount >= 0); |
| 584 this->fActiveTraceMarkers.add(*marker); |
| 585 this->didAddGpuTraceMarker(); |
| 586 ++fGpuTraceMarkerCount; |
584 } | 587 } |
585 } | 588 } |
586 | 589 |
587 void GrDrawTarget::pushGpuTraceEvent(const char* marker) { | 590 void GrDrawTarget::removeGpuTraceMarker(GrGpuTraceMarker* marker) { |
588 SkASSERT(fPushGpuTraceCount >= 0); | |
589 if (this->caps()->gpuTracingSupport()) { | 591 if (this->caps()->gpuTracingSupport()) { |
590 this->onPushGpuTraceEvent(marker); | 592 SkASSERT(fGpuTraceMarkerCount >= 1); |
591 ++fPushGpuTraceCount; | 593 this->fActiveTraceMarkers.remove(*marker); |
| 594 this->didRemoveGpuTraceMarker(); |
| 595 --fGpuTraceMarkerCount; |
592 } | 596 } |
593 } | 597 } |
594 | 598 |
595 void GrDrawTarget::popGpuTraceEvent() { | |
596 SkASSERT(fPushGpuTraceCount >= 1); | |
597 if (this->caps()->gpuTracingSupport()) { | |
598 this->onPopGpuTraceEvent(); | |
599 --fPushGpuTraceCount; | |
600 } | |
601 } | |
602 | |
603 //////////////////////////////////////////////////////////////////////////////// | 599 //////////////////////////////////////////////////////////////////////////////// |
604 | 600 |
605 bool GrDrawTarget::willUseHWAALines() const { | 601 bool GrDrawTarget::willUseHWAALines() const { |
606 // There is a conflict between using smooth lines and our use of premultipli
ed alpha. Smooth | 602 // There is a conflict between using smooth lines and our use of premultipli
ed alpha. Smooth |
607 // lines tweak the incoming alpha value but not in a premul-alpha way. So we
only use them when | 603 // lines tweak the incoming alpha value but not in a premul-alpha way. So we
only use them when |
608 // our alpha is 0xff and tweaking the color for partial coverage is OK | 604 // our alpha is 0xff and tweaking the color for partial coverage is OK |
609 if (!this->caps()->hwAALineSupport() || | 605 if (!this->caps()->hwAALineSupport() || |
610 !this->getDrawState().isHWAntialiasState()) { | 606 !this->getDrawState().isHWAntialiasState()) { |
611 return false; | 607 return false; |
612 } | 608 } |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) { | 1098 for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) { |
1103 if (i != kUnknown_GrPixelConfig) { | 1099 if (i != kUnknown_GrPixelConfig) { |
1104 r.appendf("%s is renderable: %s, with MSAA: %s\n", | 1100 r.appendf("%s is renderable: %s, with MSAA: %s\n", |
1105 kConfigNames[i], | 1101 kConfigNames[i], |
1106 gNY[fConfigRenderSupport[i][0]], | 1102 gNY[fConfigRenderSupport[i][0]], |
1107 gNY[fConfigRenderSupport[i][1]]); | 1103 gNY[fConfigRenderSupport[i][1]]); |
1108 } | 1104 } |
1109 } | 1105 } |
1110 return r; | 1106 return r; |
1111 } | 1107 } |
OLD | NEW |