本文整理汇总了C++中webcore::IntSize类的典型用法代码示例。如果您正苦于以下问题:C++ IntSize类的具体用法?C++ IntSize怎么用?C++ IntSize使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IntSize类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getVideoSizeAndFormatFromCaps
bool getVideoSizeAndFormatFromCaps(GstCaps* caps, WebCore::IntSize& size, GstVideoFormat& format, int& pixelAspectRatioNumerator, int& pixelAspectRatioDenominator, int& stride)
{
#ifdef GST_API_VERSION_1
GstVideoInfo info;
if (!gst_video_info_from_caps(&info, caps))
return false;
format = GST_VIDEO_INFO_FORMAT(&info);
size.setWidth(GST_VIDEO_INFO_WIDTH(&info));
size.setHeight(GST_VIDEO_INFO_HEIGHT(&info));
pixelAspectRatioNumerator = GST_VIDEO_INFO_PAR_N(&info);
pixelAspectRatioDenominator = GST_VIDEO_INFO_PAR_D(&info);
stride = GST_VIDEO_INFO_PLANE_STRIDE(&info, 0);
#else
gint width, height;
if (!GST_IS_CAPS(caps) || !gst_caps_is_fixed(caps)
|| !gst_video_format_parse_caps(caps, &format, &width, &height)
|| !gst_video_parse_caps_pixel_aspect_ratio(caps, &pixelAspectRatioNumerator,
&pixelAspectRatioDenominator))
return false;
size.setWidth(width);
size.setHeight(height);
stride = size.width() * 4;
#endif
return true;
}
示例2: getVideoSizeAndFormatFromCaps
bool getVideoSizeAndFormatFromCaps(GstCaps* caps, WebCore::IntSize& size, GstVideoFormat& format, int& pixelAspectRatioNumerator, int& pixelAspectRatioDenominator, int& stride)
{
GstVideoInfo info;
if (!gst_caps_is_fixed(caps) || !gst_video_info_from_caps(&info, caps))
return false;
format = GST_VIDEO_INFO_FORMAT(&info);
size.setWidth(GST_VIDEO_INFO_WIDTH(&info));
size.setHeight(GST_VIDEO_INFO_HEIGHT(&info));
pixelAspectRatioNumerator = GST_VIDEO_INFO_PAR_N(&info);
pixelAspectRatioDenominator = GST_VIDEO_INFO_PAR_D(&info);
stride = GST_VIDEO_INFO_PLANE_STRIDE(&info, 0);
return true;
}
示例3: paint
void MoviePluginView::paint(GraphicsContext* pGraphicContext, const IntRect& viewRect)
{
EA::WebKit::View* const pView = EA::WebKit::GetView(GetPluginViewParentFrame());
ASSERT(pView);
WebCore::FrameView* const pFrameView = pView->GetFrameView();
ASSERT(pFrameView);
if((!getMovieSurface()) || (!pView) || (!pFrameView))
return;
// Build the source and target rects with scroll offset
EA::Raster::ISurface* pTargetSurface = pGraphicContext->platformContext();
WebCore::IntSize scrollOffset = pFrameView->scrollOffset();
EA::Raster::Rect targetRect(frameGeometry().x() - scrollOffset.width(),frameGeometry().y() - scrollOffset.height(), frameGeometry().width(), frameGeometry().height());
EA::Raster::Rect clipRect(viewRect.x(),viewRect.y(),viewRect.height(),viewRect.width());
targetRect.constrainRect(clipRect);
// Draw to the view surface
EA::WebKit::GetEARasterInstance()->Blit(getMovieSurface(), &getMovieRect(), pTargetSurface, &targetRect, NULL);
}
示例4: syncCanvas
void LayerTreeRenderer::syncCanvas(WebLayerID id, const WebCore::IntSize& canvasSize, const GraphicsSurfaceToken& token, uint32_t frontBuffer)
{
if (canvasSize.isEmpty() || !m_textureMapper)
return;
ensureLayer(id);
GraphicsLayer* layer = layerByID(id);
RefPtr<TextureMapperSurfaceBackingStore> canvasBackingStore;
SurfaceBackingStoreMap::iterator it = m_surfaceBackingStores.find(id);
if (it == m_surfaceBackingStores.end()) {
canvasBackingStore = TextureMapperSurfaceBackingStore::create();
m_surfaceBackingStores.set(id, canvasBackingStore);
} else
canvasBackingStore = it->value;
canvasBackingStore->setGraphicsSurface(token, canvasSize, frontBuffer);
layer->setContentsToMedia(canvasBackingStore.get());
}
示例5: syncCanvas
void LayerTreeRenderer::syncCanvas(WebLayerID id, const WebCore::IntSize& canvasSize, uint32_t graphicsSurfaceToken)
{
if (canvasSize.isEmpty() || !m_textureMapper)
return;
#if USE(GRAPHICS_SURFACE)
ensureLayer(id);
GraphicsLayer* layer = layerByID(id);
RefPtr<TextureMapperSurfaceBackingStore> canvasBackingStore;
SurfaceBackingStoreMap::iterator it = m_surfaceBackingStores.find(id);
if (it == m_surfaceBackingStores.end()) {
canvasBackingStore = TextureMapperSurfaceBackingStore::create();
m_surfaceBackingStores.set(id, canvasBackingStore);
} else
canvasBackingStore = it->second;
canvasBackingStore->setGraphicsSurface(graphicsSurfaceToken, canvasSize);
layer->setContentsToMedia(canvasBackingStore.get());
#endif
}
示例6: OnPaint
void wxWebView::OnPaint(wxPaintEvent& event)
{
if (m_beingDestroyed || !m_mainFrame)
return;
WebCore::Frame* frame = m_mainFrame->GetFrame();
if (!frame || !frame->view())
return;
wxAutoBufferedPaintDC dc(this);
if (IsShown() && frame->document()) {
#if USE(WXGC)
wxGCDC gcdc(dc);
#endif
if (dc.IsOk()) {
wxRect paintRect = GetUpdateRegion().GetBox();
WebCore::IntSize offset = frame->view()->scrollOffset();
#if USE(WXGC)
gcdc.SetDeviceOrigin(-offset.width(), -offset.height());
#endif
dc.SetDeviceOrigin(-offset.width(), -offset.height());
paintRect.Offset(offset.width(), offset.height());
#if USE(WXGC)
WebCore::GraphicsContext* gc = new WebCore::GraphicsContext(&gcdc);
#else
WebCore::GraphicsContext* gc = new WebCore::GraphicsContext((wxWindowDC*)&dc);
#endif
if (gc && frame->contentRenderer()) {
if (frame->view()->needsLayout())
frame->view()->layout();
frame->view()->paintContents(gc, paintRect);
}
delete gc;
}
}
}
示例7: notify
bool MoviePluginView::notify(bool terminate)
{
bool responseFlag = false;
EA::WebKit::View* const pView = EA::WebKit::GetView(GetPluginViewParentFrame());
ASSERT(pView);
EA::WebKit::ViewNotification* const pVN = EA::WebKit::GetViewNotification();
ASSERT(pVN);
if((!pView) ||(!pVN))
return false;
// Get the windwo view rect with scroll offset
EA::Raster::Rect windowRect(0,0,frameGeometry().width(), frameGeometry().height());
WebCore::FrameView* const pFrameView = pView->GetFrameView();
ASSERT(pFrameView);
if(pFrameView)
{
WebCore::IntSize scrollOffset = pFrameView->scrollOffset();
windowRect.x = frameGeometry().x() - scrollOffset.width();
windowRect.y = frameGeometry().y() - scrollOffset.height();
}
// Call the notification
EA::WebKit::MovieUpdateInfo info ={
pView,
m_scrURI.charactersWithNullTermination(),
getMovieSurface(),
getMovieRect(),
windowRect,
m_triggerDelay,
terminate, // Terminate flag
m_removeSurfaceFlag,
isMovieLooping(),
isMoviePaused(),
isMovieAutoPlay(),
isMoviePreload()
};
responseFlag = pVN->MovieUpdate(info);
// Check if should remove the surface
if(info.mRemoveMovieSurfaceFlag)
{
if(getMovieSurface()) {
destroyMovieSurface();
m_removeSurfaceFlag = info.mRemoveMovieSurfaceFlag;
}
}
else if(responseFlag) {
// Trigger the paint by setting the dirty rect
WebCore::FrameView* const pFV = pView->GetFrameView();
ASSERT(pFV);
if(pFV) {
WebCore::IntSize scrollOffset = pFV->scrollOffset();
const WKAL::IntRect rect(frameGeometry().x() - scrollOffset.width(),frameGeometry().y() - scrollOffset.height(), frameGeometry().width(), frameGeometry().height());
if(pView->GetWebView()) {
pView->GetWebView()->addToDirtyRegion(rect);
pFV->SetDirty(true);
}
}
}
// Transfer/save time trigger
m_triggerDelay = info.mTriggerDelay;
return info.mTerminateCallbackFlag;
}
示例8: didChangeContentsSize
void PageClientLegacyImpl::didChangeContentsSize(const WebCore::IntSize& size)
{
#if USE(TILED_BACKING_STORE)
m_viewImpl->page()->drawingArea()->coordinatedLayerTreeHostProxy()->setContentsSize(FloatSize(size.width(), size.height()));
m_viewImpl->update();
#endif
m_viewImpl->smartCallback<ContentsSizeChanged>().call(size);
}
示例9: adoptRef
static inline PassRefPtr<cairo_surface_t> createSurfaceFromData(void* data, const WebCore::IntSize& size)
{
const int stride = cairo_format_stride_for_width(cairoFormat, size.width());
return adoptRef(cairo_image_surface_create_for_data(static_cast<unsigned char*>(data), cairoFormat, size.width(), size.height(), stride));
}
示例10: numBytesForSize
size_t ShareableBitmap::numBytesForSize(const WebCore::IntSize& size)
{
return cairo_format_stride_for_width(cairoFormat, size.width()) * size.height();
}
示例11: JumpToNearestElement
//.........这里部分代码省略.........
mCentreY = lastY + scrollOffset.y();
DocumentNavigator navigator(mView, document, direction, WebCore::IntPoint(mCentreX, mCentreY), mBestNodeX, mBestNodeY, mBestNodeWidth, mBestNodeHeight, mJumpNavigationParams.mNavigationTheta, mJumpNavigationParams.mStrictAxesCheck, currentRadialDistance);
navigator.FindBestNode(document);
if(navigator.GetBestNode())
{
currentBestNode = navigator.GetBestNode();
currentRadialDistance = navigator.GetBestNodeRadialDistance();
}
}
pFrame = pFrame->tree()->traverseNext();
}
bool foundSomething = false;
if (currentBestNode) //We found the node to navigate. Move the cursor and we are done.
{
foundSomething = true;
MoveMouseCursorToNode(currentBestNode, false);
}
else if(scrollIfElementNotFound)// Node is not found.
{
// Based on the intended direction of movement, scroll so that some newer elements are visible.
int cursorPosBeforeScrollX, cursorPosBeforeScrollY;
mView->GetCursorPosition(cursorPosBeforeScrollX, cursorPosBeforeScrollY);
switch(direction)
{
case EA::WebKit::JumpDown:
{
ScrollOnJump(true, -120, mJumpNavigationParams.mNumLinesToAutoScroll);
break;
}
case EA::WebKit::JumpUp:
{
ScrollOnJump(true, 120, mJumpNavigationParams.mNumLinesToAutoScroll);
break;
}
case EA::WebKit::JumpRight:
{
ScrollOnJump(false, -120, mJumpNavigationParams.mNumLinesToAutoScroll);
break;
}
case EA::WebKit::JumpLeft:
{
ScrollOnJump(false, 120, mJumpNavigationParams.mNumLinesToAutoScroll);
break;
}
default:
{
EAW_ASSERT_MSG(false, "Should not reach here\n");
}
}
// We move the mouse cursor back to the location where the last best node was found. This is so that we don't end up with the cursor being in no man's land. While that may work
// for ordinary sites, it may not work well with customized pages that leverage CSS to visually indicate current position rather than a cursor graphic.
// We don't call MoveMouseCursorToNode() with last cached node as there are edge cases where we may be holding an invalid node. Using a cached frame and checking against the
// current valid frames safeguards against that.
WebCore::IntSize scrollOffset;
WebCore::Frame* pFrame1 = mView->GetFrame();
while(pFrame1)
{
if(pFrame1 == mBestNodeFrame)//Find the frame where last best node existed.
{
if(pFrame1->view())
{
scrollOffset = pFrame1->view()->scrollOffset();//We read scroll offset here as it could have changed in the switch statement above.
break;
}
}
pFrame1 = pFrame1->tree()->traverseNext();
}
int targetcursorPosAfterScrollX, targetcursorPosAfterScrollY;
targetcursorPosAfterScrollX = mBestNodeX + mBestNodeWidth / 2 - scrollOffset.width();
targetcursorPosAfterScrollY = mBestNodeY + mBestNodeHeight/ 2 - scrollOffset.height();
EA::WebKit::MouseMoveEvent moveEvent;
memset( &moveEvent, 0, sizeof(moveEvent) );
const int cursorInset = 5;// Make cursor stay inside 5 pixels from boundaries. No known issues but added this as a safety measure so that we do not lose cursor ever.
int width = mView->GetSize().mWidth;
int height = mView->GetSize().mHeight;
moveEvent.mX = Clamp( cursorInset, targetcursorPosAfterScrollX, width - cursorInset );
moveEvent.mY = Clamp( cursorInset, targetcursorPosAfterScrollY, height - cursorInset );
mView->OnMouseMoveEvent(moveEvent);
// We intentionally don't call JumpToNearestElement(direction, false) here to avoid recursion. We do it in the overloaded function above.
}
return foundSomething;
}
示例12: DBG
static inline void _ewk_view_single_scroll_process_single(Ewk_View_Smart_Data* smartData, void* pixels, Evas_Coord width, Evas_Coord height, const WebCore::IntSize& scrollOffset, const WebCore::IntRect& rectToScroll)
{
int scrollX = rectToScroll.x();
int scrollY = rectToScroll.y();
int scrollWidth = rectToScroll.width();
int scrollHeight = rectToScroll.height();
DBG("%d,%d + %d,%d %+03d,%+03d, store: %p %dx%d",
scrollX, scrollY, scrollWidth, scrollHeight, scrollOffset.width(), scrollOffset.height(), pixels, width, height);
if (abs(scrollOffset.width()) >= scrollWidth || abs(scrollOffset.height()) >= scrollHeight) {
ewk_view_repaint_add(smartData->_priv, scrollX, scrollY, scrollWidth, scrollHeight);
return;
}
if (scrollX < 0) {
scrollWidth += scrollX;
scrollX = 0;
}
if (scrollY < 0) {
scrollHeight += scrollY;
scrollY = 0;
}
if (scrollX + scrollWidth > width)
scrollWidth = width - scrollX;
if (scrollY + scrollHeight > height)
scrollHeight = height - scrollY;
if (scrollWidth <= 0 || scrollHeight <= 0)
return;
int sourceX = scrollOffset.width() < 0 ? abs(scrollOffset.width()) : 0;
int sourceY = scrollOffset.height() < 0 ? abs(scrollOffset.height()) : 0;
int destinationX = scrollOffset.width() < 0 ? 0 : scrollOffset.width();
int destinationY = scrollOffset.height() < 0 ? 0 : scrollOffset.height();
int copyWidth = scrollWidth - abs(scrollOffset.width());
int copyHeight = scrollHeight - abs(scrollOffset.height());
if (scrollOffset.width() || scrollOffset.height()) {
_ewk_view_screen_move(static_cast<uint32_t*>(pixels), destinationX, destinationY, sourceX, sourceY, copyWidth, copyHeight, width);
evas_object_image_data_update_add(smartData->backing_store, destinationX, destinationY, copyWidth, copyHeight);
}
Eina_Rectangle verticalUpdate;
verticalUpdate.x = destinationX ? 0 : copyWidth - 1;
verticalUpdate.y = 0;
verticalUpdate.w = abs(scrollOffset.width());
verticalUpdate.h = scrollHeight;
if (verticalUpdate.w && verticalUpdate.h)
ewk_view_repaint_add(smartData->_priv, verticalUpdate.x, verticalUpdate.y, verticalUpdate.w, verticalUpdate.h);
Eina_Rectangle horizontalUpdate;
horizontalUpdate.x = destinationX;
horizontalUpdate.y = destinationY ? 0 : copyHeight - 1;
horizontalUpdate.w = copyWidth;
horizontalUpdate.h = abs(scrollOffset.height());
if (horizontalUpdate.w && horizontalUpdate.h)
ewk_view_repaint_add(smartData->_priv, horizontalUpdate.x, horizontalUpdate.y, horizontalUpdate.w, horizontalUpdate.h);
}
示例13: didChangeContentsSize
void EflViewportHandler::didChangeContentsSize(const WebCore::IntSize& size)
{
m_contentsSize = size;
setVisibleContentsRect(m_visibleContentRect.location(), m_scaleFactor, FloatPoint());
drawingArea()->layerTreeCoordinatorProxy()->setContentsSize(WebCore::FloatSize(size.width(), size.height()));
}