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

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

Issue 1924033002: skip unneeded header from writeFlattenable when building font-cache-key. Saves ~30% in size (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | no next file » | 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 "SkAutoKern.h" 9 #include "SkAutoKern.h"
10 #include "SkChecksum.h" 10 #include "SkChecksum.h"
(...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 rec->ignoreGamma(); 1560 rec->ignoreGamma();
1561 } 1561 }
1562 if (!boostContrast) { 1562 if (!boostContrast) {
1563 rec->setContrast(0); 1563 rec->setContrast(0);
1564 } 1564 }
1565 1565
1566 int entryCount = 1; 1566 int entryCount = 1;
1567 size_t descSize = sizeof(*rec); 1567 size_t descSize = sizeof(*rec);
1568 1568
1569 if (pe) { 1569 if (pe) {
1570 peBuffer->writeFlattenable(pe); 1570 pe->flatten(*peBuffer);
1571 descSize += peBuffer->bytesWritten(); 1571 descSize += peBuffer->bytesWritten();
1572 entryCount += 1; 1572 entryCount += 1;
1573 rec->fMaskFormat = SkMask::kA8_Format; // force antialiasing when we do the scan conversion 1573 rec->fMaskFormat = SkMask::kA8_Format; // force antialiasing when we do the scan conversion
1574 // seems like we could support kLCD as well at this point... 1574 // seems like we could support kLCD as well at this point...
1575 } 1575 }
1576 if (mf) { 1576 if (mf) {
1577 mfBuffer->writeFlattenable(mf); 1577 mf->flatten(*mfBuffer);
1578 descSize += mfBuffer->bytesWritten(); 1578 descSize += mfBuffer->bytesWritten();
1579 entryCount += 1; 1579 entryCount += 1;
1580 rec->fMaskFormat = SkMask::kA8_Format; // force antialiasing with mask filters 1580 rec->fMaskFormat = SkMask::kA8_Format; // force antialiasing with mask filters
1581 /* Pre-blend is not currently applied to filtered text. 1581 /* Pre-blend is not currently applied to filtered text.
1582 The primary filter is blur, for which contrast makes no sense, 1582 The primary filter is blur, for which contrast makes no sense,
1583 and for which the destination guess error is more visible. 1583 and for which the destination guess error is more visible.
1584 Also, all existing users of blur have calibrated for linear. */ 1584 Also, all existing users of blur have calibrated for linear. */
1585 rec->ignorePreBlend(); 1585 rec->ignorePreBlend();
1586 } 1586 }
1587 if (ra) { 1587 if (ra) {
1588 raBuffer->writeFlattenable(ra); 1588 ra->flatten(*raBuffer);
1589 descSize += raBuffer->bytesWritten(); 1589 descSize += raBuffer->bytesWritten();
1590 entryCount += 1; 1590 entryCount += 1;
1591 rec->fMaskFormat = SkMask::kA8_Format; // force antialiasing when we do the scan conversion 1591 rec->fMaskFormat = SkMask::kA8_Format; // force antialiasing when we do the scan conversion
1592 } 1592 }
1593 1593
1594 /////////////////////////////////////////////////////////////////////////// 1594 ///////////////////////////////////////////////////////////////////////////
1595 // Now that we're done tweaking the rec, call the PostMakeRec cleanup 1595 // Now that we're done tweaking the rec, call the PostMakeRec cleanup
1596 SkScalerContext::PostMakeRec(paint, rec); 1596 SkScalerContext::PostMakeRec(paint, rec);
1597 1597
1598 descSize += SkDescriptor::ComputeOverhead(entryCount); 1598 descSize += SkDescriptor::ComputeOverhead(entryCount);
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
2371 } 2371 }
2372 2372
2373 uint32_t SkPaint::getHash() const { 2373 uint32_t SkPaint::getHash() const {
2374 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB itfields, 2374 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB itfields,
2375 // so fBitfields should be 10 pointers and 6 32-bit values from the start. 2375 // so fBitfields should be 10 pointers and 6 32-bit values from the start.
2376 static_assert(offsetof(SkPaint, fBitfields) == 9 * sizeof(void*) + 6 * sizeo f(uint32_t), 2376 static_assert(offsetof(SkPaint, fBitfields) == 9 * sizeof(void*) + 6 * sizeo f(uint32_t),
2377 "SkPaint_notPackedTightly"); 2377 "SkPaint_notPackedTightly");
2378 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), 2378 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this),
2379 offsetof(SkPaint, fBitfields) + sizeof(fBitfields )); 2379 offsetof(SkPaint, fBitfields) + sizeof(fBitfields ));
2380 } 2380 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698