diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 9cae6b05c8..85cc8cd787 100755 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -657,6 +657,7 @@ void GrContext::clear(const SkIRect* rect, GrRenderTarget* target) { AutoRestoreEffects are; AutoCheckFlush acf(this); + GR_CREATE_TRACE_MARKER_CONTEXT("GrContext::clear", this); this->prepareToDraw(NULL, BUFFERED_DRAW, &are, &acf)->clear(rect, color, canIgnoreRect, target); } @@ -671,6 +672,7 @@ void GrContext::drawPaint(const GrPaint& origPaint) { SkMatrix inverse; SkTCopyOnFirstWrite paint(origPaint); AutoMatrix am; + GR_CREATE_TRACE_MARKER_CONTEXT("GrContext::drawPaint", this); // We attempt to map r by the inverse matrix and draw that. mapRect will // map the four corners and bound them with a new rect. This will not @@ -808,7 +810,6 @@ void GrContext::drawRect(const GrPaint& paint, GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are, &acf); GR_CREATE_TRACE_MARKER("GrContext::drawRect", target); - SkScalar width = NULL == strokeInfo ? -1 : strokeInfo->getStrokeRec().getWidth(); SkMatrix combinedMatrix = target->drawState()->getViewMatrix(); if (NULL != matrix) { diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp index cdb1d892ce..dfff24792e 100644 --- a/src/gpu/GrInOrderDrawBuffer.cpp +++ b/src/gpu/GrInOrderDrawBuffer.cpp @@ -595,8 +595,9 @@ void GrInOrderDrawBuffer::flush() { fDstGpu->saveActiveTraceMarkers(); for (int c = 0; c < numCmds; ++c) { GrGpuTraceMarker newMarker("", -1); + SkString traceString; if (cmd_has_trace_marker(fCmds[c])) { - SkString traceString = fGpuCmdMarkers[currCmdMarker].toString(); + traceString = fGpuCmdMarkers[currCmdMarker].toString(); newMarker.fMarker = traceString.c_str(); fDstGpu->addGpuTraceMarker(&newMarker); ++currCmdMarker; diff --git a/src/gpu/GrTraceMarker.cpp b/src/gpu/GrTraceMarker.cpp index 11cdd5e2c2..bc6d456618 100644 --- a/src/gpu/GrTraceMarker.cpp +++ b/src/gpu/GrTraceMarker.cpp @@ -39,6 +39,21 @@ int GrTraceMarkerSet::count() const { return this->fMarkerArray.count(); } +SkString GrTraceMarkerSet::toStringLast() const { + const int numMarkers = this->fMarkerArray.count(); + SkString marker_string; + if (numMarkers > 0) { + GrGpuTraceMarker& lastMarker = this->fMarkerArray[numMarkers - 1]; + marker_string.append(lastMarker.fMarker); + if (lastMarker.fID != -1) { + marker_string.append("("); + marker_string.appendS32(lastMarker.fID); + marker_string.append(")"); + } + } + return marker_string; +} + SkString GrTraceMarkerSet::toString() const { SkTQSort(this->fMarkerArray.begin(), this->fMarkerArray.end() - 1); SkString marker_string; @@ -57,12 +72,14 @@ SkString GrTraceMarkerSet::toString() const { GrGpuTraceMarker& currMarker = this->fMarkerArray[i]; const char* currCmd = currMarker.fMarker; if (currCmd != prevMarkerName) { - if (counter != 0) { + if (prevMarkerID != -1) { marker_string.append(") "); } marker_string.append(currCmd); - marker_string.append("("); - marker_string.appendS32(currMarker.fID); + if (currMarker.fID != -1) { + marker_string.append("("); + marker_string.appendS32(currMarker.fID); + } prevMarkerName = currCmd; } else if (currMarker.fID != prevMarkerID) { marker_string.append(", "); @@ -71,7 +88,7 @@ SkString GrTraceMarkerSet::toString() const { prevMarkerID = currMarker.fID; ++counter; } - if (counter > 0) { + if (counter > 0 && prevMarkerID != -1) { marker_string.append(")"); } return marker_string; diff --git a/src/gpu/GrTraceMarker.h b/src/gpu/GrTraceMarker.h index fa4904e0c9..4ecda2c67a 100644 --- a/src/gpu/GrTraceMarker.h +++ b/src/gpu/GrTraceMarker.h @@ -55,6 +55,8 @@ public: */ SkString toString() const; + SkString toStringLast() const; + class Iter; Iter begin() const; diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index a0e40766a3..0dbc2fbbca 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -344,6 +344,7 @@ SK_COMPILE_ASSERT(SkShader::kLast_BitmapType == 6, shader_type_mismatch); /////////////////////////////////////////////////////////////////////////////// void SkGpuDevice::clear(SkColor color) { + GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::clear", fContext); SkIRect rect = SkIRect::MakeWH(this->width(), this->height()); fContext->clear(&rect, SkColor2GrColor(color), true, fRenderTarget); fNeedClear = false; @@ -351,6 +352,7 @@ void SkGpuDevice::clear(SkColor color) { void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { CHECK_SHOULD_DRAW(draw, false); + GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPaint", fContext); GrPaint grPaint; SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); @@ -471,6 +473,7 @@ void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect, const SkPaint& paint) { + GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawRRect", fContext); CHECK_FOR_ANNOTATION(paint); CHECK_SHOULD_DRAW(draw, false); @@ -559,6 +562,7 @@ void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& paint) { + GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawOval", fContext); CHECK_FOR_ANNOTATION(paint); CHECK_SHOULD_DRAW(draw, false); @@ -724,6 +728,7 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath, bool pathIsMutable) { CHECK_FOR_ANNOTATION(paint); CHECK_SHOULD_DRAW(draw, false); + GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPath", fContext); GrPaint grPaint; SkPaint2GrPaintShader(this->context(), paint, true, &grPaint); @@ -1500,6 +1505,7 @@ void SkGpuDevice::drawBitmapRect(const SkDraw& origDraw, const SkBitmap& bitmap, void SkGpuDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device, int x, int y, const SkPaint& paint) { // clear of the source device must occur before CHECK_SHOULD_DRAW + GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawDevice", fContext); SkGpuDevice* dev = static_cast(device); if (dev->fNeedClear) { // TODO: could check here whether we really need to draw at all @@ -1605,6 +1611,7 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode, const SkPaint& paint) { CHECK_SHOULD_DRAW(draw, false); + GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawVertices", fContext); // If both textures and vertex-colors are NULL, strokes hairlines with the paint's color. if ((NULL == texs || NULL == paint.getShader()) && NULL == colors) { texs = NULL; @@ -1678,6 +1685,7 @@ void SkGpuDevice::drawText(const SkDraw& draw, const void* text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint& paint) { CHECK_SHOULD_DRAW(draw, false); + GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawText", fContext); if (fMainTextContext->canDraw(paint)) { GrPaint grPaint; diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp index 2eb76a5aff..eddccc39f6 100644 --- a/src/gpu/gl/GrGpuGL.cpp +++ b/src/gpu/gl/GrGpuGL.cpp @@ -2982,7 +2982,7 @@ bool GrGpuGL::onCanCopySurface(GrSurface* dst, void GrGpuGL::didAddGpuTraceMarker() { if (this->caps()->gpuTracingSupport()) { const GrTraceMarkerSet& markerArray = this->getActiveTraceMarkers(); - SkString markerString = markerArray.toString(); + SkString markerString = markerArray.toStringLast(); GL_CALL(PushGroupMarker(0, markerString.c_str())); } }