Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Side by Side Diff: src/core/SkPaint.cpp

Issue 1732263003: Make skpinfo able to inspect SK_PICT_TYPEFACE_TAG blocks (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address code review issues Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkFontDescriptor.cpp ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkPaint.h" 8 #include "SkPaint.h"
9 #include "SkAnnotation.h" 9 #include "SkAnnotation.h"
10 #include "SkAutoKern.h" 10 #include "SkAutoKern.h"
(...skipping 2105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2116 #ifndef SK_IGNORE_TO_STRING 2116 #ifndef SK_IGNORE_TO_STRING
2117 2117
2118 void SkPaint::toString(SkString* str) const { 2118 void SkPaint::toString(SkString* str) const {
2119 str->append("<dl><dt>SkPaint:</dt><dd><dl>"); 2119 str->append("<dl><dt>SkPaint:</dt><dd><dl>");
2120 2120
2121 SkTypeface* typeface = this->getTypeface(); 2121 SkTypeface* typeface = this->getTypeface();
2122 if (typeface) { 2122 if (typeface) {
2123 SkDynamicMemoryWStream ostream; 2123 SkDynamicMemoryWStream ostream;
2124 typeface->serialize(&ostream); 2124 typeface->serialize(&ostream);
2125 SkAutoTDelete<SkStreamAsset> istream(ostream.detachAsStream()); 2125 SkAutoTDelete<SkStreamAsset> istream(ostream.detachAsStream());
2126 SkFontDescriptor descriptor(istream);
2127 2126
2128 str->append("<dt>Font Family Name:</dt><dd>"); 2127 SkFontDescriptor descriptor;
2129 str->append(descriptor.getFamilyName()); 2128 if (!SkFontDescriptor::Deserialize(istream, &descriptor)) {
2130 str->append("</dd><dt>Font Full Name:</dt><dd>"); 2129 str->append("<dt>FontDescriptor deserialization failed</dt>");
2131 str->append(descriptor.getFullName()); 2130 } else {
2132 str->append("</dd><dt>Font PS Name:</dt><dd>"); 2131 str->append("<dt>Font Family Name:</dt><dd>");
2133 str->append(descriptor.getPostscriptName()); 2132 str->append(descriptor.getFamilyName());
2134 str->append("</dd>"); 2133 str->append("</dd><dt>Font Full Name:</dt><dd>");
2134 str->append(descriptor.getFullName());
2135 str->append("</dd><dt>Font PS Name:</dt><dd>");
2136 str->append(descriptor.getPostscriptName());
2137 str->append("</dd>");
2138 }
2135 } 2139 }
2136 2140
2137 str->append("<dt>TextSize:</dt><dd>"); 2141 str->append("<dt>TextSize:</dt><dd>");
2138 str->appendScalar(this->getTextSize()); 2142 str->appendScalar(this->getTextSize());
2139 str->append("</dd>"); 2143 str->append("</dd>");
2140 2144
2141 str->append("<dt>TextScaleX:</dt><dd>"); 2145 str->append("<dt>TextScaleX:</dt><dd>");
2142 str->appendScalar(this->getTextScaleX()); 2146 str->appendScalar(this->getTextScaleX());
2143 str->append("</dd>"); 2147 str->append("</dd>");
2144 2148
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
2431 } 2435 }
2432 2436
2433 uint32_t SkPaint::getHash() const { 2437 uint32_t SkPaint::getHash() const {
2434 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB itfields, 2438 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB itfields,
2435 // so fBitfields should be 10 pointers and 6 32-bit values from the start. 2439 // so fBitfields should be 10 pointers and 6 32-bit values from the start.
2436 static_assert(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 * size of(uint32_t), 2440 static_assert(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 * size of(uint32_t),
2437 "SkPaint_notPackedTightly"); 2441 "SkPaint_notPackedTightly");
2438 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), 2442 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this),
2439 offsetof(SkPaint, fBitfields) + sizeof(fBitfields )); 2443 offsetof(SkPaint, fBitfields) + sizeof(fBitfields ));
2440 } 2444 }
OLDNEW
« no previous file with comments | « src/core/SkFontDescriptor.cpp ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698