MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / WritePixels

Method WritePixels

deps/LLGL/sources/Core/Image.cpp:369–413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

367}
368
369void Image::WritePixels(const Offset3D& offset, const Extent3D& extent, const SrcImageDescriptor& imageDesc, std::size_t threadCount)
370{
371 if (imageDesc.data && IsRegionInside(offset, extent))
372 {
373 /* Validate required size */
374 ValidateImageDataSize(extent, imageDesc);
375
376 /* Get destination image parameters */
377 const auto bpp = GetBytesPerPixel();
378 const auto dstRowStride = bpp * GetExtent().width;
379 const auto dstDepthStride = dstRowStride * GetExtent().height;
380 auto dst = data_.get() + GetDataPtrOffset(offset);
381
382 if (GetFormat() == imageDesc.format && GetDataType() == imageDesc.dataType)
383 {
384 /* Get source image parameters */
385 const auto srcRowStride = bpp * extent.width;
386 const auto srcDepthStride = srcRowStride * extent.height;
387 auto src = reinterpret_cast<const char*>(imageDesc.data);
388
389 /* Blit source image into region */
390 BitBlit(
391 extent, bpp,
392 dst, dstRowStride, dstDepthStride,
393 src, srcRowStride, srcDepthStride
394 );
395 }
396 else
397 {
398 /* Copy input data into sub-image into */
399 Image subImage { extent, imageDesc.format, imageDesc.dataType };
400 ::memcpy(subImage.GetData(), imageDesc.data, imageDesc.dataSize);
401
402 /* Convert sub-image */
403 subImage.Convert(GetFormat(), GetDataType(), threadCount);
404
405 /* Copy temporary sub-image into region */
406 BitBlit(
407 extent, bpp,
408 dst, dstRowStride, dstDepthStride,
409 reinterpret_cast<const char*>(subImage.GetData()), subImage.GetRowStride(), subImage.GetDepthStride()
410 );
411 }
412 }
413}
414
415void Image::MirrorYZPlane()
416{

Callers 1

Test_PixelOperationsFunction · 0.80

Calls 11

ValidateImageDataSizeFunction · 0.85
GetBytesPerPixelFunction · 0.85
GetFormatFunction · 0.85
GetDataTypeFunction · 0.85
BitBlitFunction · 0.85
memcpyFunction · 0.85
GetRowStrideMethod · 0.80
GetDepthStrideMethod · 0.80
getMethod · 0.45
GetDataMethod · 0.45
ConvertMethod · 0.45

Tested by 1

Test_PixelOperationsFunction · 0.64