MCPcopy Create free account
hub / github.com/NazaraEngine/NazaraEngine / Copy

Method Copy

src/Nazara/Utility/Image.cpp:146–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144 }
145
146 void Image::Copy(const Image& source, const Boxui& srcBox, const Vector3ui& dstPos)
147 {
148 #if NAZARA_UTILITY_SAFE
149 if (m_sharedImage == &emptyImage)
150 {
151 NazaraError("Image must be valid");
152 return;
153 }
154
155 if (!source.IsValid())
156 {
157 NazaraError("Source image must be valid");
158 return;
159 }
160
161 if (source.GetFormat() != m_sharedImage->format)
162 {
163 NazaraError("Source image format does not match destination image format");
164 return;
165 }
166 #endif
167
168 const UInt8* srcPtr = source.GetConstPixels(srcBox.x, srcBox.y, srcBox.z);
169 #if NAZARA_UTILITY_SAFE
170 if (!srcPtr)
171 {
172 NazaraError("Failed to access pixels");
173 return;
174 }
175 #endif
176
177 UInt8 bpp = PixelFormat::GetBytesPerPixel(m_sharedImage->format);
178 UInt8* dstPtr = GetPixelPtr(m_sharedImage->levels[0].get(), bpp, dstPos.x, dstPos.y, dstPos.z, m_sharedImage->width, m_sharedImage->height);
179
180 Copy(dstPtr, srcPtr, m_sharedImage->format, srcBox.width, srcBox.height, srcBox.depth, m_sharedImage->width, m_sharedImage->height, source.GetWidth(), source.GetHeight());
181 }
182
183 bool Image::Create(ImageType type, PixelFormatType format, unsigned int width, unsigned int height, unsigned int depth, UInt8 levelCount)
184 {

Callers 1

ResizeImageMethod · 0.45

Calls 6

GetPixelPtrFunction · 0.85
GetConstPixelsMethod · 0.80
IsValidMethod · 0.45
GetFormatMethod · 0.45
GetWidthMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected