本文整理汇总了C++中ImageLayer::GetScaleMode方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageLayer::GetScaleMode方法的具体用法?C++ ImageLayer::GetScaleMode怎么用?C++ ImageLayer::GetScaleMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageLayer
的用法示例。
在下文中一共展示了ImageLayer::GetScaleMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ComputeChangeInternal
virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
bool& aGeometryChanged)
{
ImageLayer* imageLayer = static_cast<ImageLayer*>(mLayer.get());
if (!imageLayer->GetVisibleRegion().IsEqual(mVisibleRegion)) {
aGeometryChanged = true;
IntRect result = NewTransformedBounds();
result = result.Union(OldTransformedBounds());
return result;
}
ImageContainer* container = imageLayer->GetContainer();
if (mContainer != container ||
mFilter != imageLayer->GetFilter() ||
mScaleToSize != imageLayer->GetScaleToSize() ||
mScaleMode != imageLayer->GetScaleMode()) {
aGeometryChanged = true;
if (mIsMask) {
// Mask layers have an empty visible region, so we have to
// use the image size instead.
IntSize size = container->GetCurrentSize();
IntRect rect(0, 0, size.width, size.height);
return TransformRect(rect, mLayer->GetLocalTransform());
} else {
return NewTransformedBounds();
}
}
return IntRect();
}
示例2: ComputeChangeInternal
virtual nsIntRect ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback)
{
ImageLayer* image = static_cast<ImageLayer*>(mLayer);
if (!image->GetVisibleRegion().IsEqual(mVisibleRegion)) {
nsIntRect result = NewTransformedBounds();
result = result.Union(OldTransformedBounds());
return result;
}
if (mContainer != image->GetContainer() ||
mFilter != image->GetFilter() ||
mScaleToSize != image->GetScaleToSize() ||
mScaleMode != image->GetScaleMode()) {
return NewTransformedBounds();
}
return nsIntRect();
}
示例3: Commit
//.........这里部分代码省略.........
LayerRenderState state = aLayer->GetRenderState();
#if ANDROID_VERSION >= 21
if (!state.GetGrallocBuffer() && !state.GetSidebandStream().IsValid()) {
#else
if (!state.GetGrallocBuffer()) {
#endif
if (aLayer->AsColorLayer() && mColorFill) {
fillColor = true;
} else {
LOGD("%s Layer doesn't have a gralloc buffer", aLayer->Name());
return false;
}
}
nsIntRect visibleRect = visibleRegion.GetBounds();
nsIntRect bufferRect;
if (fillColor) {
bufferRect = nsIntRect(visibleRect);
} else {
nsIntRect layerRect;
if (state.mHasOwnOffset) {
bufferRect = nsIntRect(state.mOffset.x, state.mOffset.y,
state.mSize.width, state.mSize.height);
layerRect = bufferRect;
} else {
//Since the buffer doesn't have its own offset, assign the whole
//surface size as its buffer bounds
bufferRect = nsIntRect(0, 0, state.mSize.width, state.mSize.height);
layerRect = bufferRect;
if (aLayer->GetType() == Layer::TYPE_IMAGE) {
ImageLayer* imageLayer = static_cast<ImageLayer*>(aLayer);
if(imageLayer->GetScaleMode() != ScaleMode::SCALE_NONE) {
layerRect = nsIntRect(0, 0, imageLayer->GetScaleToSize().width, imageLayer->GetScaleToSize().height);
}
}
}
// In some cases the visible rect assigned to the layer can be larger
// than the layer's surface, e.g., an ImageLayer with a small Image
// in it.
visibleRect.IntersectRect(visibleRect, layerRect);
}
// Buffer rotation is not to be confused with the angled rotation done by a transform matrix
// It's a fancy PaintedLayer feature used for scrolling
if (state.BufferRotated()) {
LOGD("%s Layer has a rotated buffer", aLayer->Name());
return false;
}
const bool needsYFlip = state.OriginBottomLeft() ? true
: false;
hwc_rect_t sourceCrop, displayFrame;
if(!HwcUtils::PrepareLayerRects(visibleRect,
layerTransform,
layerBufferTransform,
clip,
bufferRect,
needsYFlip,
&(sourceCrop),
&(displayFrame)))
{
return true;
}
示例4: LOGD
//.........这里部分代码省略.........
}
return true;
}
LayerRenderState state = aLayer->GetRenderState();
if (!state.mSurface.get()) {
if (aLayer->AsColorLayer() && mColorFill) {
fillColor = true;
} else {
LOGD("%s Layer doesn't have a gralloc buffer", aLayer->Name());
return false;
}
}
nsIntRect visibleRect = visibleRegion.GetBounds();
nsIntRect bufferRect;
if (fillColor) {
bufferRect = nsIntRect(visibleRect);
} else {
nsIntRect layerRect;
if (state.mHasOwnOffset) {
bufferRect = nsIntRect(state.mOffset.x, state.mOffset.y,
state.mSize.width, state.mSize.height);
layerRect = bufferRect;
} else {
//Since the buffer doesn't have its own offset, assign the whole
//surface size as its buffer bounds
bufferRect = nsIntRect(0, 0, state.mSize.width, state.mSize.height);
layerRect = bufferRect;
if (aLayer->GetType() == Layer::TYPE_IMAGE) {
ImageLayer* imageLayer = static_cast<ImageLayer*>(aLayer);
if(imageLayer->GetScaleMode() != ScaleMode::SCALE_NONE) {
layerRect = nsIntRect(0, 0, imageLayer->GetScaleToSize().width, imageLayer->GetScaleToSize().height);
}
}
}
// In some cases the visible rect assigned to the layer can be larger
// than the layer's surface, e.g., an ImageLayer with a small Image
// in it.
visibleRect.IntersectRect(visibleRect, layerRect);
}
// Buffer rotation is not to be confused with the angled rotation done by a transform matrix
// It's a fancy PaintedLayer feature used for scrolling
if (state.BufferRotated()) {
LOGD("%s Layer has a rotated buffer", aLayer->Name());
return false;
}
const bool needsYFlip = state.OriginBottomLeft() ? true
: false;
hwc_rect_t sourceCrop, displayFrame;
if(!HwcUtils::PrepareLayerRects(visibleRect,
layerTransform,
layerBufferTransform,
clip,
bufferRect,
needsYFlip,
&(sourceCrop),
&(displayFrame)))
{
return true;
}