Index: third_party/libwebp/utils/color_cache.c |
diff --git a/third_party/libwebp/utils/color_cache.c b/third_party/libwebp/utils/color_cache.c |
index 8a88f08b70ce5506368894fd771b4371f47c050b..f9ff4b5451fa6680efc65439289cae67f737751c 100644 |
--- a/third_party/libwebp/utils/color_cache.c |
+++ b/third_party/libwebp/utils/color_cache.c |
@@ -13,6 +13,7 @@ |
#include <assert.h> |
#include <stdlib.h> |
+#include <string.h> |
#include "./color_cache.h" |
#include "../utils/utils.h" |
@@ -27,6 +28,7 @@ int VP8LColorCacheInit(VP8LColorCache* const cc, int hash_bits) { |
sizeof(*cc->colors_)); |
if (cc->colors_ == NULL) return 0; |
cc->hash_shift_ = 32 - hash_bits; |
+ cc->hash_bits_ = hash_bits; |
return 1; |
} |
@@ -37,3 +39,11 @@ void VP8LColorCacheClear(VP8LColorCache* const cc) { |
} |
} |
+void VP8LColorCacheCopy(const VP8LColorCache* const src, |
+ VP8LColorCache* const dst) { |
+ assert(src != NULL); |
+ assert(dst != NULL); |
+ assert(src->hash_bits_ == dst->hash_bits_); |
+ memcpy(dst->colors_, src->colors_, |
+ ((size_t)1u << dst->hash_bits_) * sizeof(*dst->colors_)); |
+} |