已合并
代码整改 #10781
dingpy创建于 8月3日
代码整改 #10781
已合并
共 4 个文件变更+8-8
| @@ -216,7 +216,7 @@ void RenderEngine::UpdateTextureMatrix() | |||
| 216 | int32_t ret = OH_NativeImage_GetTransformMatrixV2(nativeImage_, matrix); | 216 | int32_t ret = OH_NativeImage_GetTransformMatrixV2(nativeImage_, matrix); |
| 217 | if (ret != 0) { | 217 | if (ret != 0) { |
| 218 | OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RenderEngine", | 218 | OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RenderEngine", |
| 219 | - "OH_NativeImage_GetTransformMatrix failed, ret: %{public}d", ret); | 219 | + "OH_NativeImage_GetTransformMatrixV2 failed, ret: %{public}d", ret); |
| 220 | return; | 220 | return; |
| 221 | } | 221 | } |
| 222 | imageRender_->SetTransformMatrix(matrix); | 222 | imageRender_->SetTransformMatrix(matrix); |
| @@ -216,7 +216,6 @@ static void TestReadWriteWindow(NativeWindow *nativeWindow) | |||
| 216 | void NativeRender::DrawBaseColor() | 216 | void NativeRender::DrawBaseColor() |
| 217 | { | 217 | { |
| 218 | NativeBufferApi(); | 218 | NativeBufferApi(); |
| 219 | - uint32_t value = flag_ ? 0xfff0000f : 0xff00ffff; | ||
| 220 | uint64_t surfaceId = 0; | 219 | uint64_t surfaceId = 0; |
| 221 | auto ret = OH_NativeWindow_GetSurfaceId(nativeWindow_, &surfaceId); | 220 | auto ret = OH_NativeWindow_GetSurfaceId(nativeWindow_, &surfaceId); |
| 222 | if (ret != 0) { | 221 | if (ret != 0) { |
| @@ -238,14 +237,15 @@ void NativeRender::DrawBaseColor() | |||
| 238 | mmap(bufferHandle->virAddr, bufferHandle->size, PROT_READ | PROT_WRITE, MAP_SHARED, bufferHandle->fd, 0); | 237 | mmap(bufferHandle->virAddr, bufferHandle->size, PROT_READ | PROT_WRITE, MAP_SHARED, bufferHandle->fd, 0); |
| 239 | 238 | ||
| 240 | uint32_t *pixel = static_cast<uint32_t *>(mappedAddr); | 239 | uint32_t *pixel = static_cast<uint32_t *>(mappedAddr); |
| 240 | + uint32_t value = flag_ ? 0xfff0000f : 0xff00ffff; | ||
| 241 | for (uint64_t x = 0; x < bufferHandle->width; x++) { | 241 | for (uint64_t x = 0; x < bufferHandle->width; x++) { |
| 242 | for (uint64_t y = 0; y < bufferHandle->height; y++) { | 242 | for (uint64_t y = 0; y < bufferHandle->height; y++) { |
| 243 | *pixel++ = value; | 243 | *pixel++ = value; |
| 244 | } | 244 | } |
| 245 | } | 245 | } |
| 246 | - struct Region *region = new Region(); | 246 | + struct Region region = {0}; |
| 247 | int acquireFenceFd = -1; | 247 | int acquireFenceFd = -1; |
| 248 | - ret = OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow, nativeWindowBuffer, acquireFenceFd, *region); | 248 | + ret = OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow, nativeWindowBuffer, acquireFenceFd, region); |
| 249 | if (ret != NATIVE_ERROR_OK) { | 249 | if (ret != NATIVE_ERROR_OK) { |
| 250 | LOGE("flush failed"); | 250 | LOGE("flush failed"); |
| 251 | (void)OH_NativeWindow_NativeWindowAbortBuffer(nativeWindow, nativeWindowBuffer); | 251 | (void)OH_NativeWindow_NativeWindowAbortBuffer(nativeWindow, nativeWindowBuffer); |
| @@ -226,7 +226,7 @@ void RenderEngine::UpdateTextureMatrix() | |||
| 226 | int32_t ret = OH_NativeImage_GetTransformMatrixV2(nativeImage_, matrix); | 226 | int32_t ret = OH_NativeImage_GetTransformMatrixV2(nativeImage_, matrix); |
| 227 | if (ret != 0) { | 227 | if (ret != 0) { |
| 228 | OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RenderEngine", | 228 | OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RenderEngine", |
| 229 | - "OH_NativeImage_GetTransformMatrix failed, ret: %{public}d", ret); | 229 | + "OH_NativeImage_GetTransformMatrixV2 failed, ret: %{public}d", ret); |
| 230 | return; | 230 | return; |
| 231 | } | 231 | } |
| 232 | imageRender_->SetTransformMatrix(matrix); | 232 | imageRender_->SetTransformMatrix(matrix); |
| @@ -280,7 +280,6 @@ static void TestReadWriteWindow(NativeWindow *nativeWindow) | |||
| 280 | void NativeRender::DrawBaseColor() | 280 | void NativeRender::DrawBaseColor() |
| 281 | { | 281 | { |
| 282 | NativeBufferApi(); | 282 | NativeBufferApi(); |
| 283 | - uint32_t value = flag_ ? 0xfff0000f : 0xff00ffff; | ||
| 284 | uint64_t surfaceId = 0; | 283 | uint64_t surfaceId = 0; |
| 285 | auto ret = OH_NativeWindow_GetSurfaceId(nativeWindow_, &surfaceId); | 284 | auto ret = OH_NativeWindow_GetSurfaceId(nativeWindow_, &surfaceId); |
| 286 | if (ret != 0) { | 285 | if (ret != 0) { |
| @@ -321,6 +320,7 @@ void NativeRender::DrawBaseColor() | |||
| 321 | close(releaseFenceFd); | 320 | close(releaseFenceFd); |
| 322 | } | 321 | } |
| 323 | uint32_t *pixel = static_cast<uint32_t *>(mappedAddr); | 322 | uint32_t *pixel = static_cast<uint32_t *>(mappedAddr); |
| 323 | + uint32_t value = flag_ ? 0xfff0000f : 0xff00ffff; | ||
| 324 | for (uint64_t x = 0; x < bufferHandle->width; x++) { | 324 | for (uint64_t x = 0; x < bufferHandle->width; x++) { |
| 325 | for (uint64_t y = 0; y < bufferHandle->height; y++) { | 325 | for (uint64_t y = 0; y < bufferHandle->height; y++) { |
| 326 | *pixel++ = value; | 326 | *pixel++ = value; |
| @@ -328,9 +328,9 @@ void NativeRender::DrawBaseColor() | |||
| 328 | } | 328 | } |
| 329 | // [End write_addr] | 329 | // [End write_addr] |
| 330 | // [Start flush_buffer] | 330 | // [Start flush_buffer] |
| 331 | - struct Region *region = new Region(); | 331 | + struct Region region = {0}; |
| 332 | int acquireFenceFd = -1; | 332 | int acquireFenceFd = -1; |
| 333 | - ret = OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow, nativeWindowBuffer, acquireFenceFd, *region); | 333 | + ret = OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow, nativeWindowBuffer, acquireFenceFd, region); |
| 334 | if (ret != NATIVE_ERROR_OK) { | 334 | if (ret != NATIVE_ERROR_OK) { |
| 335 | LOGE("flush failed"); | 335 | LOGE("flush failed"); |
| 336 | (void)OH_NativeWindow_NativeWindowAbortBuffer(nativeWindow, nativeWindowBuffer); | 336 | (void)OH_NativeWindow_NativeWindowAbortBuffer(nativeWindow, nativeWindowBuffer); |