From 89ad31e97cc886dc6417d9ee2ec79998c1a09912 Mon Sep 17 00:00:00 2001 From: Cary Clark Date: Thu, 31 May 2018 12:27:33 +0000 Subject: Revert "Reland "remove toString"" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 92e37b6d79f12ccfaaf7671413316952d182267d. Reason for revert: toString still used by flutter Original change's description: > Reland "remove toString" > > This reverts commit 32a4910e57b1fdd3c8671de1ee85e05ca21d079f. > > Reason for revert: SkMatrix::toString use has been removed from flutter and has been picked up in fuchsia > > Original change's description: > > Revert "remove toString" > > > > This reverts commit 5191880cbf3ee4d122b0d11b4945fbab0784fda7. > > > > Reason for revert: broke flutter > > > > Original change's description: > > > remove toString > > > > > > toString may have been used by obsolete debugger only > > > find out if that is so > > > > > > R=​brianosman@google.com,bsalomon@google.com > > > > > > Docs-Preview: https://skia.org/?cl=119894 > > > Bug:830651 > > > Change-Id: I737f19b7d3fbc869bea2f443fa3b5ed7c1393ffd > > > Reviewed-on: https://skia-review.googlesource.com/119894 > > > Commit-Queue: Cary Clark > > > Reviewed-by: Brian Salomon > > > > TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,caryclark@skia.org > > > > Change-Id: I9f81de6c3615ee0608bcea9081b77239b4b8816c > > No-Presubmit: true > > No-Tree-Checks: true > > No-Try: true > > Bug: 830651 > > Reviewed-on: https://skia-review.googlesource.com/129340 > > Reviewed-by: Cary Clark > > Commit-Queue: Cary Clark > > TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,caryclark@skia.org > > # Not skipping CQ checks because original CL landed > 1 day ago. > > Bug: 830651 > Change-Id: Ida8725b6051132d8c46faf99358a8fcc1bcabf34 > Reviewed-on: https://skia-review.googlesource.com/129623 > Reviewed-by: Cary Clark > Reviewed-by: Cary Clark > Commit-Queue: Cary Clark TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,caryclark@skia.org Change-Id: Iafc59ffc1b3db67c520ba31bf12d68e1b46c0ea2 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 830651 Reviewed-on: https://skia-review.googlesource.com/131082 Reviewed-by: Cary Clark Commit-Queue: Cary Clark --- docs/SkBitmap_Reference.bmh | 32 ++++++++++++++++++++++++++++++++ docs/SkImage_Reference.bmh | 33 +++++++++++++++++++++++++++++++++ docs/SkMatrix_Reference.bmh | 35 ++++++++++++++++++++++++++++++++++- docs/SkPaint_Reference.bmh | 30 ++++++++++++++++++++++++++++++ docs/undocumented.bmh | 8 ++++++++ 5 files changed, 137 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/SkBitmap_Reference.bmh b/docs/SkBitmap_Reference.bmh index a7cfb1dda1..8f241e3f85 100644 --- a/docs/SkBitmap_Reference.bmh +++ b/docs/SkBitmap_Reference.bmh @@ -3438,6 +3438,38 @@ SK_DEBUG is defined at compile time. # ------------------------------------------------------------------------------ +#Method void toString(SkString* str) const; +#In Utility +#Line # converts Bitmap to machine readable form ## + +Creates string representation of Bitmap. The representation is read by +internal debugging tools. + +#Param str storage for string representation ## + +#Example + SkBitmap bitmap; + int width = 6; + int height = 11; + bitmap.allocPixels(SkImageInfo::MakeN32Premul(width, height)); + SkString string; + bitmap.toString(&string); + SkString match; + match.printf("(%d, %d)", width, height); + int start = string.find(match.c_str()); + if (start >= 0) { + SkString whStr(&string.c_str()[start], match.size()); + SkDebugf("bitmap dimensions %s\n", whStr.c_str()); + } + #StdOut + bitmap dimensions (6, 11) + ## +## + +#SeeAlso SkPaint::toString + +## + #Class SkBitmap ## #Topic Bitmap ## diff --git a/docs/SkImage_Reference.bmh b/docs/SkImage_Reference.bmh index c41714e78e..3cdcd0513b 100644 --- a/docs/SkImage_Reference.bmh +++ b/docs/SkImage_Reference.bmh @@ -1742,6 +1742,39 @@ Returns nullptr if Image contents are not encoded. #Line # rarely called management functions ## ## +#Method const char* toString(SkString* string) const +#In Utility +#Line # converts Image to machine readable form ## +Appends Image description to string, including unique ID, width, height, and +whether the image is opaque. + +#Param string storage for description; existing content is preserved ## + +#Return string appended with Image description ## + +#Example +#Image 4 + struct { + const char* name; + sk_sp image; + } tests[] = { { "image", image }, { "bitmap", SkImage::MakeFromBitmap(source) }, + { "texture", SkImage::MakeFromTexture(canvas->getGrContext(), backEndTexture, + kTopLeft_GrSurfaceOrigin, kN32_SkColorType, kOpaque_SkAlphaType, + nullptr) } }; + SkString string; + SkPaint paint; + for (const auto& test : tests ) { + string.printf("%s: ", test.name); + test.image ? (void) test.image->toString(&string) : string.append("no image"); + canvas->drawString(string, 10, 20, paint); + canvas->translate(0, 20); + } +## + +#SeeAlso SkPaint::toString + +#Method ## + # ------------------------------------------------------------------------------ #Method sk_sp makeSubset(const SkIRect& subset) const diff --git a/docs/SkMatrix_Reference.bmh b/docs/SkMatrix_Reference.bmh index 1211588195..4ab498a2c8 100644 --- a/docs/SkMatrix_Reference.bmh +++ b/docs/SkMatrix_Reference.bmh @@ -4103,7 +4103,40 @@ matrix != nearlyEqual ## ## -#SeeAlso SkPath::dump +#SeeAlso toString + +## + +# ------------------------------------------------------------------------------ + +#Method void toString(SkString* str) const +#In Utility +#Line # converts Matrix to machine readable form ## +Creates string representation of Matrix. Floating point values +are written with limited precision; it may not be possible to reconstruct +original Matrix from output. + +#Param str storage for string representation of Matrix ## + +#Example + SkMatrix matrix; + matrix.setRotate(45); + SkString mStr, neStr; + matrix.toString(&mStr); + SkMatrix nearlyEqual; + nearlyEqual.setAll(0.7071f, -0.7071f, 0, 0.7071f, 0.7071f, 0, 0, 0, 1); + nearlyEqual.toString(&neStr); + SkDebugf("mStr %s\n", mStr.c_str()); + SkDebugf("neStr %s\n", neStr.c_str()); + SkDebugf("matrix %c= nearlyEqual\n", matrix == nearlyEqual ? '=' : '!'); +#StdOut +mStr [ 0.7071 -0.7071 0.0000][ 0.7071 0.7071 0.0000][ 0.0000 0.0000 1.0000] +neStr [ 0.7071 -0.7071 0.0000][ 0.7071 0.7071 0.0000][ 0.0000 0.0000 1.0000] +matrix != nearlyEqual +## +## + +#SeeAlso dump ## diff --git a/docs/SkPaint_Reference.bmh b/docs/SkPaint_Reference.bmh index e7158535bd..d7738582e7 100644 --- a/docs/SkPaint_Reference.bmh +++ b/docs/SkPaint_Reference.bmh @@ -5113,6 +5113,36 @@ Paint may draw to. #Line # rarely called management functions ## ## +#Method void toString(SkString* str) const +#In Utility +#Line # converts Paint to machine readable form ## + +Creates string representation of Paint. The representation is read by +internal debugging tools. + +#Param str storage for string representation of Paint ## + +#Example + SkPaint paint; + SkString str; + paint.toString(&str); + const char textSize[] = "TextSize:"; + const int trailerSize = strlen("
"); + int textSizeLoc = str.find(textSize) + strlen(textSize) + trailerSize; + const char* sizeStart = &str.c_str()[textSizeLoc]; + int textSizeEnd = SkStrFind(sizeStart, ""); + SkDebugf("text size = %.*s\n", textSizeEnd, sizeStart); + + #StdOut + text size = 12 + ## + +## + +#SeeAlso SkPathEffect::toString SkMaskFilter::toString SkColorFilter::toString SkImageFilter::toString + +## + # ------------------------------------------------------------------------------ #Class SkPaint ## diff --git a/docs/undocumented.bmh b/docs/undocumented.bmh index 9b898327ff..9e982e5d9a 100644 --- a/docs/undocumented.bmh +++ b/docs/undocumented.bmh @@ -126,6 +126,8 @@ FT_Load_Glyph #Topic Color_Filter #Class SkColorFilter +#Method void toString(SkString* str) const +## #Class ## ## @@ -318,6 +320,8 @@ FT_Load_Glyph #Topic Image_Filter #Class SkImageFilter +#Method void toString(SkString* str) const +## #Class ## #Topic ## @@ -356,6 +360,8 @@ FT_Load_Glyph #Topic Mask_Filter #Class SkMaskFilter +#Method void toString(SkString* str) const +## #Class ## #Topic ## @@ -465,6 +471,8 @@ FT_Load_Glyph #Topic Path_Effect #Class SkPathEffect + #Method void toString(SkString* str) const + ## #Class ## #Topic ## -- cgit v1.2.3