本文整理汇总了C++中FloatRect函数的典型用法代码示例。如果您正苦于以下问题:C++ FloatRect函数的具体用法?C++ FloatRect怎么用?C++ FloatRect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FloatRect函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: FloatRect
FloatRect FloatRect::narrowPrecision(double x, double y, double width, double height)
{
return FloatRect(narrowPrecisionToFloat(x), narrowPrecisionToFloat(y), narrowPrecisionToFloat(width), narrowPrecisionToFloat(height));
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:4,代码来源:FloatRect.cpp
示例2: rebuildBaseVert
void rebuildBaseVert()
{
if (geo.w == 0 || geo.h == 0)
{
base.vert.clear();
base.vert.commit();
return;
}
const IntRect bgPos(2, 2, geo.w-4, geo.h-4);
size_t count = 0;
/* Stretched layer (1) */
count += 1;
/* Tiled layer (2) */
base.bgTileQuads = TileQuads::twoDimCount(bgTileSrc.w, bgTileSrc.h, bgPos.w, bgPos.h);
count += base.bgTileQuads;
const Vec2 corOff(geo.w - 16, geo.h - 16);
const Corners<FloatRect> cornerPos =
{
FloatRect( 0, 0, 16, 16 ), /* Top left */
FloatRect( corOff.x, 0, 16, 16 ), /* Top right */
FloatRect( 0, corOff.y, 16, 16 ), /* Bottom left */
FloatRect( corOff.x, corOff.y, 16, 16 ) /* Bottom right */
};
const Vec2i sideLen(geo.w - 16*2, geo.h - 16*2);
bool drawSidesLR = sideLen.x > 0;
bool drawSidesTB = sideLen.y > 0;
base.borderQuads = 0;
base.borderQuads += 4; /* 4 corners */
if (drawSidesLR)
base.borderQuads += TileQuads::oneDimCount(32, sideLen.y) * 2;
if (drawSidesTB)
base.borderQuads += TileQuads::oneDimCount(32, sideLen.x) * 2;
count += base.borderQuads;
base.vert.resize(count);
Vertex *vert = dataPtr(base.vert.vertices);
size_t i = 0;
/* Stretched background */
i += Quad::setTexPosRect(&vert[i*4], bgStretchSrc, bgPos);
/* Tiled background */
i += TileQuads::build(bgTileSrc, bgPos, &vert[i*4]);
/* Corners */
i += Quad::setTexPosRect(&vert[i*4], cornerSrc.tl, cornerPos.tl);
i += Quad::setTexPosRect(&vert[i*4], cornerSrc.tr, cornerPos.tr);
i += Quad::setTexPosRect(&vert[i*4], cornerSrc.bl, cornerPos.bl);
i += Quad::setTexPosRect(&vert[i*4], cornerSrc.br, cornerPos.br);
/* Sides */
if (drawSidesLR)
{
i += TileQuads::buildV(borderSrc.l, sideLen.y, 0, 16, &vert[i*4]);
i += TileQuads::buildV(borderSrc.r, sideLen.y, corOff.x, 16, &vert[i*4]);
}
if (drawSidesTB)
{
i += TileQuads::buildH(borderSrc.t, sideLen.x, 16, 0, &vert[i*4]);
i += TileQuads::buildH(borderSrc.b, sideLen.x, 16, corOff.y, &vert[i*4]);
}
base.vert.commit();
}
开发者ID:Alex223124,项目名称:mkxp,代码行数:78,代码来源:windowvx.cpp
示例3: absoluteQuads
void RenderLineBreak::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const
{
if (!m_inlineBoxWrapper)
return;
quads.append(localToAbsoluteQuad(FloatRect(m_inlineBoxWrapper->topLeft(), m_inlineBoxWrapper->size()), 0 /* mode */, wasFixed));
}
开发者ID:kodybrown,项目名称:webkit,代码行数:6,代码来源:RenderLineBreak.cpp
示例4: fillWithSolidColor
void Image::drawTiled(GraphicsContext& ctxt, const FloatRect& destRect, const FloatPoint& srcPoint, const FloatSize& scaledTileSize, const FloatSize& spacing, CompositeOperator op, BlendMode blendMode)
{
if (mayFillWithSolidColor()) {
fillWithSolidColor(ctxt, destRect, solidColor(), op);
return;
}
ASSERT(!isBitmapImage() || notSolidColor());
#if PLATFORM(IOS)
FloatSize intrinsicTileSize = originalSize();
#else
FloatSize intrinsicTileSize = size();
#endif
if (hasRelativeWidth())
intrinsicTileSize.setWidth(scaledTileSize.width());
if (hasRelativeHeight())
intrinsicTileSize.setHeight(scaledTileSize.height());
FloatSize scale(scaledTileSize.width() / intrinsicTileSize.width(),
scaledTileSize.height() / intrinsicTileSize.height());
FloatRect oneTileRect;
FloatSize actualTileSize(scaledTileSize.width() + spacing.width(), scaledTileSize.height() + spacing.height());
oneTileRect.setX(destRect.x() + fmodf(fmodf(-srcPoint.x(), actualTileSize.width()) - actualTileSize.width(), actualTileSize.width()));
oneTileRect.setY(destRect.y() + fmodf(fmodf(-srcPoint.y(), actualTileSize.height()) - actualTileSize.height(), actualTileSize.height()));
oneTileRect.setSize(scaledTileSize);
// Check and see if a single draw of the image can cover the entire area we are supposed to tile.
if (oneTileRect.contains(destRect) && !ctxt.drawLuminanceMask()) {
FloatRect visibleSrcRect;
visibleSrcRect.setX((destRect.x() - oneTileRect.x()) / scale.width());
visibleSrcRect.setY((destRect.y() - oneTileRect.y()) / scale.height());
visibleSrcRect.setWidth(destRect.width() / scale.width());
visibleSrcRect.setHeight(destRect.height() / scale.height());
draw(ctxt, destRect, visibleSrcRect, op, blendMode, ImageOrientationDescription());
return;
}
#if PLATFORM(IOS)
// When using accelerated drawing on iOS, it's faster to stretch an image than to tile it.
if (ctxt.isAcceleratedContext()) {
if (size().width() == 1 && intersection(oneTileRect, destRect).height() == destRect.height()) {
FloatRect visibleSrcRect;
visibleSrcRect.setX(0);
visibleSrcRect.setY((destRect.y() - oneTileRect.y()) / scale.height());
visibleSrcRect.setWidth(1);
visibleSrcRect.setHeight(destRect.height() / scale.height());
draw(ctxt, destRect, visibleSrcRect, op, BlendModeNormal, ImageOrientationDescription());
return;
}
if (size().height() == 1 && intersection(oneTileRect, destRect).width() == destRect.width()) {
FloatRect visibleSrcRect;
visibleSrcRect.setX((destRect.x() - oneTileRect.x()) / scale.width());
visibleSrcRect.setY(0);
visibleSrcRect.setWidth(destRect.width() / scale.width());
visibleSrcRect.setHeight(1);
draw(ctxt, destRect, visibleSrcRect, op, BlendModeNormal, ImageOrientationDescription());
return;
}
}
#endif
// Patterned images and gradients can use lots of memory for caching when the
// tile size is large (<rdar://problem/4691859>, <rdar://problem/6239505>).
// Memory consumption depends on the transformed tile size which can get
// larger than the original tile if user zooms in enough.
#if PLATFORM(IOS)
const float maxPatternTilePixels = 512 * 512;
#else
const float maxPatternTilePixels = 2048 * 2048;
#endif
FloatRect transformedTileSize = ctxt.getCTM().mapRect(FloatRect(FloatPoint(), scaledTileSize));
float transformedTileSizePixels = transformedTileSize.width() * transformedTileSize.height();
FloatRect currentTileRect = oneTileRect;
if (transformedTileSizePixels > maxPatternTilePixels) {
GraphicsContextStateSaver stateSaver(ctxt);
ctxt.clip(destRect);
currentTileRect.shiftYEdgeTo(destRect.y());
float toY = currentTileRect.y();
while (toY < destRect.maxY()) {
currentTileRect.shiftXEdgeTo(destRect.x());
float toX = currentTileRect.x();
while (toX < destRect.maxX()) {
FloatRect toRect(toX, toY, currentTileRect.width(), currentTileRect.height());
FloatRect fromRect(toFloatPoint(currentTileRect.location() - oneTileRect.location()), currentTileRect.size());
fromRect.scale(1 / scale.width(), 1 / scale.height());
draw(ctxt, toRect, fromRect, op, BlendModeNormal, ImageOrientationDescription());
toX += currentTileRect.width();
currentTileRect.shiftXEdgeTo(oneTileRect.x());
}
toY += currentTileRect.height();
currentTileRect.shiftYEdgeTo(oneTileRect.y());
}
return;
}
AffineTransform patternTransform = AffineTransform().scaleNonUniform(scale.width(), scale.height());
//.........这里部分代码省略.........
开发者ID:hnney,项目名称:webkit,代码行数:101,代码来源:Image.cpp
示例5: screenRect
FloatRect screenRect(Widget* widget)
{
return FloatRect(FloatPoint(), FloatSize(IntSize(BlackBerry::Platform::Graphics::Screen::primaryScreen()->size())));
}
开发者ID:dzhshf,项目名称:WebKit,代码行数:4,代码来源:PlatformScreenBlackBerry.cpp
示例6: setRect
void UIView::setRect(float left, float top, float width, float height)
{
setRect(FloatRect(left, top, width, height));
}
开发者ID:YurieCo,项目名称:Nephilim,代码行数:4,代码来源:UIView.cpp
示例7: m_view1
Game_Manager::Game_Manager(RenderWindow *app, View &view1, int screen_x, int screen_y)
: m_view1(view1)
, radio_icon(app, "resources/radioactive_icon.png", &view1)
, food_icon(app, "resources/food_icon0.png", &view1)
, metal_icon(app, "resources/iron_icon0.png", &view1)
, radio_bar(app, "resources/radio_bar.png", &view1)
, radio_bar_background(app, "resources/radio_bar_background.png", &view1)
, radio_bar_grad(app, "resources/radio_bar_grad.png", &view1)
, oxygen_bar(app, "resources/oxygen_bar.png", &view1)
, oxygen_bar_background(app, "resources/oxygen_bar_background.png", &view1)
, oxygen_bar_grad(app, "resources/oxygen_bar_grad.png", &view1)
, head_icon(app, "resources/head_icon.png", &view1)
, explosion(app, "resources/explosion.png", &view1)
, background(app, "resources/background.png", &view1)
, selection_border(app, "resources/selection_border.png", &view1)
, goal_border(app, "resources/selection_border.png", &view1)
, end_sprite(app, "resources/end.png", &view1)
, bomb(app, "resources/bomb.png", &view1)
, pause_sprite(app, "resources/pause.png", &view1)
, info_sprite(app, "resources/info.png", &view1)
, spriteTile0(app, "resources/invisible.png", &view1)
, tile_size(384)
{
//sounds
buffer.loadFromFile("resources/explosion.ogg");
sound.setBuffer(buffer);
buffer_combat.loadFromFile("resources/combat.ogg");
sound_combat.setBuffer(buffer_combat);
monster_time.restart();
//
zoom = 1;
zoom_rate = 10;
zoom_change = ZOOM_NO_CHANGE;
goal_border.add_color(255, 150, 50, 255);
citizen_max = 10;
monster_max = 10;
citizen_number = citizen_max;
food_number = 0;
metal_number = 0;
pause = false;
clicked = false;
glissor_on = false;
info = true;
cinematic_on = true;
m_x_offset = tile_size * 2 + (tile_size / 2);
m_y_offset = (tile_size / 2);
oxygen_number = 1.0f;
fail = false;
m_app = app;
m_app->setView(m_view1);
m_screen_y = 1080;
m_screen_x = 1920;
m_view2.reset(FloatRect(0.0f, 0.0f, static_cast<float>(m_screen_x), static_cast<float>(m_screen_y)));
m_view2.setViewport(FloatRect(0.0f, 0.0f, 1.0f, 1.0f));
//init map
for (size_t y = 0; y < 10; y++)
{
for (size_t x = 0; x < 5; x++)
{
my_map[y][x].setLevel(y);
my_map[y][x].init_resources(m_app, &view1, x, y);
if (y == 0)
{ //surface
my_map[y][x].setID(6 + x);
}
else if(x >= 2 && x <5 && y == 4)
{ //metro 3, 4, 5
my_map[y][x].setID(1 + x);
}
else if(x >= 1 && x <4 && y == 6)
{ //soutterrain
my_map[y][x].setID(10 + x);
}
else if(x >= 2 && x <5 && y == 2)
{ //egouts
my_map[y][x].setID(12 + x);
}
else if (x >= 1 && x <4 && y == 5)
{
//.........这里部分代码省略.........
开发者ID:martinusprime,项目名称:bacon-depth,代码行数:101,代码来源:Game_Manager.cpp
示例8: draw
void UIView::drawItself(GraphicsDevice* renderer, const mat4& transform )
{
// Invisible UIView, stop rendering itself or children
if(!m_visible)
{
return;
}
if(m_clipContents)
{
renderer->pushClippingRect(FloatRect(mRect.left,mRect.top,mRect.width, mRect.height));
}
mat4 absoluteTransform = mat4::identity;
mat4 localTransform = mat4::translate(position) * mat4::rotatey(rotation_y) * mat4::rotatex(rotation_x);
absoluteTransform = transform * localTransform;
// Tel
draw(renderer, absoluteTransform);
for(std::size_t i = 0; i < components.size(); ++i)
{
components[i]->onRender(renderer, this, absoluteTransform);
}
if(m_clipContents)
{
renderer->popClippingRect();
}
// -- Pre Render Step (Before Children)
preRender(renderer);
// clip the overflowing children
if(m_clipChildren)
{
if(getContext()->transformPointerCoordinates)
{
renderer->pushClippingRect(FloatRect(mRect.left / getContext()->targetWindowSize.x,mRect.top / getContext()->targetWindowSize.y,mRect.width / getContext()->targetWindowSize.x, mRect.height / getContext()->targetWindowSize.y), true);
}
else
{
renderer->pushClippingRect(FloatRect(mRect.left,mRect.top,mRect.width, mRect.height));
}
}
// Let children render as well
for(std::vector<UIView*>::const_iterator it = m_children.begin(); it != m_children.end(); it++)
{
(*it)->drawItself(renderer, absoluteTransform);
}
if(m_clipChildren)
renderer->popClippingRect();
// -- Post Render Step (After Children)
postRender(renderer);
}
开发者ID:YurieCo,项目名称:Nephilim,代码行数:61,代码来源:UIView.cpp
示例9: drawImageBuffer
void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const IntRect& dest, const IntRect& srcRect, CompositeOperator op, bool useLowQualityScale)
{
drawImageBuffer(image, styleColorSpace, FloatRect(dest), srcRect, op, useLowQualityScale);
}
开发者ID:Spencerx,项目名称:webkit,代码行数:4,代码来源:GraphicsContext.cpp
示例10: ASSERT
bool RenderSVGResourceFilter::applyResource(RenderObject* object, RenderStyle*, GraphicsContext*& context, unsigned short resourceMode)
{
ASSERT(object);
ASSERT(context);
#ifndef NDEBUG
ASSERT(resourceMode == ApplyToDefaultMode);
#else
UNUSED_PARAM(resourceMode);
#endif
// Returning false here, to avoid drawings onto the context. We just want to
// draw the stored filter output, not the unfiltered object as well.
if (m_filter.contains(object)) {
FilterData* filterData = m_filter.get(object);
if (filterData->builded)
return false;
delete m_filter.take(object); // Oops, have to rebuild, go through normal code path
}
OwnPtr<FilterData> filterData(new FilterData);
FloatRect targetBoundingBox = object->objectBoundingBox();
SVGFilterElement* filterElement = static_cast<SVGFilterElement*>(node());
filterData->boundaries = filterElement->filterBoundingBox(targetBoundingBox);
if (filterData->boundaries.isEmpty())
return false;
// Determine absolute transformation matrix for filter.
AffineTransform absoluteTransform;
SVGImageBufferTools::calculateTransformationToOutermostSVGCoordinateSystem(object, absoluteTransform);
if (!absoluteTransform.isInvertible())
return false;
// Eliminate shear of the absolute transformation matrix, to be able to produce unsheared tile images for feTile.
filterData->shearFreeAbsoluteTransform = AffineTransform(absoluteTransform.xScale(), 0, 0, absoluteTransform.yScale(), absoluteTransform.e(), absoluteTransform.f());
// Determine absolute boundaries of the filter and the drawing region.
FloatRect absoluteFilterBoundaries = filterData->shearFreeAbsoluteTransform.mapRect(filterData->boundaries);
FloatRect drawingRegion = object->strokeBoundingBox();
drawingRegion.intersect(filterData->boundaries);
FloatRect absoluteDrawingRegion = filterData->shearFreeAbsoluteTransform.mapRect(drawingRegion);
// Create the SVGFilter object.
bool primitiveBoundingBoxMode = filterElement->primitiveUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
filterData->filter = SVGFilter::create(filterData->shearFreeAbsoluteTransform, absoluteDrawingRegion, targetBoundingBox, filterData->boundaries, primitiveBoundingBoxMode);
// Create all relevant filter primitives.
filterData->builder = buildPrimitives(filterData->filter.get());
if (!filterData->builder)
return false;
// Calculate the scale factor for the use of filterRes.
// Also see http://www.w3.org/TR/SVG/filters.html#FilterEffectsRegion
FloatSize scale(1, 1);
if (filterElement->hasAttribute(SVGNames::filterResAttr)) {
scale.setWidth(filterElement->filterResX() / absoluteFilterBoundaries.width());
scale.setHeight(filterElement->filterResY() / absoluteFilterBoundaries.height());
}
if (scale.isEmpty())
return false;
// Determine scale factor for filter. The size of intermediate ImageBuffers shouldn't be bigger than kMaxFilterSize.
FloatRect tempSourceRect = absoluteDrawingRegion;
tempSourceRect.scale(scale.width(), scale.height());
fitsInMaximumImageSize(tempSourceRect.size(), scale);
// Set the scale level in SVGFilter.
filterData->filter->setFilterResolution(scale);
FilterEffect* lastEffect = filterData->builder->lastEffect();
if (!lastEffect)
return false;
RenderSVGResourceFilterPrimitive::determineFilterPrimitiveSubregion(lastEffect, filterData->filter.get());
FloatRect subRegion = lastEffect->maxEffectRect();
// At least one FilterEffect has a too big image size,
// recalculate the effect sizes with new scale factors.
if (!fitsInMaximumImageSize(subRegion.size(), scale)) {
filterData->filter->setFilterResolution(scale);
RenderSVGResourceFilterPrimitive::determineFilterPrimitiveSubregion(lastEffect, filterData->filter.get());
}
// If the drawingRegion is empty, we have something like <g filter=".."/>.
// Even if the target objectBoundingBox() is empty, we still have to draw the last effect result image in postApplyResource.
if (drawingRegion.isEmpty()) {
ASSERT(!m_filter.contains(object));
filterData->savedContext = context;
m_filter.set(object, filterData.leakPtr());
return false;
}
absoluteDrawingRegion.scale(scale.width(), scale.height());
OwnPtr<ImageBuffer> sourceGraphic;
if (!SVGImageBufferTools::createImageBuffer(absoluteDrawingRegion, absoluteDrawingRegion, sourceGraphic, ColorSpaceLinearRGB)) {
ASSERT(!m_filter.contains(object));
filterData->savedContext = context;
m_filter.set(object, filterData.leakPtr());
//.........这里部分代码省略.........
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:101,代码来源:RenderSVGResourceFilter.cpp
示例11: clip
void GraphicsContext::clip(const IntRect& rect)
{
clip(FloatRect(rect));
}
开发者ID:Spencerx,项目名称:webkit,代码行数:4,代码来源:GraphicsContext.cpp
示例12: FloatRect
TextStream& operator<<(TextStream& ts, const LayoutRect& rect)
{
return ts << FloatRect(rect);
}
开发者ID:dstockwell,项目名称:blink,代码行数:4,代码来源:TextStream.cpp
示例13: LayoutRect
LayoutRect RenderedPosition::absoluteRect(int* extraWidthToEndOfLine) const
{
if (isNull())
return LayoutRect();
LayoutRect localRect = m_renderer->localCaretRect(m_inlineBox, m_offset, extraWidthToEndOfLine);
return localRect == LayoutRect() ? LayoutRect() : m_renderer->localToAbsoluteQuad(FloatRect(localRect)).enclosingBoundingBox();
}
开发者ID:sysrqb,项目名称:chromium-src,代码行数:8,代码来源:RenderedPosition.cpp
示例14: absoluteRects
void RenderLineBreak::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const
{
if (!m_inlineBoxWrapper)
return;
rects.append(enclosingIntRect(FloatRect(accumulatedOffset + m_inlineBoxWrapper->topLeft(), m_inlineBoxWrapper->size())));
}
开发者ID:kodybrown,项目名称:webkit,代码行数:6,代码来源:RenderLineBreak.cpp
示例15: FloatRect
void RenderPath::setPath(const Path& newPath)
{
m_path = newPath;
m_strokeBbox = FloatRect();
m_fillBBox = FloatRect();
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:6,代码来源:RenderPath.cpp
示例16: document
FloatRect RenderPath::drawMarkersIfNeeded(GraphicsContext* context, const FloatRect& rect, const Path& path) const
{
Document* doc = document();
SVGElement* svgElement = static_cast<SVGElement*>(element());
ASSERT(svgElement && svgElement->document() && svgElement->isStyled());
SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(svgElement);
const SVGRenderStyle* svgStyle = style()->svgStyle();
AtomicString startMarkerId(SVGURIReference::getTarget(svgStyle->startMarker()));
AtomicString midMarkerId(SVGURIReference::getTarget(svgStyle->midMarker()));
AtomicString endMarkerId(SVGURIReference::getTarget(svgStyle->endMarker()));
SVGResourceMarker* startMarker = getMarkerById(doc, startMarkerId);
SVGResourceMarker* midMarker = getMarkerById(doc, midMarkerId);
SVGResourceMarker* endMarker = getMarkerById(doc, endMarkerId);
if (!startMarker && !startMarkerId.isEmpty())
svgElement->document()->accessSVGExtensions()->addPendingResource(startMarkerId, styledElement);
else if (startMarker)
startMarker->addClient(styledElement);
if (!midMarker && !midMarkerId.isEmpty())
svgElement->document()->accessSVGExtensions()->addPendingResource(midMarkerId, styledElement);
else if (midMarker)
midMarker->addClient(styledElement);
if (!endMarker && !endMarkerId.isEmpty())
svgElement->document()->accessSVGExtensions()->addPendingResource(endMarkerId, styledElement);
else if (endMarker)
endMarker->addClient(styledElement);
if (!startMarker && !midMarker && !endMarker)
return FloatRect();
double strokeWidth = KSVGPainterFactory::cssPrimitiveToLength(this, svgStyle->strokeWidth(), 1.0);
DrawMarkersData data(context, startMarker, midMarker, strokeWidth);
path.apply(&data, drawStartAndMidMarkers);
data.previousMarkerData.marker = endMarker;
data.previousMarkerData.type = End;
drawMarkerWithData(context, data.previousMarkerData);
// We know the marker boundaries, only after they're drawn!
// Otherwhise we'd need to do all the marker calculation twice
// once here (through paint()) and once in absoluteClippedOverflowRect().
FloatRect bounds;
if (startMarker)
bounds.unite(startMarker->cachedBounds());
if (midMarker)
bounds.unite(midMarker->cachedBounds());
if (endMarker)
bounds.unite(endMarker->cachedBounds());
return bounds;
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:61,代码来源:RenderPath.cpp
示例17: absoluteQuads
void RenderView::absoluteQuads(Vector<FloatQuad>& quads)
{
quads.append(FloatRect(0, 0, m_layer->width(), m_layer->height()));
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:4,代码来源:RenderView.cpp
示例18: drawImage
void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntRect& dest, const IntRect& srcRect, CompositeOperator op, RespectImageOrientationEnum shouldRespectImageOrientation, bool useLowQualityScale)
{
drawImage(image, styleColorSpace, FloatRect(dest), srcRect, op, shouldRespectImageOrientation, useLowQualityScale);
}
开发者ID:Spencerx,项目名称:webkit,代码行数:4,代码来源:GraphicsContext.cpp
示例19: rebuildCursorVert
void rebuildCursorVert()
{
const IntRect rect = cursorRect->toIntRect();
const CursorSrc &src = cursorSrc;
cursorVertArrayDirty = true;
if (rect.w <= 0 || rect.h <= 0)
{
cursorVert.clear();
return;
}
const Vec2 corOff(rect.w - 4, rect.h - 4);
const Corners<FloatRect> cornerPos =
{
FloatRect( 0, 0, 4, 4 ), /* Top left */
FloatRect( corOff.x, 0, 4, 4 ), /* Top right */
FloatRect( 0, corOff.y, 4, 4 ), /* Bottom left */
FloatRect( corOff.x, corOff.y, 4, 4 ) /* Bottom right */
};
const Vec2i sideLen(rect.w - 4*2, rect.h - 4*2);
const Sides<FloatRect> sidePos =
{
FloatRect( 0, 4, 4, sideLen.y ), /* Left */
FloatRect( corOff.x, 4, 4, sideLen.y ), /* Right */
FloatRect( 4, 0, sideLen.x, 4 ), /* Top */
FloatRect( 4, corOff.y, sideLen.x, 4 ) /* Bottom */
};
const FloatRect bgPos(4, 4, sideLen.x, sideLen.y);
bool drawSidesLR = rect.h > 8;
bool drawSidesTB = rect.w > 8;
bool drawBg = drawSidesLR && drawSidesTB;
size_t quads = 0;
quads += 4; /* 4 corners */
if (drawSidesLR)
quads += 2;
if (drawSidesTB)
quads += 2;
if (drawBg)
quads += 1;
cursorVert.resize(quads);
Vertex *vert = dataPtr(cursorVert.vertices);
size_t i = 0;
i += Quad::setTexPosRect(&vert[i*4], src.corners.tl, cornerPos.tl);
i += Quad::setTexPosRect(&vert[i*4], src.corners.tr, cornerPos.tr);
i += Quad::setTexPosRect(&vert[i*4], src.corners.bl, cornerPos.bl);
i += Quad::setTexPosRect(&vert[i*4], src.corners.br, cornerPos.br);
if (drawSidesLR)
{
i += Quad::setTexPosRect(&vert[i*4], src.border.l, sidePos.l);
i += Quad::setTexPosRect(&vert[i*4], src.border.r, sidePos.r);
}
if (drawSidesTB)
{
i += Quad::setTexPosRect(&vert[i*4], src.border.t, sidePos.t);
i += Quad::setTexPosRect(&vert[i*4], src.border.b, sidePos.b);
}
if (drawBg)
Quad::setTexPosRect(&vert[i*4], src.bg, bgPos);
}
开发者ID:Alex223124,项目名称:mkxp,代码行数:75,代码来源:windowvx.cpp
注:本文中的FloatRect函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论