1e41f4b71Sopenharmony_ci#  Graphics Subsystem Changelog
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## cl.graphics.1 Image APIs OH_GetImageInfo() and OH_PixelMap_GetImageInfo() Changed
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci**Access Level**
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ciPublic
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci**Reason for Change**
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ciDuring hardware decoding for JPEG images, Direct Memory Access (DMA) is used, which is an aligned memory. Therefore, the method for calculating **rowSize** in **OH_GetImageInfo()** and **OH_PixelMap_GetImageInfo()** is changed.
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci**Change Impact**
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ciThis change is incompatible with earlier versions. The method for calculating **rowSize** is changed.
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci**API Level**
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci<11>
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci**Change Since**
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ciOpenHarmony SDK 4.1.3.1
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci**rowSize Component**
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ciBefore change:
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci**rowSize**: number of bytes per row. Calculation formula: Image width x Number of bytes in each pixel.
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ciAfter change:
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci**rowSize**: number of bytes per row. In the case of DMA, the formula is as follows: Image width x Roundup(64 x Number of bytes per pixel). (The roundup means that each row is automatically padded.) In the case of other types of memory, the formula is as follows: Image width x Number of bytes per pixel.
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci**Adaptation Guide**
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ciScenario: The memory address of the pixel map is obtained by calling **OH_PixelMap_AccessPixels()**. When you directly operate the memory, adjust **rowSize**.
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ciCase 1: When OpenCV uses the pixel map data to construct **cv::Mat**, it must include the input parameter **step**.
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ciBefore change:
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ci```c++
44e41f4b71Sopenharmony_cicv::Mat srv(rows: bitmap.height, cols: bitmap.width, type: CV_8UC4, data: imagePixels);
45e41f4b71Sopenharmony_ci```
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ciAfter change:
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci```c++
50e41f4b71Sopenharmony_cicv::Mat srv(rows: bitmap.height, cols: bitmap.width, type: CV_8UC4, data: imagePixels, step: rowSize);
51e41f4b71Sopenharmony_ci```
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ciCase 2: When you copy the pixel map data, do not include the padding.
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci```c++
56e41f4b71Sopenharmony_cifor (int i = 0; i < imageInfo_.size.height; ++i) {
57e41f4b71Sopenharmony_ci    errno_t ret = memcpy_s(dst, rowDataSize_, src_ + i * rowStride_, rowDataSize_);
58e41f4b71Sopenharmony_ci    if (ret != 0) {
59e41f4b71Sopenharmony_ci        Hilog::Error(LABLE, "read pixels by buffer memcpy the pixelmap data to dst fail, error:%{public}d", ret);
60e41f4b71Sopenharmony_ci        return ERROR_IMAGE_READ_PIXECLMAP_FAILED;
61e41f4b71Sopenharmony_ci    }
62e41f4b71Sopenharmony_ci    dst += rowDataSize_;
63e41f4b71Sopenharmony_ci}
64e41f4b71Sopenharmony_ci```
65