diff options
author | Frans Englich <frans.englich@nokia.com> | 2009-09-24 14:21:24 (GMT) |
---|---|---|
committer | Frans Englich <frans.englich@nokia.com> | 2009-09-24 14:25:14 (GMT) |
commit | 8e33ef1321e50457dd032d57bdc3233b4fd0f18b (patch) | |
tree | d45f31720e9511683989296c41c6727505c61644 /src/3rdparty/phonon/mmf | |
parent | a9f0a5b7399be3f298527ec2565940322d1be3a3 (diff) | |
download | Qt-8e33ef1321e50457dd032d57bdc3233b4fd0f18b.zip Qt-8e33ef1321e50457dd032d57bdc3233b4fd0f18b.tar.gz Qt-8e33ef1321e50457dd032d57bdc3233b4fd0f18b.tar.bz2 |
Adopt Qt coding style.
Diffstat (limited to 'src/3rdparty/phonon/mmf')
-rw-r--r-- | src/3rdparty/phonon/mmf/utils.cpp | 120 |
1 files 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<const char*>(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<const char*>(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() + ); } } |