From 8e33ef1321e50457dd032d57bdc3233b4fd0f18b Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Thu, 24 Sep 2009 16:21:24 +0200 Subject: Adopt Qt coding style. --- src/3rdparty/phonon/mmf/utils.cpp | 120 +++++++++++++++++++------------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/src/3rdparty/phonon/mmf/utils.cpp b/src/3rdparty/phonon/mmf/utils.cpp index 107a36d..294a9a2 100644 --- a/src/3rdparty/phonon/mmf/utils.cpp +++ b/src/3rdparty/phonon/mmf/utils.cpp @@ -59,80 +59,80 @@ MMF::MediaType MMF::Utils::mimeTypeToMediaType(const TDesC& mimeType) struct TScreenInfo { - int width; - int height; - int bpp; - const char* address; - int initialOffset; - int lineOffset; - TDisplayMode displayMode; + int width; + int height; + int bpp; + const char* address; + int initialOffset; + int lineOffset; + TDisplayMode displayMode; }; void getScreenInfoL(TScreenInfo& info) { - info.displayMode = CEikonEnv::Static()->ScreenDevice()->DisplayMode(); - - // Then we must set these as the input parameter - info.width = info.displayMode; - info.height = info.displayMode; - info.initialOffset = info.displayMode; - info.lineOffset = info.displayMode; - info.bpp = info.displayMode; - - User::LeaveIfError( HAL::Get(HALData::EDisplayXPixels, info.width) ); - User::LeaveIfError( HAL::Get(HALData::EDisplayYPixels, info.width) ); - - int address; - User::LeaveIfError( HAL::Get(HALData::EDisplayMemoryAddress, address) ); - info.address = reinterpret_cast(address); - - User::LeaveIfError( HAL::Get(HALData::EDisplayOffsetToFirstPixel, info.initialOffset) ); - - User::LeaveIfError( HAL::Get(HALData::EDisplayOffsetBetweenLines, info.lineOffset) ); - - User::LeaveIfError( HAL::Get(HALData::EDisplayBitsPerPixel, info.bpp) ); + info.displayMode = CEikonEnv::Static()->ScreenDevice()->DisplayMode(); + + // Then we must set these as the input parameter + info.width = info.displayMode; + info.height = info.displayMode; + info.initialOffset = info.displayMode; + info.lineOffset = info.displayMode; + info.bpp = info.displayMode; + + User::LeaveIfError( HAL::Get(HALData::EDisplayXPixels, info.width) ); + User::LeaveIfError( HAL::Get(HALData::EDisplayYPixels, info.width) ); + + int address; + User::LeaveIfError( HAL::Get(HALData::EDisplayMemoryAddress, address) ); + info.address = reinterpret_cast(address); + + User::LeaveIfError( HAL::Get(HALData::EDisplayOffsetToFirstPixel, info.initialOffset) ); + + User::LeaveIfError( HAL::Get(HALData::EDisplayOffsetBetweenLines, info.lineOffset) ); + + User::LeaveIfError( HAL::Get(HALData::EDisplayBitsPerPixel, info.bpp) ); } QColor MMF::Utils::getScreenPixel(const QPoint& pos) { - TScreenInfo info; - TRAPD(err, getScreenInfoL(info)); - QColor pixel; - if(err == KErrNone and pos.x() < info.width and pos.y() < info.height) - { - const int bytesPerPixel = info.bpp / 8; - Q_ASSERT(bytesPerPixel >= 3); - - const int stride = (info.width * bytesPerPixel) + info.lineOffset; - - const char* ptr = - info.address - + info.initialOffset - + pos.y() * stride - + pos.x() * bytesPerPixel; - - // BGRA - pixel.setBlue(*ptr++); - pixel.setGreen(*ptr++); - pixel.setRed(*ptr++); - - if(bytesPerPixel == 4) - pixel.setAlpha(*ptr++); - } - return pixel; + TScreenInfo info; + TRAPD(err, getScreenInfoL(info)); + QColor pixel; + if(err == KErrNone and pos.x() < info.width and pos.y() < info.height) + { + const int bytesPerPixel = info.bpp / 8; + Q_ASSERT(bytesPerPixel >= 3); + + const int stride = (info.width * bytesPerPixel) + info.lineOffset; + + const char* ptr = + info.address + + info.initialOffset + + pos.y() * stride + + pos.x() * bytesPerPixel; + + // BGRA + pixel.setBlue(*ptr++); + pixel.setGreen(*ptr++); + pixel.setRed(*ptr++); + + if(bytesPerPixel == 4) + pixel.setAlpha(*ptr++); + } + return pixel; } // Debugging: for debugging video visibility -void MMF::Utils::dumpScreenPixelSample() +void MMF::Utils::dumpScreenPixelSample() { for(int i=0; i<20; ++i) { - const QPoint pos(i*10, i*10); - const QColor pixel = Utils::getScreenPixel(pos); - RDebug::Printf( - "Phonon::MMF::Utils::dumpScreenPixelSample %d %d = %d %d %d %d", - pos.x(), pos.y(), pixel.red(), pixel.green(), pixel.blue(), pixel.alpha() - ); + const QPoint pos(i*10, i*10); + const QColor pixel = Utils::getScreenPixel(pos); + RDebug::Printf( + "Phonon::MMF::Utils::dumpScreenPixelSample %d %d = %d %d %d %d", + pos.x(), pos.y(), pixel.red(), pixel.green(), pixel.blue(), pixel.alpha() + ); } } -- cgit v0.12