本文整理汇总了C++中IntSize函数的典型用法代码示例。如果您正苦于以下问题:C++ IntSize函数的具体用法?C++ IntSize怎么用?C++ IntSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IntSize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IntSize
IntSize RenderThemeGtk::sliderTickSize() const
{
// FIXME: We need to set this to the size of one tick mark.
return IntSize(0, 0);
}
示例2: PrintContextTest
explicit PrintContextTest(PassOwnPtrWillBeRawPtr<FrameLoaderClient> frameLoaderClient = nullptr)
: m_pageHolder(DummyPageHolder::create(IntSize(kPageWidth, kPageHeight), nullptr, frameLoaderClient))
, m_printContext(adoptPtrWillBeNoop(new MockPrintContext(document().frame()))) { }
示例3: IntSize
void
MediaEngineTabVideoSource::Draw() {
if (!mWindow) {
return;
}
if (mScrollWithPage || mViewportWidth == INT32_MAX) {
mWindow->GetInnerWidth(&mViewportWidth);
}
if (mScrollWithPage || mViewportHeight == INT32_MAX) {
mWindow->GetInnerHeight(&mViewportHeight);
}
if (!mViewportWidth || !mViewportHeight) {
return;
}
IntSize size;
{
float pixelRatio;
mWindow->GetDevicePixelRatio(&pixelRatio);
const int32_t deviceWidth = (int32_t)(pixelRatio * mViewportWidth);
const int32_t deviceHeight = (int32_t)(pixelRatio * mViewportHeight);
if ((deviceWidth <= mBufWidthMax) && (deviceHeight <= mBufHeightMax)) {
size = IntSize(deviceWidth, deviceHeight);
} else {
const float scaleWidth = (float)mBufWidthMax / (float)deviceWidth;
const float scaleHeight = (float)mBufHeightMax / (float)deviceHeight;
const float scale = scaleWidth < scaleHeight ? scaleWidth : scaleHeight;
size = IntSize((int)(scale * deviceWidth), (int)(scale * deviceHeight));
}
}
gfxImageFormat format = SurfaceFormat::X8R8G8B8_UINT32;
uint32_t stride = gfxASurface::FormatStrideForWidth(format, size.width);
if (mDataSize < static_cast<size_t>(stride * size.height)) {
mDataSize = stride * size.height;
mData = static_cast<unsigned char*>(malloc(mDataSize));
}
if (!mData) {
return;
}
nsCOMPtr<nsIPresShell> presShell;
{
RefPtr<nsPresContext> presContext;
nsIDocShell* docshell = mWindow->GetDocShell();
if (docshell) {
docshell->GetPresContext(getter_AddRefs(presContext));
}
if (!presContext) {
return;
}
presShell = presContext->PresShell();
}
nscolor bgColor = NS_RGB(255, 255, 255);
uint32_t renderDocFlags = mScrollWithPage? 0 :
(nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING |
nsIPresShell::RENDER_DOCUMENT_RELATIVE);
nsRect r(nsPresContext::CSSPixelsToAppUnits((float)mViewportOffsetX),
nsPresContext::CSSPixelsToAppUnits((float)mViewportOffsetY),
nsPresContext::CSSPixelsToAppUnits((float)mViewportWidth),
nsPresContext::CSSPixelsToAppUnits((float)mViewportHeight));
RefPtr<layers::ImageContainer> container = layers::LayerManager::CreateImageContainer();
RefPtr<DrawTarget> dt =
Factory::CreateDrawTargetForData(BackendType::CAIRO,
mData.rwget(),
size,
stride,
SurfaceFormat::B8G8R8X8);
if (!dt) {
return;
}
RefPtr<gfxContext> context = new gfxContext(dt);
context->SetMatrix(context->CurrentMatrix().Scale((((float) size.width)/mViewportWidth),
(((float) size.height)/mViewportHeight)));
NS_ENSURE_SUCCESS_VOID(presShell->RenderDocument(r, renderDocFlags, bgColor, context));
RefPtr<SourceSurface> surface = dt->Snapshot();
if (!surface) {
return;
}
RefPtr<layers::SourceSurfaceImage> image = new layers::SourceSurfaceImage(size, surface);
MonitorAutoLock mon(mMonitor);
mImage = image;
}
示例4: createGpuMemoryBufferImageCHROMIUM
WGC3Duint createGpuMemoryBufferImageCHROMIUM(WGC3Dsizei width, WGC3Dsizei height, WGC3Denum internalformat, WGC3Denum usage) override
{
m_imageSizes.set(m_currentImageId, IntSize(width, height));
return m_currentImageId++;
}
示例5: TEST_F
TEST_F(DrawingBufferImageChromiumTest, verifyResizingReallocatesImages)
{
WebExternalTextureMailbox mailbox;
IntSize initialSize(initialWidth, initialHeight);
IntSize alternateSize(initialWidth, alternateHeight);
WGC3Duint m_imageId1 = webContext()->nextImageIdToBeCreated();
EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId1)).Times(1);
// Produce one mailbox at size 100x100.
m_drawingBuffer->markContentsChanged();
EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize());
EXPECT_TRUE(mailbox.allowOverlay);
testing::Mock::VerifyAndClearExpectations(webContext());
WGC3Duint m_imageId2 = webContext()->nextImageIdToBeCreated();
EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId2)).Times(1);
EXPECT_CALL(*webContext(), destroyImageMock(m_imageId0)).Times(1);
EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId0)).Times(1);
// Resize to 100x50.
m_drawingBuffer->reset(IntSize(initialWidth, alternateHeight));
m_drawingBuffer->mailboxReleased(mailbox, false);
testing::Mock::VerifyAndClearExpectations(webContext());
WGC3Duint m_imageId3 = webContext()->nextImageIdToBeCreated();
EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId3)).Times(1);
EXPECT_CALL(*webContext(), destroyImageMock(m_imageId1)).Times(1);
EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId1)).Times(1);
// Produce a mailbox at this size.
m_drawingBuffer->markContentsChanged();
EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
EXPECT_EQ(alternateSize, webContext()->mostRecentlyProducedSize());
EXPECT_TRUE(mailbox.allowOverlay);
testing::Mock::VerifyAndClearExpectations(webContext());
WGC3Duint m_imageId4 = webContext()->nextImageIdToBeCreated();
EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId4)).Times(1);
EXPECT_CALL(*webContext(), destroyImageMock(m_imageId2)).Times(1);
EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId2)).Times(1);
// Reset to initial size.
m_drawingBuffer->reset(IntSize(initialWidth, initialHeight));
m_drawingBuffer->mailboxReleased(mailbox, false);
testing::Mock::VerifyAndClearExpectations(webContext());
WGC3Duint m_imageId5 = webContext()->nextImageIdToBeCreated();
EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId5)).Times(1);
EXPECT_CALL(*webContext(), destroyImageMock(m_imageId3)).Times(1);
EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId3)).Times(1);
// Prepare another mailbox and verify that it's the correct size.
m_drawingBuffer->markContentsChanged();
EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize());
EXPECT_TRUE(mailbox.allowOverlay);
testing::Mock::VerifyAndClearExpectations(webContext());
// Prepare one final mailbox and verify that it's the correct size.
m_drawingBuffer->mailboxReleased(mailbox, false);
m_drawingBuffer->markContentsChanged();
EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize());
EXPECT_TRUE(mailbox.allowOverlay);
m_drawingBuffer->mailboxReleased(mailbox, false);
EXPECT_CALL(*webContext(), destroyImageMock(m_imageId5)).Times(1);
EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId5)).Times(1);
EXPECT_CALL(*webContext(), destroyImageMock(m_imageId4)).Times(1);
EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId4)).Times(1);
m_drawingBuffer->beginDestruction();
testing::Mock::VerifyAndClearExpectations(webContext());
}
示例6: ImageSource
bool GraphicsContext3D::ImageExtractor::extractImage(bool premultiplyAlpha, bool ignoreGammaAndColorProfile)
{
if (!m_image)
return false;
// We need this to stay in scope because the native image is just a shallow copy of the data.
m_decoder = new ImageSource(premultiplyAlpha ? ImageSource::AlphaPremultiplied : ImageSource::AlphaNotPremultiplied, ignoreGammaAndColorProfile ? ImageSource::GammaAndColorProfileIgnored : ImageSource::GammaAndColorProfileApplied);
if (!m_decoder)
return false;
ImageSource& decoder = *m_decoder;
m_alphaOp = AlphaDoNothing;
if (m_image->data()) {
decoder.setData(m_image->data(), true);
if (!decoder.frameCount() || !decoder.frameIsCompleteAtIndex(0))
return false;
m_imageSurface = decoder.createFrameAtIndex(0);
} else {
m_imageSurface = m_image->nativeImageForCurrentFrame();
// 1. For texImage2D with HTMLVideoElment input, assume no PremultiplyAlpha had been applied and the alpha value is 0xFF for each pixel,
// which is true at present and may be changed in the future and needs adjustment accordingly.
// 2. For texImage2D with HTMLCanvasElement input in which Alpha is already Premultiplied in this port,
// do AlphaDoUnmultiply if UNPACK_PREMULTIPLY_ALPHA_WEBGL is set to false.
if (!premultiplyAlpha && m_imageHtmlDomSource != HtmlDomVideo)
m_alphaOp = AlphaDoUnmultiply;
// if m_imageSurface is not an image, extract a copy of the surface
if (m_imageSurface && cairo_surface_get_type(m_imageSurface.get()) != CAIRO_SURFACE_TYPE_IMAGE) {
RefPtr<cairo_surface_t> tmpSurface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, m_imageWidth, m_imageHeight));
copyRectFromOneSurfaceToAnother(m_imageSurface.get(), tmpSurface.get(), IntSize(), IntRect(0, 0, m_imageWidth, m_imageHeight), IntSize(), CAIRO_OPERATOR_SOURCE);
m_imageSurface = tmpSurface.release();
}
}
if (!m_imageSurface)
return false;
ASSERT(cairo_surface_get_type(m_imageSurface.get()) == CAIRO_SURFACE_TYPE_IMAGE);
IntSize imageSize = cairoSurfaceSize(m_imageSurface.get());
m_imageWidth = imageSize.width();
m_imageHeight = imageSize.height();
if (!m_imageWidth || !m_imageHeight)
return false;
if (cairo_image_surface_get_format(m_imageSurface.get()) != CAIRO_FORMAT_ARGB32)
return false;
unsigned int srcUnpackAlignment = 1;
size_t bytesPerRow = cairo_image_surface_get_stride(m_imageSurface.get());
size_t bitsPerPixel = 32;
unsigned padding = bytesPerRow - bitsPerPixel / 8 * m_imageWidth;
if (padding) {
srcUnpackAlignment = padding + 1;
while (bytesPerRow % srcUnpackAlignment)
++srcUnpackAlignment;
}
m_imagePixelData = cairo_image_surface_get_data(m_imageSurface.get());
m_imageSourceFormat = DataFormatBGRA8;
m_imageSourceUnpackAlignment = srcUnpackAlignment;
return true;
}
示例7: IntSize
WebCore::IntSize PageClientImpl::viewSize()
{
auto* drawingArea = static_cast<DrawingAreaProxyImpl*>(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_viewWidget))->drawingArea());
return drawingArea ? drawingArea->size() : IntSize();
}
示例8: IntRect
IntRect TileController::boundsAtLastRevalidateWithoutMargin() const
{
IntRect boundsWithoutMargin = IntRect(IntPoint(), m_boundsAtLastRevalidate.size());
boundsWithoutMargin.contract(IntSize(leftMarginWidth() + rightMarginWidth(), topMarginHeight() + bottomMarginHeight()));
return boundsWithoutMargin;
}
示例9: SetUp
void SurroundingTextTest::SetUp()
{
m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
}
示例10: nsPromiseFlatString
/* static */
nsresult
ImageEncoder::ExtractDataInternal(const nsAString& aType,
const nsAString& aOptions,
uint8_t* aImageBuffer,
int32_t aFormat,
const nsIntSize aSize,
layers::Image* aImage,
nsICanvasRenderingContextInternal* aContext,
layers::AsyncCanvasRenderer* aRenderer,
nsIInputStream** aStream,
imgIEncoder* aEncoder)
{
if (aSize.IsEmpty()) {
return NS_ERROR_INVALID_ARG;
}
nsCOMPtr<nsIInputStream> imgStream;
// get image bytes
nsresult rv;
if (aImageBuffer) {
rv = ImageEncoder::GetInputStream(
aSize.width,
aSize.height,
aImageBuffer,
aFormat,
aEncoder,
nsPromiseFlatString(aOptions).get(),
getter_AddRefs(imgStream));
} else if (aContext) {
NS_ConvertUTF16toUTF8 encoderType(aType);
rv = aContext->GetInputStream(encoderType.get(),
nsPromiseFlatString(aOptions).get(),
getter_AddRefs(imgStream));
} else if (aRenderer) {
NS_ConvertUTF16toUTF8 encoderType(aType);
rv = aRenderer->GetInputStream(encoderType.get(),
nsPromiseFlatString(aOptions).get(),
getter_AddRefs(imgStream));
} else if (aImage) {
// It is safe to convert PlanarYCbCr format from YUV to RGB off-main-thread.
// Other image formats could have problem to convert format off-main-thread.
// So here it uses a help function GetBRGADataSourceSurfaceSync() to convert
// format on main thread.
if (aImage->GetFormat() == ImageFormat::PLANAR_YCBCR) {
nsTArray<uint8_t> data;
layers::PlanarYCbCrImage* ycbcrImage = static_cast<layers::PlanarYCbCrImage*> (aImage);
gfxImageFormat format = SurfaceFormat::A8R8G8B8_UINT32;
uint32_t stride = GetAlignedStride<16>(aSize.width * 4);
size_t length = BufferSizeFromStrideAndHeight(stride, aSize.height);
data.SetCapacity(length);
gfxUtils::ConvertYCbCrToRGB(*ycbcrImage->GetData(),
format,
aSize,
data.Elements(),
stride);
rv = aEncoder->InitFromData(data.Elements(),
aSize.width * aSize.height * 4,
aSize.width,
aSize.height,
aSize.width * 4,
imgIEncoder::INPUT_FORMAT_HOSTARGB,
aOptions);
} else {
RefPtr<gfx::DataSourceSurface> dataSurface;
RefPtr<layers::Image> image(aImage);
dataSurface = GetBRGADataSourceSurfaceSync(image.forget());
DataSourceSurface::MappedSurface map;
if (!dataSurface->Map(gfx::DataSourceSurface::MapType::READ, &map)) {
return NS_ERROR_INVALID_ARG;
}
rv = aEncoder->InitFromData(map.mData,
aSize.width * aSize.height * 4,
aSize.width,
aSize.height,
aSize.width * 4,
imgIEncoder::INPUT_FORMAT_HOSTARGB,
aOptions);
dataSurface->Unmap();
}
if (NS_SUCCEEDED(rv)) {
imgStream = do_QueryInterface(aEncoder);
}
} else {
// no context, so we have to encode an empty image
// note that if we didn't have a current context, the spec says we're
// supposed to just return transparent black pixels of the canvas
// dimensions.
RefPtr<DataSourceSurface> emptyCanvas =
Factory::CreateDataSourceSurfaceWithStride(IntSize(aSize.width, aSize.height),
SurfaceFormat::B8G8R8A8,
4 * aSize.width, true);
if (NS_WARN_IF(!emptyCanvas)) {
return NS_ERROR_INVALID_ARG;
}
//.........这里部分代码省略.........
示例11: setSize
void MultiList2::setSize(int _width, int _height)
{
setSize(IntSize(_width, _height));
}
示例12: ASSERT
void IconController::continueLoadWithDecision(IconLoadDecision iconLoadDecision)
{
ASSERT(iconLoadDecision != IconLoadUnknown);
if (iconLoadDecision == IconLoadNo) {
KURL iconURL(url());
String urlString(iconURL.string());
if (urlString.isEmpty())
return;
LOG(IconDatabase, "IconController::startLoader() - Told not to load this icon, committing iconURL %s to database for pageURL mapping", urlString.ascii().data());
commitToDatabase(iconURL);
if (iconDatabase().supportsAsynchronousMode()) {
m_frame->loader()->documentLoader()->getIconDataForIconURL(urlString);
return;
}
// We were told not to load this icon - that means this icon is already known by the database
// If the icon data hasn't been read in from disk yet, kick off the read of the icon from the database to make sure someone
// has done it. This is after registering for the notification so the WebView can call the appropriate delegate method.
// Otherwise if the icon data *is* available, notify the delegate
if (!iconDatabase().synchronousIconDataKnownForIconURL(urlString)) {
LOG(IconDatabase, "Told not to load icon %s but icon data is not yet available - registering for notification and requesting load from disk", urlString.ascii().data());
m_frame->loader()->client()->registerForIconNotification();
iconDatabase().synchronousIconForPageURL(m_frame->document()->url().string(), IntSize(0, 0));
iconDatabase().synchronousIconForPageURL(m_frame->loader()->initialRequest().url().string(), IntSize(0, 0));
} else
m_frame->loader()->client()->dispatchDidReceiveIcon();
return;
}
if (!m_iconLoader)
m_iconLoader = IconLoader::create(m_frame);
m_iconLoader->startLoading();
}
示例13: IntSize
IntSize TextureMapperImageBuffer::maxTextureSize() const
{
return IntSize(s_maximumAllowedImageBufferDimension, s_maximumAllowedImageBufferDimension);
}
示例14: size
virtual IntSize size() const { return IntSize(m_data->m_bitmap->width(), m_data->m_bitmap->height()); }
示例15: screenRect
FloatRect screenRect(Widget* widget)
{
return FloatRect(FloatPoint(), FloatSize(IntSize(BlackBerry::Platform::Graphics::Screen::primaryScreen()->size())));
}