本文整理汇总了C++中gfxMatrix::Rotate方法的典型用法代码示例。如果您正苦于以下问题:C++ gfxMatrix::Rotate方法的具体用法?C++ gfxMatrix::Rotate怎么用?C++ gfxMatrix::Rotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gfxMatrix
的用法示例。
在下文中一共展示了gfxMatrix::Rotate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
NS_IMETHODIMP
nsScreenGonk::SetRotation(PRUint32 aRotation)
{
if (!(ROTATION_0_DEG <= aRotation && aRotation <= ROTATION_270_DEG))
return NS_ERROR_ILLEGAL_VALUE;
if (sScreenRotation == aRotation)
return NS_OK;
sScreenRotation = aRotation;
sRotationMatrix.Reset();
switch ((aRotation + sPhysicalScreenRotation) % (360 / 90)) {
case nsIScreen::ROTATION_0_DEG:
sVirtualBounds = gScreenBounds;
break;
case nsIScreen::ROTATION_90_DEG:
sRotationMatrix.Translate(gfxPoint(gScreenBounds.width, 0));
sRotationMatrix.Rotate(M_PI / 2);
sVirtualBounds = nsIntRect(0, 0, gScreenBounds.height,
gScreenBounds.width);
break;
case nsIScreen::ROTATION_180_DEG:
sRotationMatrix.Translate(gfxPoint(gScreenBounds.width,
gScreenBounds.height));
sRotationMatrix.Rotate(M_PI);
sVirtualBounds = gScreenBounds;
break;
case nsIScreen::ROTATION_270_DEG:
sRotationMatrix.Translate(gfxPoint(0, gScreenBounds.height));
sRotationMatrix.Rotate(M_PI * 3 / 2);
sVirtualBounds = nsIntRect(0, 0, gScreenBounds.height,
gScreenBounds.width);
break;
default:
MOZ_NOT_REACHED("Unknown rotation");
break;
}
for (unsigned int i = 0; i < sTopWindows.Length(); i++)
sTopWindows[i]->Resize(sVirtualBounds.width,
sVirtualBounds.height,
!i);
nsAppShell::NotifyScreenRotation();
return NS_OK;
}
示例2: nsIntRect
nsWindow::nsWindow()
{
if (!sScreenInitialized) {
// Watching screen on/off state by using a pthread
// which implicitly calls exit() when the main thread ends
if (pthread_create(&sFramebufferWatchThread, NULL, frameBufferWatcher, NULL)) {
NS_RUNTIMEABORT("Failed to create framebufferWatcherThread, aborting...");
}
nsIntSize screenSize;
bool gotFB = Framebuffer::GetSize(&screenSize);
if (!gotFB) {
NS_RUNTIMEABORT("Failed to get size from framebuffer, aborting...");
}
gScreenBounds = nsIntRect(nsIntPoint(0, 0), screenSize);
char propValue[PROPERTY_VALUE_MAX];
property_get("ro.sf.hwrotation", propValue, "0");
sPhysicalScreenRotation = atoi(propValue) / 90;
// Unlike nsScreenGonk::SetRotation(), only support 0 and 180 as there
// are no known screens that are mounted at 90 or 270 at the moment.
switch (sPhysicalScreenRotation) {
case nsIScreen::ROTATION_0_DEG:
break;
case nsIScreen::ROTATION_180_DEG:
sRotationMatrix.Translate(gfxPoint(gScreenBounds.width,
gScreenBounds.height));
sRotationMatrix.Rotate(M_PI);
break;
default:
MOZ_NOT_REACHED("Unknown rotation");
break;
}
sVirtualBounds = gScreenBounds;
sScreenInitialized = true;
nsAppShell::NotifyScreenInitialized();
// This is a hack to force initialization of the compositor
// resources, if we're going to use omtc.
//
// NB: GetPlatform() will create the gfxPlatform, which wants
// to know the color depth, which asks our native window.
// This has to happen after other init has finished.
gfxPlatform::GetPlatform();
sUsingOMTC = ShouldUseOffMainThreadCompositing();
property_get("ro.display.colorfill", propValue, "0");
sUsingHwc = Preferences::GetBool("layers.composer2d.enabled",
atoi(propValue) == 1);
if (sUsingOMTC) {
sOMTCSurface = new gfxImageSurface(gfxIntSize(1, 1),
gfxASurface::ImageFormatRGB24);
}
}
}
示例3: UseOffMainThreadCompositing
nsWindow::nsWindow()
{
if (!sGLContext && !sFramebufferOpen && !sUsingOMTC) {
// workaround Bug 725143
hal::SetScreenEnabled(true);
// Watching screen on/off state by using a pthread
// which implicitly calls exit() when the main thread ends
if (pthread_create(&sFramebufferWatchThread, NULL, frameBufferWatcher, NULL)) {
NS_RUNTIMEABORT("Failed to create framebufferWatcherThread, aborting...");
}
sUsingOMTC = UseOffMainThreadCompositing();
// We (apparently) don't have a way to tell if allocating the
// fbs succeeded or failed.
gNativeWindow = new android::FramebufferNativeWindow();
if (sUsingOMTC) {
nsIntSize screenSize;
bool gotFB = Framebuffer::GetSize(&screenSize);
MOZ_ASSERT(gotFB);
gScreenBounds = nsIntRect(nsIntPoint(0, 0), screenSize);
sOMTCSurface = new gfxImageSurface(gfxIntSize(1, 1),
gfxASurface::ImageFormatRGB24);
} else {
sGLContext = GLContextProvider::CreateForWindow(this);
// CreateForWindow sets up gScreenBounds
if (!sGLContext) {
LOG("Failed to create GL context for fb, trying /dev/graphics/fb0");
// We can't delete gNativeWindow.
nsIntSize screenSize;
sFramebufferOpen = Framebuffer::Open(&screenSize);
gScreenBounds = nsIntRect(nsIntPoint(0, 0), screenSize);
if (!sFramebufferOpen) {
LOG("Failed to mmap fb(?!?), aborting ...");
NS_RUNTIMEABORT("Can't open GL context and can't fall back on /dev/graphics/fb0 ...");
}
}
}
char propValue[PROPERTY_VALUE_MAX];
property_get("ro.sf.hwrotation", propValue, "0");
sPhysicalScreenRotation = atoi(propValue) / 90;
// Unlike nsScreenGonk::SetRotation(), only support 0 and 180 as there
// are no known screens that are mounted at 90 or 270 at the moment.
switch (sPhysicalScreenRotation) {
case nsIScreen::ROTATION_0_DEG:
break;
case nsIScreen::ROTATION_180_DEG:
sRotationMatrix.Translate(gfxPoint(gScreenBounds.width,
gScreenBounds.height));
sRotationMatrix.Rotate(M_PI);
break;
default:
MOZ_NOT_REACHED("Unknown rotation");
break;
}
sVirtualBounds = gScreenBounds;
nsAppShell::NotifyScreenInitialized();
}
}