本文整理汇总了C++中gfx::Matrix4x4::Scale方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4x4::Scale方法的具体用法?C++ Matrix4x4::Scale怎么用?C++ Matrix4x4::Scale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gfx::Matrix4x4
的用法示例。
在下文中一共展示了Matrix4x4::Scale方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: layerScale
void
TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
const nsIntRegion& aValidRegion,
EffectChain& aEffectChain,
float aOpacity,
const gfx::Point& aOffset,
const gfx::Filter& aFilter,
const gfx::Rect& aClipRect,
const nsIntRegion& aMaskRegion,
nsIntRect aVisibleRect,
gfx::Matrix4x4 aTransform)
{
float resolution = aLayerBuffer.GetResolution();
gfxSize layerScale(1, 1);
// We assume that the current frame resolution is the one used in our primary
// layer buffer. Compensate for a changing frame resolution.
if (aLayerBuffer.GetFrameResolution() != mVideoMemoryTiledBuffer.GetFrameResolution()) {
const gfxSize& layerResolution = aLayerBuffer.GetFrameResolution();
const gfxSize& localResolution = mVideoMemoryTiledBuffer.GetFrameResolution();
layerScale.width = layerResolution.width / localResolution.width;
layerScale.height = layerResolution.height / localResolution.height;
aVisibleRect.ScaleRoundOut(layerScale.width, layerScale.height);
}
aTransform.Scale(1/(resolution * layerScale.width),
1/(resolution * layerScale.height), 1);
uint32_t rowCount = 0;
uint32_t tileX = 0;
for (int32_t x = aVisibleRect.x; x < aVisibleRect.x + aVisibleRect.width;) {
rowCount++;
int32_t tileStartX = aLayerBuffer.GetTileStart(x);
int32_t w = aLayerBuffer.GetScaledTileLength() - tileStartX;
if (x + w > aVisibleRect.x + aVisibleRect.width) {
w = aVisibleRect.x + aVisibleRect.width - x;
}
int tileY = 0;
for (int32_t y = aVisibleRect.y; y < aVisibleRect.y + aVisibleRect.height;) {
int32_t tileStartY = aLayerBuffer.GetTileStart(y);
int32_t h = aLayerBuffer.GetScaledTileLength() - tileStartY;
if (y + h > aVisibleRect.y + aVisibleRect.height) {
h = aVisibleRect.y + aVisibleRect.height - y;
}
TiledTexture tileTexture = aLayerBuffer.
GetTile(nsIntPoint(aLayerBuffer.RoundDownToTileEdge(x),
aLayerBuffer.RoundDownToTileEdge(y)));
if (tileTexture != aLayerBuffer.GetPlaceholderTile()) {
nsIntRegion tileDrawRegion;
tileDrawRegion.And(aValidRegion,
nsIntRect(x * layerScale.width,
y * layerScale.height,
w * layerScale.width,
h * layerScale.height));
tileDrawRegion.Sub(tileDrawRegion, aMaskRegion);
if (!tileDrawRegion.IsEmpty()) {
tileDrawRegion.ScaleRoundOut(resolution / layerScale.width,
resolution / layerScale.height);
nsIntPoint tileOffset((x - tileStartX) * resolution,
(y - tileStartY) * resolution);
uint32_t tileSize = aLayerBuffer.GetTileLength();
RenderTile(tileTexture, aEffectChain, aOpacity, aTransform, aOffset, aFilter, aClipRect, tileDrawRegion,
tileOffset, nsIntSize(tileSize, tileSize));
}
}
tileY++;
y += h;
}
tileX++;
x += w;
}
}