OSDN Git Service

Fix texture image internalformat/type validation.
authorNicolas Capens <capn@google.com>
Mon, 26 Feb 2018 13:18:30 +0000 (08:18 -0500)
committerNicolas Capens <capn@google.com>
Mon, 26 Feb 2018 15:16:36 +0000 (10:16 -0500)
commitb9a6515ea3ac2de8f02e52e7108a79c78f68d4d6
tree8a1f335e710a97ea8fccb9497ae396d50893683c
parent64265d4dcef6b91001f629a5bf5edd013b32b701
Fix texture image internalformat/type validation.

checkInternalFormat() was not properly checking that the Skia bitmap
color type matches the OpenGL format and type combination. In some
cases this would lead to visual artifacts (e.g. when a 565 type is
uploaded to a 4444 type), while in other cases it would cause reading
out of bounds (e.g. when uploading Alpha_8 with a GL_RGBA format).

Note that valid Bitmap formats are documented at
https://developer.android.com/reference/android/graphics/Bitmap.Config.html
checkInternalFormat() now also matches getInternalFormat() and
getType().

Bug: 73084222

Change-Id: I47cb08657c7d03723d3318c99e0da94434d80ee6
core/jni/android/opengl/util.cpp