Fix -Wclass-memaccess warning when bit-casting SkRects.
Instead of using a bit-cast, just use MakeLTRB and let the compiler
figure out that the types are a match.
This resolves GCC warnings of the form:
In file included from ../../src/base/SkVx.h:23,
from ../../src/gpu/graphite/geom/Shape.h:16,
from ../../src/gpu/graphite/geom/Shape.cpp:8:
../../src/base/SkUtils.h: In instantiation of ‘T sk_unaligned_load(const P*) [with T = SkRect; P = skvx::Vec<4, float>]’:
../../src/base/SkUtils.h:52:34: required from ‘Dst sk_bit_cast(const Src&) [with Dst = SkRect; Src = skvx::Vec<4, float>]’
../../src/gpu/graphite/geom/Rect.h:91:60: required from here
../../src/base/SkUtils.h:36:11: warning: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘struct SkRect’ from an array of ‘const struct skvx::Vec<4, float>’ [-Wclass-memaccess]
36 | memcpy(&val, ptr, sizeof(val));
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Change-Id: Ifaeb3f8a7e7536cb5550fc3d11de57086b5d623f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/754700
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
1 file changed