Merge "Fix override setBufferCount"
This commit is contained in:
@@ -139,7 +139,7 @@ void CanvasContext::destroy() {
|
||||
mAnimationContext->destroy();
|
||||
}
|
||||
|
||||
static void setBufferCount(ANativeWindow* window, uint32_t extraBuffers) {
|
||||
static void setBufferCount(ANativeWindow* window) {
|
||||
int query_value;
|
||||
int err = window->query(window, NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &query_value);
|
||||
if (err != 0 || query_value < 0) {
|
||||
@@ -148,7 +148,9 @@ static void setBufferCount(ANativeWindow* window, uint32_t extraBuffers) {
|
||||
}
|
||||
auto min_undequeued_buffers = static_cast<uint32_t>(query_value);
|
||||
|
||||
int bufferCount = min_undequeued_buffers + 2 + extraBuffers;
|
||||
// We only need to set min_undequeued + 2 because the renderahead amount was already factored into the
|
||||
// query for min_undequeued
|
||||
int bufferCount = min_undequeued_buffers + 2;
|
||||
native_window_set_buffer_count(window, bufferCount);
|
||||
}
|
||||
|
||||
@@ -179,7 +181,8 @@ void CanvasContext::setSurface(ANativeWindow* window, bool enableTimeout) {
|
||||
mNativeSurface ? mNativeSurface->getNativeWindow() : nullptr, mSwapBehavior);
|
||||
|
||||
if (mNativeSurface && !mNativeSurface->didSetExtraBuffers()) {
|
||||
setBufferCount(mNativeSurface->getNativeWindow(), mRenderAheadCapacity);
|
||||
setBufferCount(mNativeSurface->getNativeWindow());
|
||||
|
||||
}
|
||||
|
||||
mFrameNumber = -1;
|
||||
|
||||
Reference in New Issue
Block a user