mirror of
				https://github.com/Atmosphere-NX/Atmosphere.git
				synced 2025-10-31 19:25:46 +01:00 
			
		
		
		
	* Implemented a system updater homebrew (titled Daybreak) * git subrepo pull ./troposphere/daybreak/nanovg subrepo: subdir: "troposphere/daybreak/nanovg" merged: "c197ba2f" upstream: origin: "https://github.com/Adubbz/nanovg-deko.git" branch: "master" commit: "c197ba2f" git-subrepo: version: "0.4.1" origin: "???" commit: "???" (+1 squashed commits) Squashed commits: [232dc943] git subrepo clone https://github.com/Adubbz/nanovg-deko.git troposphere/daybreak/nanovg subrepo: subdir: "troposphere/daybreak/nanovg" merged: "52bb784b" upstream: origin: "https://github.com/Adubbz/nanovg-deko.git" branch: "master" commit: "52bb784b" git-subrepo: version: "0.4.1" origin: "???" commit: "???" * daybreak: switch to using hiddbg for home blocking (+1 squashed commits) Squashed commits: [4bfc7b0d] daybreak: block the home button during installation
		
			
				
	
	
		
			38 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
| ** Sample Framework for deko3d Applications
 | |
| **   CExternalImage.cpp: Utility class for loading images from the filesystem
 | |
| */
 | |
| #include "CExternalImage.h"
 | |
| #include "FileLoader.h"
 | |
| 
 | |
| bool CExternalImage::load(CMemPool& imagePool, CMemPool& scratchPool, dk::Device device, dk::Queue transferQueue, const char* path, uint32_t width, uint32_t height, DkImageFormat format, uint32_t flags)
 | |
| {
 | |
|     CMemPool::Handle tempimgmem = LoadFile(scratchPool, path, DK_IMAGE_LINEAR_STRIDE_ALIGNMENT);
 | |
|     if (!tempimgmem)
 | |
|         return false;
 | |
| 
 | |
|     dk::UniqueCmdBuf tempcmdbuf = dk::CmdBufMaker{device}.create();
 | |
|     CMemPool::Handle tempcmdmem = scratchPool.allocate(DK_MEMBLOCK_ALIGNMENT);
 | |
|     tempcmdbuf.addMemory(tempcmdmem.getMemBlock(), tempcmdmem.getOffset(), tempcmdmem.getSize());
 | |
| 
 | |
|     dk::ImageLayout layout;
 | |
|     dk::ImageLayoutMaker{device}
 | |
|         .setFlags(flags)
 | |
|         .setFormat(format)
 | |
|         .setDimensions(width, height)
 | |
|         .initialize(layout);
 | |
| 
 | |
|     m_mem = imagePool.allocate(layout.getSize(), layout.getAlignment());
 | |
|     m_image.initialize(layout, m_mem.getMemBlock(), m_mem.getOffset());
 | |
|     m_descriptor.initialize(m_image);
 | |
| 
 | |
|     dk::ImageView imageView{m_image};
 | |
|     tempcmdbuf.copyBufferToImage({ tempimgmem.getGpuAddr() }, imageView, { 0, 0, 0, width, height, 1 });
 | |
|     transferQueue.submitCommands(tempcmdbuf.finishList());
 | |
|     transferQueue.waitIdle();
 | |
| 
 | |
|     tempcmdmem.destroy();
 | |
|     tempimgmem.destroy();
 | |
|     return true;
 | |
| }
 |