bool SkBitmapProcShader::toDumpString(SkString* str) const { str->printf("BitmapShader: [%d %d %d", fRawBitmap.width(), fRawBitmap.height(), fRawBitmap.bytesPerPixel()); // add the pixelref SkPixelRef* pr = fRawBitmap.pixelRef(); if (pr) { const char* uri = pr->getURI(); if (uri) { str->appendf(" \"%s\"", uri); } } // add the (optional) matrix { SkMatrix m; if (this->getLocalMatrix(&m)) { SkString info; m.toDumpString(&info); str->appendf(" %s", info.c_str()); } } str->appendf(" [%s %s]]", gTileModeName[fState.fTileModeX], gTileModeName[fState.fTileModeY]); return true; }
void SkDumpCanvas::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m, const SkPaint* paint) { SkString bs, ms; toString(bitmap, &bs); m.toDumpString(&ms); this->dump(kDrawBitmap_Verb, paint, "drawBitmapMatrix(%s %s)", bs.c_str(), ms.c_str()); }
static void test_33(const SkMatrix44& mat, SkScalar x0, SkScalar x1, SkScalar x2, SkScalar y0, SkScalar y1, SkScalar y2) { SkMatrix dst = mat; if (dst[0] != x0 || dst[1] != x1 || dst[2] != x2 || dst[3] != y0 || dst[4] != y1 || dst[5] != y2) { SkString str; dst.toDumpString(&str); SkDebugf("3x3: expected 3x3 [%g %g %g] [%g %g %g] bug got %s\n", x0, x1, x2, y0, y1, y2, str.c_str()); } }
static void dump_layers(const SkLayer* layer, int tab = 0) { SkMatrix matrix; SkString matrixStr; layer->getLocalTransform(&matrix); matrix.toDumpString(&matrixStr); for (int j = 0; j < tab; j++) { SkDebugf(" "); } SkDebugf("layer=%p parent=%p size=[%g %g] transform=%s\n", layer, layer->getParent(), layer->getWidth(), layer->getHeight(), matrixStr.c_str()); for (int i = 0; i < layer->countChildren(); i++) { dump_layers(layer->getChild(i), tab + 4); } }
void SkDumpCanvas::setMatrix(const SkMatrix& matrix) { SkString str; matrix.toDumpString(&str); this->dump(kMatrix_Verb, NULL, "setMatrix(%s)", str.c_str()); this->INHERITED::setMatrix(matrix); }
bool SkDumpCanvas::concat(const SkMatrix& matrix) { SkString str; matrix.toDumpString(&str); this->dump(kMatrix_Verb, NULL, "concat(%s)", str.c_str()); return this->INHERITED::concat(matrix); }