summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/3rdparty/phonon/mmf/utils.cpp75
-rw-r--r--src/3rdparty/phonon/mmf/utils.h9
-rw-r--r--src/plugins/phonon/mmf/plugin/plugin.pro1
3 files changed, 85 insertions, 0 deletions
diff --git a/src/3rdparty/phonon/mmf/utils.cpp b/src/3rdparty/phonon/mmf/utils.cpp
index cebc32e..3d674fd 100644
--- a/src/3rdparty/phonon/mmf/utils.cpp
+++ b/src/3rdparty/phonon/mmf/utils.cpp
@@ -50,5 +50,80 @@ MMF::MediaType MMF::Utils::mimeTypeToMediaType(const TDesC& mimeType)
}
+#ifdef _DEBUG
+
+#include <hal.h>
+#include <hal_data.h>
+#include <gdi.h>
+#include <eikenv.h>
+
+struct TScreenInfo
+{
+ 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) );
+}
+
+
+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;
+}
+
+#endif // _DEBUG
+
QT_END_NAMESPACE
diff --git a/src/3rdparty/phonon/mmf/utils.h b/src/3rdparty/phonon/mmf/utils.h
index 5a26018..7db7831 100644
--- a/src/3rdparty/phonon/mmf/utils.h
+++ b/src/3rdparty/phonon/mmf/utils.h
@@ -22,6 +22,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <private/qcore_symbian_p.h>
#include <e32debug.h> // for RDebug
+#include <QColor>
+
#include "defs.h"
QT_BEGIN_NAMESPACE
@@ -51,6 +53,13 @@ void panic(PanicCode code);
* type. If it is neither, the function returns MediaTypeUnknown.
*/
MediaType mimeTypeToMediaType(const TDesC& mimeType);
+
+#ifdef _DEBUG
+/**
+ * Retrieve color of specified pixel from the screen.
+ */
+QColor getScreenPixel(const QPoint& pos);
+#endif
}
/**
diff --git a/src/plugins/phonon/mmf/plugin/plugin.pro b/src/plugins/phonon/mmf/plugin/plugin.pro
index c7bb327d..d620453 100644
--- a/src/plugins/phonon/mmf/plugin/plugin.pro
+++ b/src/plugins/phonon/mmf/plugin/plugin.pro
@@ -63,6 +63,7 @@ SOURCES += \
debug {
INCLUDEPATH += $$PHONON_MMF_DIR/mmfphonondebug
LIBS += -lphonon_mmf_debug.lib
+ LIBS += -lhal
}
LIBS += -lmediaclientvideo # For CVideoPlayerUtility