| 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 viewM.mapRect(&devBounds); | 541 viewM.mapRect(&devBounds); |
| 542 | 542 |
| 543 GrDeviceCoordTexture dstCopy; | 543 GrDeviceCoordTexture dstCopy; |
| 544 if (!this->setupDstReadIfNecessary(&dstCopy, &devBounds)) { | 544 if (!this->setupDstReadIfNecessary(&dstCopy, &devBounds)) { |
| 545 return; | 545 return; |
| 546 } | 546 } |
| 547 | 547 |
| 548 this->onDrawPath(path, fill, dstCopy.texture() ? &dstCopy : NULL); | 548 this->onDrawPath(path, fill, dstCopy.texture() ? &dstCopy : NULL); |
| 549 } | 549 } |
| 550 | 550 |
| 551 void GrDrawTarget::instantGpuTraceEvent(const char* marker) { | 551 void GrDrawTarget::addGpuTraceMarker(GrGpuTraceMarker* marker) { |
| 552 if (this->caps()->gpuTracingSupport()) { | 552 if (this->caps()->gpuTracingSupport()) { |
| 553 this->onInstantGpuTraceEvent(marker); | 553 SkASSERT(fGpuTraceMarkerCount >= 0); |
| 554 this->fActiveTraceMarkers.add(*marker); |
| 555 this->didAddGpuTraceMarker(); |
| 556 ++fGpuTraceMarkerCount; |
| 554 } | 557 } |
| 555 } | 558 } |
| 556 | 559 |
| 557 void GrDrawTarget::pushGpuTraceEvent(const char* marker) { | 560 void GrDrawTarget::removeGpuTraceMarker(GrGpuTraceMarker* marker) { |
| 558 SkASSERT(fPushGpuTraceCount >= 0); | |
| 559 if (this->caps()->gpuTracingSupport()) { | 561 if (this->caps()->gpuTracingSupport()) { |
| 560 this->onPushGpuTraceEvent(marker); | 562 SkASSERT(fGpuTraceMarkerCount >= 1); |
| 561 ++fPushGpuTraceCount; | 563 this->fActiveTraceMarkers.remove(*marker); |
| 564 this->didRemoveGpuTraceMarker(); |
| 565 --fGpuTraceMarkerCount; |
| 562 } | 566 } |
| 563 } | 567 } |
| 564 | 568 |
| 565 void GrDrawTarget::popGpuTraceEvent() { | |
| 566 SkASSERT(fPushGpuTraceCount >= 1); | |
| 567 if (this->caps()->gpuTracingSupport()) { | |
| 568 this->onPopGpuTraceEvent(); | |
| 569 --fPushGpuTraceCount; | |
| 570 } | |
| 571 } | |
| 572 | |
| 573 //////////////////////////////////////////////////////////////////////////////// | 569 //////////////////////////////////////////////////////////////////////////////// |
| 574 | 570 |
| 575 bool GrDrawTarget::willUseHWAALines() const { | 571 bool GrDrawTarget::willUseHWAALines() const { |
| 576 // There is a conflict between using smooth lines and our use of premultipli
ed alpha. Smooth | 572 // There is a conflict between using smooth lines and our use of premultipli
ed alpha. Smooth |
| 577 // lines tweak the incoming alpha value but not in a premul-alpha way. So we
only use them when | 573 // lines tweak the incoming alpha value but not in a premul-alpha way. So we
only use them when |
| 578 // our alpha is 0xff and tweaking the color for partial coverage is OK | 574 // our alpha is 0xff and tweaking the color for partial coverage is OK |
| 579 if (!this->caps()->hwAALineSupport() || | 575 if (!this->caps()->hwAALineSupport() || |
| 580 !this->getDrawState().isHWAntialiasState()) { | 576 !this->getDrawState().isHWAntialiasState()) { |
| 581 return false; | 577 return false; |
| 582 } | 578 } |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) { | 1068 for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) { |
| 1073 if (i != kUnknown_GrPixelConfig) { | 1069 if (i != kUnknown_GrPixelConfig) { |
| 1074 r.appendf("%s is renderable: %s, with MSAA: %s\n", | 1070 r.appendf("%s is renderable: %s, with MSAA: %s\n", |
| 1075 kConfigNames[i], | 1071 kConfigNames[i], |
| 1076 gNY[fConfigRenderSupport[i][0]], | 1072 gNY[fConfigRenderSupport[i][0]], |
| 1077 gNY[fConfigRenderSupport[i][1]]); | 1073 gNY[fConfigRenderSupport[i][1]]); |
| 1078 } | 1074 } |
| 1079 } | 1075 } |
| 1080 return r; | 1076 return r; |
| 1081 } | 1077 } |
| OLD | NEW |