Bug 990305 - Move IsInEmulator() from GrallocImage to gfxPlatform r=nical

This commit is contained in:
Sotaro Ikeda 2014-04-01 06:33:49 -07:00
parent 2ac3bae2e0
commit a56bfe74a2
4 changed files with 20 additions and 10 deletions

View File

@ -15,7 +15,6 @@
#include "YCbCrUtils.h" // for YCbCr conversions
#include <ColorConverter.h>
#include <cutils/properties.h>
#include <OMX_IVCommon.h>
@ -48,14 +47,6 @@ struct GraphicBufferAutoUnlock {
~GraphicBufferAutoUnlock() { mGraphicBuffer->unlock(); }
};
static bool
IsInEmulator()
{
char propQemu[PROPERTY_VALUE_MAX];
property_get("ro.kernel.qemu", propQemu, "");
return !strncmp(propQemu, "1", 1);
}
GrallocImage::GrallocImage()
: PlanarYCbCrImage(nullptr)
{
@ -77,7 +68,7 @@ GrallocImage::SetData(const Data& aData)
mData = aData;
mSize = aData.mPicSize;
if (IsInEmulator()) {
if (gfxPlatform::GetPlatform()->IsInGonkEmulator()) {
// Emulator does not support HAL_PIXEL_FORMAT_YV12.
return;
}

View File

@ -26,6 +26,10 @@
#include "AndroidBridge.h"
#endif
#ifdef MOZ_WIDGET_GONK
#include <cutils/properties.h>
#endif
#include "ft2build.h"
#include FT_FREETYPE_H
#include FT_MODULE_H
@ -129,6 +133,11 @@ gfxAndroidPlatform::gfxAndroidPlatform()
mOffscreenFormat = gfxImageFormat::RGB16_565;
}
#ifdef MOZ_WIDGET_GONK
char propQemu[PROPERTY_VALUE_MAX];
property_get("ro.kernel.qemu", propQemu, "");
mIsInGonkEmulator = !strncmp(propQemu, "1", 1);
#endif
}
gfxAndroidPlatform::~gfxAndroidPlatform()

View File

@ -80,9 +80,17 @@ public:
virtual bool UseAcceleratedSkiaCanvas() MOZ_OVERRIDE;
#ifdef MOZ_WIDGET_GONK
virtual bool IsInGonkEmulator() const { return mIsInGonkEmulator; }
#endif
private:
int mScreenDepth;
gfxImageFormat mOffscreenFormat;
#ifdef MOZ_WIDGET_GONK
bool mIsInGonkEmulator;
#endif
};
#endif /* GFX_PLATFORM_ANDROID_H */

View File

@ -591,6 +591,8 @@ public:
mozilla::gl::SkiaGLGlue* GetSkiaGLGlue();
void PurgeSkiaCache();
virtual bool IsInGonkEmulator() const { return false; }
protected:
gfxPlatform();
virtual ~gfxPlatform();