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);
}
SkMatrix inverse;
SkTCopyOnFirstWrite<GrPaint> 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
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) {
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;
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<GrGpuTraceMarker>(this->fMarkerArray.begin(), this->fMarkerArray.end() - 1);
SkString marker_string;
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(", ");
prevMarkerID = currMarker.fID;
++counter;
}
- if (counter > 0) {
+ if (counter > 0 && prevMarkerID != -1) {
marker_string.append(")");
}
return marker_string;
*/
SkString toString() const;
+ SkString toStringLast() const;
+
class Iter;
Iter begin() const;
///////////////////////////////////////////////////////////////////////////////
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;
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);
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);
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);
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);
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<SkGpuDevice*>(device);
if (dev->fNeedClear) {
// TODO: could check here whether we really need to draw at all
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;
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;
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()));
}
}