当前位置: 首页>>代码示例>>C++>>正文


C++ nsIntRect::Width方法代码示例

本文整理汇总了C++中nsIntRect::Width方法的典型用法代码示例。如果您正苦于以下问题:C++ nsIntRect::Width方法的具体用法?C++ nsIntRect::Width怎么用?C++ nsIntRect::Width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nsIntRect的用法示例。


在下文中一共展示了nsIntRect::Width方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: switch

gfx::Matrix
ComputeTransformForUnRotation(const nsIntRect& aBounds,
                              ScreenRotation aRotation)
{
    gfx::Matrix transform;
    static const gfx::Float floatPi = static_cast<gfx::Float>(M_PI);

    switch (aRotation) {
    case ROTATION_0:
        break;
    case ROTATION_90:
        transform.PreTranslate(0, aBounds.Height());
        transform.PreRotate(floatPi * 3 / 2);
        break;
    case ROTATION_180:
        transform.PreTranslate(aBounds.Width(), aBounds.Height());
        transform.PreRotate(floatPi);
        break;
    case ROTATION_270:
        transform.PreTranslate(aBounds.Width(), 0);
        transform.PreRotate(floatPi / 2);
        break;
    default:
        MOZ_CRASH("Unknown rotation");
    }
    return transform;
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:27,代码来源:WidgetUtils.cpp

示例2: RotateRect

nsIntRect RotateRect(nsIntRect aRect,
                     const nsIntRect& aBounds,
                     ScreenRotation aRotation)
{
  switch (aRotation) {
    case ROTATION_0:
      return aRect;
    case ROTATION_90:
      return nsIntRect(aRect.Y(),
                       aBounds.Width() - aRect.XMost(),
                       aRect.Height(), aRect.Width());
    case ROTATION_180:
      return nsIntRect(aBounds.Width() - aRect.XMost(),
                       aBounds.Height() - aRect.YMost(),
                       aRect.Width(), aRect.Height());
    case ROTATION_270:
      return nsIntRect(aBounds.Height() - aRect.YMost(),
                       aRect.X(),
                       aRect.Height(), aRect.Width());
    default:
      MOZ_CRASH("Unknown rotation");
  }
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:23,代码来源:WidgetUtils.cpp

示例3: cx

bool
TabChild::RecvUpdateFrame(const nsIntRect& aDisplayPort,
                          const nsIntPoint& aScrollOffset,
                          const gfxSize& aResolution,
                          const nsIntRect& aScreenSize)
{
    if (!mCx || !mTabChildGlobal) {
        return true;
    }
    nsCString data;
    data += nsPrintfCString("{ \"x\" : %d", aScrollOffset.x);
    data += nsPrintfCString(", \"y\" : %d", aScrollOffset.y);
    // We don't treat the x and y scales any differently for this
    // semi-platform-specific code.
    data += nsPrintfCString(", \"zoom\" : %f", aResolution.width);
    data += nsPrintfCString(", \"displayPort\" : ");
        data += nsPrintfCString("{ \"left\" : %d", aDisplayPort.X());
        data += nsPrintfCString(", \"top\" : %d", aDisplayPort.Y());
        data += nsPrintfCString(", \"width\" : %d", aDisplayPort.Width());
        data += nsPrintfCString(", \"height\" : %d", aDisplayPort.Height());
        data += nsPrintfCString(", \"resolution\" : %f", aResolution.width);
        data += nsPrintfCString(" }");
    data += nsPrintfCString(", \"screenSize\" : ");
        data += nsPrintfCString("{ \"width\" : %d", aScreenSize.width);
        data += nsPrintfCString(", \"height\" : %d", aScreenSize.height);
        data += nsPrintfCString(" }");
    data += nsPrintfCString(" }");

    jsval json = JSVAL_NULL;
    StructuredCloneData cloneData;
    JSAutoStructuredCloneBuffer buffer;
    if (JS_ParseJSON(mCx,
                      static_cast<const jschar*>(NS_ConvertUTF8toUTF16(data).get()),
                      data.Length(),
                      &json)) {
        WriteStructuredClone(mCx, json, buffer, cloneData.mClosure);
    }

    nsFrameScriptCx cx(static_cast<nsIWebBrowserChrome*>(this), this);
    // Let the BrowserElementScrolling helper (if it exists) for this
    // content manipulate the frame state.
    nsRefPtr<nsFrameMessageManager> mm =
      static_cast<nsFrameMessageManager*>(mTabChildGlobal->mMessageManager.get());
    mm->ReceiveMessage(static_cast<nsIDOMEventTarget*>(mTabChildGlobal),
                       NS_LITERAL_STRING("Viewport:Change"), false,
                       &cloneData, nullptr, nullptr);
    return true;
}
开发者ID:bebef1987,项目名称:mozilla-central,代码行数:48,代码来源:TabChild.cpp


注:本文中的nsIntRect::Width方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。