int sceJpegDecodeMJpegYCbCr(u32 jpegAddr, int jpegSize, u32 yCbCrAddr, int yCbCrSize, int dhtMode) { ERROR_LOG_REPORT(ME, "sceJpegDecodeMJpegYCbCr(%i, %i, %i, %i, %i)", jpegAddr, jpegSize, yCbCrAddr, yCbCrSize, dhtMode); if (!Memory::IsValidAddress(jpegAddr)) { return getWidthHeight(0, 0); } u8 *buf = Memory::GetPointer(jpegAddr); int width, height, actual_components; unsigned char *jpegBuf = jpgd::decompress_jpeg_image_from_memory(buf, jpegSize, &width, &height, &actual_components, 3); if (actual_components != 3) { // The assumption that the image was RGB was wrong... // Try again. int components = actual_components; jpegBuf = jpgd::decompress_jpeg_image_from_memory(buf, jpegSize, &width, &height, &actual_components, components); } if (jpegBuf == NULL) return getWidthHeight(0, 0); // TODO: There's more... return getWidthHeight(width, height); }
void ViewArray::enable(unsigned layer, bool use_vp, unsigned* ox, unsigned* oy, bool clearcolor) { glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &m_current_fbo); m_fbo->bind(); m_fbo->attachTextureLayer(GL_COLOR_ATTACHMENT0, m_colorArray.getTexture(), 0, layer); m_fbo->attachTextureLayer(GL_DEPTH_ATTACHMENT, m_depthArray.getTexture(), 0, layer); if(use_vp){ m_viewport.enter(); } else{ unsigned x; unsigned y; unsigned w; unsigned h; getWidthHeight(x,y,w,h); if(0 == ox || 0 == oy) std::cerr << " ViewArray::enable(unsigned layer, bool use_vp, unsigned* ox, unsigned* oy) ERROR" << std::endl; *ox = x; *oy = y; //std::cerr << x << " " << y << " " << w << " " << h << std::endl; m_viewport_current.set(x,y,w,h); glViewport(0,0,w,h); } if(clearcolor) { glClearColor(0.0,0.0,0.0,0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } else { glClear(GL_DEPTH_BUFFER_BIT); } }
//============================================================================= // Set spriteData.x,spriteData.y for current string and alignment. // The default alignment is LEFT. //============================================================================= void Text::doAlign(const std::string &str) { if(spriteData.texture == NULL) // if no texture return; UINT w, h; switch(align) { case textNS::CENTER: // center at x and align top to y getWidthHeight(str,w,h); spriteData.x -= w/2; break; case textNS::RIGHT: // right justify at x,y getWidthHeight(str,w,h); spriteData.x -= w; break; case textNS::CENTER_MIDDLE: // center at x and vertical middle to y getWidthHeight(str,w,h); spriteData.x -= w/2; spriteData.y -= h/2; break; case textNS::CENTER_BOTTOM: // center at x and align bottom to y getWidthHeight(str,w,h); spriteData.x -= w/2; spriteData.y -= h; break; case textNS::LEFT_BOTTOM: // left justify at x and align bottom to y getWidthHeight(str,w,h); spriteData.y -= h; break; case textNS::RIGHT_BOTTOM: // right justify at x and align bottom to y getWidthHeight(str,w,h); spriteData.x -= w; spriteData.y -= h; break; } }