diff options
author | Ariel Manzur <ariel@okamstudio.com> | 2015-12-22 09:19:12 -0300 |
---|---|---|
committer | Ariel Manzur <ariel@okamstudio.com> | 2015-12-22 09:19:12 -0300 |
commit | 83f2084cb82d1dc006e7a9c0f23ca66e03736c2b (patch) | |
tree | e090e806c3d403b613b4078f5623b50a00835902 | |
parent | 1bc91848e3cee91eccaf2150a74deaf1cd84be13 (diff) |
testing patch for aligned reads by webp in javascript
-rw-r--r-- | drivers/webp/utils/bit_reader.c | 8 | ||||
-rw-r--r-- | drivers/webp/utils/bit_reader.h | 8 | ||||
-rw-r--r-- | servers/visual_server.cpp | 1 |
3 files changed, 17 insertions, 0 deletions
diff --git a/drivers/webp/utils/bit_reader.c b/drivers/webp/utils/bit_reader.c index 5081d5cd4d..4d6b4f0164 100644 --- a/drivers/webp/utils/bit_reader.c +++ b/drivers/webp/utils/bit_reader.c @@ -17,6 +17,8 @@ #include "./bit_reader_inl.h" +#define JAVASCRIPT_ENABLED // testing + //------------------------------------------------------------------------------ // VP8BitReader @@ -40,7 +42,13 @@ void VP8InitBitReader(VP8BitReader* const br, br->bits_ = -8; // to load the very first 8bits br->eof_ = 0; VP8BitReaderSetBuffer(br, start, size); + +#ifdef JAVASCRIPT_ENABLED // html5 required aligned reads + while(((uintptr_t)br->buf_ & 1) != 0 && !br->eof_) + VP8LoadFinalBytes(br); +#else VP8LoadNewBytes(br); +#endif } void VP8RemapBitReader(VP8BitReader* const br, ptrdiff_t offset) { diff --git a/drivers/webp/utils/bit_reader.h b/drivers/webp/utils/bit_reader.h index 7e09653ebc..f0f450231d 100644 --- a/drivers/webp/utils/bit_reader.h +++ b/drivers/webp/utils/bit_reader.h @@ -37,6 +37,12 @@ extern "C" { // BITS can be any multiple of 8 from 8 to 56 (inclusive). // Pick values that fit natural register size. +#ifdef JAVASCRIPT_ENABLED + +#define BITS 16 + +#else + #if defined(__i386__) || defined(_M_IX86) // x86 32bit #define BITS 24 #elif defined(__x86_64__) || defined(_M_X64) // x86 64bit @@ -49,6 +55,8 @@ extern "C" { #define BITS 24 // TODO(skal): test aarch64 and find the proper BITS value. #endif +#endif + //------------------------------------------------------------------------------ // Derived types and constants: // bit_t = natural register type for storing 'value_' (which is BITS+8 bits) diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 25e6a68469..52381cf096 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -526,6 +526,7 @@ void VisualServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("canvas_item_get_opacity"),&VisualServer::canvas_item_get_opacity); ObjectTypeDB::bind_method(_MD("canvas_item_set_self_opacity"),&VisualServer::canvas_item_set_self_opacity); ObjectTypeDB::bind_method(_MD("canvas_item_get_self_opacity"),&VisualServer::canvas_item_get_self_opacity); + ObjectTypeDB::bind_method(_MD("canvas_item_set_z"),&VisualServer::canvas_item_set_z); ObjectTypeDB::bind_method(_MD("canvas_item_add_line"),&VisualServer::canvas_item_add_line, DEFVAL(1.0)); ObjectTypeDB::bind_method(_MD("canvas_item_add_rect"),&VisualServer::canvas_item_add_rect); |