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

Unified Diff: src/core/SkPaint.cpp

Issue 1041953002: Switch to one single bitmap text blob cache allocation (Closed) Base URL: https://skia.googlesource.com/skia.git@bmptext2
Patch Set: third attempt Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkDescriptor.h ('k') | src/gpu/GrBitmapTextContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPaint.cpp
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 24281d7cff2ec6cd837d77f4353a1756c5000465..2c1745d00b490f03837f35481a9c08926975e15c 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1705,9 +1705,9 @@ static void test_desc(const SkScalerContext::Rec& rec,
#endif
/* see the note on ignoreGamma on descriptorProc */
-const SkData* SkPaint::getScalerContextDescriptor(const SkDeviceProperties* deviceProperties,
- const SkMatrix* deviceMatrix,
- bool ignoreGamma) const {
+void SkPaint::getScalerContextDescriptor(SkAutoDescriptor* ad,
+ const SkDeviceProperties* deviceProperties,
+ const SkMatrix* deviceMatrix, bool ignoreGamma) const {
SkScalerContext::Rec rec;
SkPathEffect* pe = this->getPathEffect();
@@ -1718,9 +1718,8 @@ const SkData* SkPaint::getScalerContextDescriptor(const SkDeviceProperties* devi
size_t descSize = fill_out_rec(*this, &rec, deviceProperties, deviceMatrix, ignoreGamma,
pe, &peBuffer, mf, &mfBuffer, ra, &raBuffer);
- SkASSERT(SkAlign4(descSize) == descSize);
- SkData* data = SkData::NewUninitialized(descSize);
- SkDescriptor* desc = reinterpret_cast<SkDescriptor*>(data->writable_data());
+ ad->reset(descSize);
+ SkDescriptor* desc = ad->getDesc();
write_out_descriptor(desc, rec, pe, &peBuffer, mf, &mfBuffer, ra, &raBuffer, descSize);
@@ -1729,8 +1728,6 @@ const SkData* SkPaint::getScalerContextDescriptor(const SkDeviceProperties* devi
#ifdef TEST_DESC
test_desc(rec, pe, &peBuffer, mf, &mfBuffer, ra, &raBuffer, desc, descSize);
#endif
-
- return data;
}
/*
« no previous file with comments | « src/core/SkDescriptor.h ('k') | src/gpu/GrBitmapTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698