add /img/n/m endpoint to skiaserve
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1755563003
Review URL: https://codereview.chromium.org/1755563003
diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp
index dc529a4..a58db14 100644
--- a/tools/debugger/SkDebugCanvas.cpp
+++ b/tools/debugger/SkDebugCanvas.cpp
@@ -196,7 +196,7 @@
}
-void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) {
+void SkDebugCanvas::drawTo(SkCanvas* canvas, int index, int m) {
SkASSERT(!fCommandVector.isEmpty());
SkASSERT(index < fCommandVector.count());
@@ -228,7 +228,7 @@
#if SK_SUPPORT_GPU
GrAuditTrail* at = nullptr;
GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget();
- if (rt && fDrawGpuBatchBounds) {
+ if (rt && (fDrawGpuBatchBounds || m != -1)) {
GrContext* ctx = rt->getContext();
if (ctx) {
at = ctx->getAuditTrail();
@@ -344,7 +344,12 @@
// get the bounding boxes to draw
GrAuditTrail::AutoEnable ae(at);
SkTArray<GrAuditTrail::BatchInfo> childrenBounds;
- at->getBoundsByClientID(&childrenBounds, index);
+ if (m == -1) {
+ at->getBoundsByClientID(&childrenBounds, index);
+ } else {
+ // the client wants us to draw the mth batch
+ at->getBoundsByBatchListID(&childrenBounds.push_back(), m);
+ }
SkPaint paint;
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(1);
diff --git a/tools/debugger/SkDebugCanvas.h b/tools/debugger/SkDebugCanvas.h
index d81d471..7379698 100644
--- a/tools/debugger/SkDebugCanvas.h
+++ b/tools/debugger/SkDebugCanvas.h
@@ -68,8 +68,9 @@
Executes the draw calls up to the specified index.
@param canvas The canvas being drawn to
@param index The index of the final command being executed
+ @param m an optional Mth gpu batch to highlight, or -1
*/
- void drawTo(SkCanvas* canvas, int index);
+ void drawTo(SkCanvas* canvas, int index, int m = -1);
/**
Returns the most recently calculated transformation matrix