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

Unified Diff: third_party/woff2/src/woff2_enc.cc

Issue 1959303002: Update woff2 to a15a8ab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/woff2/src/woff2_dec.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/woff2/src/woff2_enc.cc
diff --git a/third_party/woff2/src/woff2_enc.cc b/third_party/woff2/src/woff2_enc.cc
index 48878b5f7e3100ca9973094f6e1623b67a12a38d..39e2ddc61d5a44e2c3962725d11b12314d396a04 100644
--- a/third_party/woff2/src/woff2_enc.cc
+++ b/third_party/woff2/src/woff2_enc.cc
@@ -272,20 +272,22 @@ bool ConvertTTFToWOFF2(const uint8_t *data, size_t length,
std::vector<uint8_t> compression_buf(compression_buffer_size);
uint32_t total_compressed_length = compression_buffer_size;
- // Collect all transformed data into one place.
+ // Collect all transformed data into one place in output order.
std::vector<uint8_t> transform_buf(total_transform_length);
size_t transform_offset = 0;
for (const auto& font : font_collection.fonts) {
- for (const auto& i : font.tables) {
- const Font::Table* table = font.FindTable(i.second.tag ^ 0x80808080);
- if (i.second.IsReused()) continue;
- if (i.second.tag & 0x80808080) continue;
+ for (const auto tag : font.OutputOrderedTags()) {
+ const Font::Table& original = font.tables.at(tag);
+ if (original.IsReused()) continue;
+ if (tag & 0x80808080) continue;
+ const Font::Table* table_to_store = font.FindTable(tag ^ 0x80808080);
+ if (table_to_store == NULL) table_to_store = &original;
- if (table == NULL) table = &i.second;
- StoreBytes(table->data, table->length,
+ StoreBytes(table_to_store->data, table_to_store->length,
&transform_offset, &transform_buf[0]);
}
}
+
// Compress all transformed data in one stream.
if (!Woff2Compress(transform_buf.data(), total_transform_length,
&compression_buf[0],
« no previous file with comments | « third_party/woff2/src/woff2_dec.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698