本文整理汇总了C++中destRect函数的典型用法代码示例。如果您正苦于以下问题:C++ destRect函数的具体用法?C++ destRect怎么用?C++ destRect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了destRect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DCHECK
void CanvasGdiplus::RestoreLayer()
{
DCHECK(layers_.size());
CanvasLayer* layer = layers_.top();
layers_.pop();
DCHECK(layer);
Gdiplus::Graphics* current = GetCurrentGraphics();
Gdiplus::Bitmap* native_bitmap =
layer->mem_bitmap.GetNativeBitmap();
Gdiplus::ImageAttributes ia;
Gdiplus::ColorMatrix cm =
{
1.0, 0.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 0.0, (static_cast<float>(layer->alpha))/255, 0.0,
0.0, 0.0, 0.0, 0.0, 1.0
};
ia.SetColorMatrix(&cm);
Gdiplus::Rect destRect(layer->bounds.x(), layer->bounds.y(),
layer->bounds.width(), layer->bounds.height());
current->DrawImage(native_bitmap, destRect,
layer->bounds.x(), layer->bounds.y(),
layer->bounds.width(), layer->bounds.height(),
Gdiplus::UnitPixel, &ia);
delete layer;
}
示例2: drawRect
void Surface::transBlitFrom(const Graphics::Surface &src, const Common::Point &pt,
bool flipped, int overrideColor) {
Common::Rect drawRect(0, 0, src.w, src.h);
Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h);
// Clip the display area to on-screen
if (!clip(drawRect, destRect))
// It's completely off-screen
return;
if (flipped)
drawRect = Common::Rect(src.w - drawRect.right, src.h - drawRect.bottom,
src.w - drawRect.left, src.h - drawRect.top);
Common::Point destPt(destRect.left, destRect.top);
addDirtyRect(Common::Rect(destPt.x, destPt.y, destPt.x + drawRect.width(),
destPt.y + drawRect.height()));
// Draw loop
const int TRANSPARENCY = 0xFF;
for (int yp = 0; yp < drawRect.height(); ++yp) {
const byte *srcP = (const byte *)src.getBasePtr(
flipped ? drawRect.right - 1 : drawRect.left, drawRect.top + yp);
byte *destP = (byte *)getBasePtr(destPt.x, destPt.y + yp);
for (int xp = 0; xp < drawRect.width(); ++xp, ++destP) {
if (*srcP != TRANSPARENCY)
*destP = overrideColor ? overrideColor : *srcP;
srcP = flipped ? srcP - 1 : srcP + 1;
}
}
}
示例3: destRect
void Scalpel3DOScreen::SHblitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds) {
if (!_vm->_isScreenDoubled) {
ScalpelScreen::SHblitFrom(src, pt, srcBounds);
return;
}
Common::Rect srcRect = srcBounds;
Common::Rect destRect(pt.x, pt.y, pt.x + srcRect.width(), pt.y + srcRect.height());
if (!srcRect.isValidRect() || !clip(srcRect, destRect))
return;
// Add dirty area remapped to the 640x200 surface
addDirtyRect(Common::Rect(destRect.left * 2, destRect.top * 2, destRect.right * 2, destRect.bottom * 2));
// Transfer the area, doubling each pixel
for (int yp = 0; yp < srcRect.height(); ++yp) {
const uint16 *srcP = (const uint16 *)src.getBasePtr(srcRect.left, srcRect.top + yp);
uint16 *destP = (uint16 *)getBasePtr(destRect.left * 2, (destRect.top + yp) * 2);
for (int xp = srcRect.left; xp < srcRect.right; ++xp, ++srcP, destP += 2) {
*destP = *srcP;
*(destP + 1) = *srcP;
*(destP + 640) = *srcP;
*(destP + 640 + 1) = *srcP;
}
}
}
示例4: destRect
void Text::display() {
auto tp = _position;
auto font = _batcher->getFont();
auto fontHeight = font->getFontHeight();
auto start = font->getFontStart();
auto length = font->getFontLength();
auto glyphs = font->getFontGlyphs();
if(!_used) {
_index = _batcher->addString();
}
for(int i = 0; _text[i] != 0; i++) {
char c = _text[i];
if(_text[i] == '\n') {
tp.y += fontHeight * _scaling.y;
tp.x = _position.x;
} else {
// Check for correct glyph
auto gi = c - start;
if(gi < 0 || gi >= length)
gi = length;
glm::vec4 destRect(tp, glyphs[gi].size * _scaling);
//Add the character to the font batcher
_batcher->add(destRect, glyphs[gi].uvRect, _depth, _tint, _index);
tp.x += glyphs[gi].size.x * _scaling.x;
}
}
}
示例5: uvRect
void BrickParticle::draw(Bengine::SpriteBatch & spriteBatch)
{
static int textureID = Bengine::ResourceManager::getTexture("Textures/brick.png").id;
const glm::vec4 uvRect(0.0f, 0.0f, 1.0f, 1.0f);
glm::vec4 destRect(m_position.x, m_position.y, m_width, m_height);
spriteBatch.draw(destRect, uvRect, textureID, 0.0f, Bengine::ColorRGBA8(2, 29, 39, 255));
}
示例6: check
void FOculusRiftHMD::RenderTexture_RenderThread(class FRHICommandListImmediate& RHICmdList, class FRHITexture2D* BackBuffer, class FRHITexture2D* SrcTexture) const
{
check(IsInRenderingThread());
check(pCustomPresent);
auto RenderContext = pCustomPresent->GetRenderContext();
if (RenderContext && RenderContext->GetFrameSettings()->Flags.bMirrorToWindow)
{
if (RenderContext->GetFrameSettings()->MirrorWindowMode == FSettings::eMirrorWindow_Distorted)
{
FTexture2DRHIRef MirrorTexture = pCustomPresent->GetMirrorTexture();
if (MirrorTexture)
{
CopyTexture_RenderThread(RHICmdList, BackBuffer, MirrorTexture);
}
}
else if (RenderContext->GetFrameSettings()->MirrorWindowMode == FSettings::eMirrorWindow_Undistorted)
{
auto FrameSettings = RenderContext->GetFrameSettings();
FIntRect destRect(0, 0, BackBuffer->GetSizeX() / 2, BackBuffer->GetSizeY());
for (int i = 0; i < 2; ++i)
{
CopyTexture_RenderThread(RHICmdList, BackBuffer, SrcTexture, destRect, FrameSettings->EyeRenderViewport[i]);
destRect.Min.X += BackBuffer->GetSizeX() / 2;
destRect.Max.X += BackBuffer->GetSizeX() / 2;
}
}
else if (RenderContext->GetFrameSettings()->MirrorWindowMode == FSettings::eMirrorWindow_SingleEye)
{
auto FrameSettings = RenderContext->GetFrameSettings();
CopyTexture_RenderThread(RHICmdList, BackBuffer, SrcTexture, FIntRect(), FrameSettings->EyeRenderViewport[0]);
}
}
}
示例7: srcRect
bool
TOSMagnify::CreateImage(BPoint mouseLoc, bool force)
{
bool created = false;
if (Window() && Window()->Lock()) {
int32 width, height;
fParent->PixelCount(&width, &height);
int32 pixelSize = fParent->PixelSize();
BRect srcRect(0, 0, width - 1, height - 1);
srcRect.OffsetBy(mouseLoc.x - (width / 2),
mouseLoc.y - (height / 2));
if (force || CopyScreenRect(srcRect)) {
srcRect.OffsetTo(BPoint(0, 0));
BRect destRect(Bounds());
DrawBitmap(fBitmap, srcRect, destRect);
DrawGrid(width, height, destRect, pixelSize);
DrawSelection();
Sync();
created = true;
}
Window()->Unlock();
} else
printf("window problem\n");
return created;
}
示例8: srcRect
void Scalpel3DOScreen::rawBlitFrom(const Graphics::Surface &src, const Common::Point &pt) {
Common::Rect srcRect(0, 0, src.w, src.h);
Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h);
addDirtyRect(destRect);
copyRectToSurface(src, destRect.left, destRect.top, srcRect);
}
示例9: measure
void SpriteFont::draw(SpriteBatch& batch, const char* s, glm::vec2 position, glm::vec2 scaling,
float depth, ColorRGBA8 tint, Justification just /* = Justification::LEFT */) {
glm::vec2 tp = position;
// Apply justification
if (just == Justification::MIDDLE) {
tp.x -= measure(s).x * scaling.x / 2;
} else if (just == Justification::RIGHT) {
tp.x -= measure(s).x * scaling.x;
}
for (int si = 0; s[si] != 0; si++) {
char c = s[si];
if (s[si] == '\n') {
tp.y += _fontHeight * scaling.y;
tp.x = position.x;
} else {
// Check for correct glyph
int gi = c - _regStart;
if (gi < 0 || gi >= _regLength)
gi = _regLength;
glm::vec4 destRect(tp, _glyphs[gi].size * scaling);
batch.draw(destRect, _glyphs[gi].uvRect, _texID, depth, tint);
tp.x += _glyphs[gi].size.x * scaling.x;
}
}
}
示例10: createSurfaceFromData
void ShareableBitmap::paint(GraphicsContext& context, float scaleFactor, const IntPoint& dstPoint, const IntRect& srcRect)
{
RefPtr<cairo_surface_t> surface = createSurfaceFromData(data(), m_size);
FloatRect destRect(dstPoint, srcRect.size());
FloatRect srcRectScaled(srcRect);
srcRectScaled.scale(scaleFactor);
context.platformContext()->drawSurfaceToContext(surface.get(), destRect, srcRectScaled, context);
}
示例11: destRect
void Agent::draw(GameEngine::SpriteBatch& spriteBatch){
glm::vec4 destRect(m_position.x, m_position.y, AGENT_WIDTH, AGENT_WIDTH);
const glm::vec4 uvRect(0.0f, 0.0f, 1.0f, 1.0f);
spriteBatch.draw(destRect, uvRect, m_textureID, 0.0f, m_color, m_direction);
}
示例12: srcRect
void BaseSurface::SHtransBlitFrom(const Graphics::Surface &src, const Common::Point &pt,
bool flipped, int overrideColor, int scaleVal) {
Common::Rect srcRect(0, 0, src.w, src.h);
Common::Rect destRect(pt.x, pt.y, pt.x + src.w * SCALE_THRESHOLD / scaleVal,
pt.y + src.h * SCALE_THRESHOLD / scaleVal);
Graphics::Screen::transBlitFrom(src, srcRect, destRect, TRANSPARENCY,
flipped, overrideColor);
}
示例13: tileAt
void TiledLayerChromium::updateCompositorResources(GraphicsContext3D* context)
{
// Painting could cause compositing to get turned off, which may cause the tiler to become invalidated mid-update.
if (m_skipsDraw || m_updateRect.isEmpty() || !m_tiler->numTiles())
return;
int left, top, right, bottom;
m_tiler->contentRectToTileIndices(m_updateRect, left, top, right, bottom);
for (int j = top; j <= bottom; ++j) {
for (int i = left; i <= right; ++i) {
UpdatableTile* tile = tileAt(i, j);
if (!tile)
tile = createTile(i, j);
else if (!tile->dirty())
continue;
// Calculate page-space rectangle to copy from.
IntRect sourceRect = m_tiler->tileContentRect(tile);
const IntPoint anchor = sourceRect.location();
sourceRect.intersect(m_tiler->layerRectToContentRect(tile->m_dirtyLayerRect));
// Paint rect not guaranteed to line up on tile boundaries, so
// make sure that sourceRect doesn't extend outside of it.
sourceRect.intersect(m_paintRect);
if (sourceRect.isEmpty())
continue;
ASSERT(tile->texture()->isReserved());
// Calculate tile-space rectangle to upload into.
IntRect destRect(IntPoint(sourceRect.x() - anchor.x(), sourceRect.y() - anchor.y()), sourceRect.size());
if (destRect.x() < 0)
CRASH();
if (destRect.y() < 0)
CRASH();
// Offset from paint rectangle to this tile's dirty rectangle.
IntPoint paintOffset(sourceRect.x() - m_paintRect.x(), sourceRect.y() - m_paintRect.y());
if (paintOffset.x() < 0)
CRASH();
if (paintOffset.y() < 0)
CRASH();
if (paintOffset.x() + destRect.width() > m_paintRect.width())
CRASH();
if (paintOffset.y() + destRect.height() > m_paintRect.height())
CRASH();
tile->texture()->bindTexture(context);
const GC3Dint filter = m_tiler->hasBorderTexels() ? GraphicsContext3D::LINEAR : GraphicsContext3D::NEAREST;
GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, filter));
GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, filter));
GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0));
textureUpdater()->updateTextureRect(context, tile->texture(), sourceRect, destRect);
tile->clearDirty();
}
}
}
示例14: adoptRef
void ShareableBitmap::paint(GraphicsContext& context, const IntPoint& dstPoint, const IntRect& srcRect)
{
RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create_for_data(static_cast<unsigned char*>(data()),
CAIRO_FORMAT_ARGB32,
m_size.width(), m_size.height(),
m_size.width() * 4));
FloatRect destRect(dstPoint, srcRect.size());
context.platformContext()->drawSurfaceToContext(surface.get(), destRect, srcRect, &context);
}
示例15: drawRect
void Surface::transBlitFromUnscaled(const Graphics::Surface &src, const Common::Point &pt,
bool flipped, int overrideColor) {
Common::Rect drawRect(0, 0, src.w, src.h);
Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h);
// Clip the display area to on-screen
if (!clip(drawRect, destRect))
// It's completely off-screen
return;
if (flipped)
drawRect = Common::Rect(src.w - drawRect.right, src.h - drawRect.bottom,
src.w - drawRect.left, src.h - drawRect.top);
Common::Point destPt(destRect.left, destRect.top);
addDirtyRect(Common::Rect(destPt.x, destPt.y, destPt.x + drawRect.width(),
destPt.y + drawRect.height()));
switch (src.format.bytesPerPixel) {
case 1:
// 8-bit palettized: Draw loop
assert(_surface.format.bytesPerPixel == 1); // Security check
for (int yp = 0; yp < drawRect.height(); ++yp) {
const byte *srcP = (const byte *)src.getBasePtr(
flipped ? drawRect.right - 1 : drawRect.left, drawRect.top + yp);
byte *destP = (byte *)getBasePtr(destPt.x, destPt.y + yp);
for (int xp = 0; xp < drawRect.width(); ++xp, ++destP) {
if (*srcP != TRANSPARENCY)
*destP = overrideColor ? overrideColor : *srcP;
srcP = flipped ? srcP - 1 : srcP + 1;
}
}
break;
case 2:
// 3DO 15-bit RGB565: Draw loop
assert(_surface.format.bytesPerPixel == 2); // Security check
for (int yp = 0; yp < drawRect.height(); ++yp) {
const uint16 *srcP = (const uint16 *)src.getBasePtr(
flipped ? drawRect.right - 1 : drawRect.left, drawRect.top + yp);
uint16 *destP = (uint16 *)getBasePtr(destPt.x, destPt.y + yp);
for (int xp = 0; xp < drawRect.width(); ++xp, ++destP) {
if (*srcP) // RGB 0, 0, 0 -> transparent on 3DO
*destP = *srcP; // overrideColor ? overrideColor : *srcP;
srcP = flipped ? srcP - 1 : srcP + 1;
}
}
break;
default:
error("Surface: unsupported bytesperpixel");
break;
}
}