本文整理汇总了C++中LayerRenderState类的典型用法代码示例。如果您正苦于以下问题:C++ LayerRenderState类的具体用法?C++ LayerRenderState怎么用?C++ LayerRenderState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LayerRenderState类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
LayerRenderState
ImageHostOverlay::GetRenderState()
{
LayerRenderState state;
if (mOverlay.handle().type() == OverlayHandle::Tint32_t) {
state.SetOverlayId(mOverlay.handle().get_int32_t());
}
return state;
}
示例2:
LayerRenderState
DeprecatedContentHostBase::GetRenderState()
{
LayerRenderState result = mDeprecatedTextureHost->GetRenderState();
if (mBufferRotation != nsIntPoint()) {
result.mFlags |= LAYER_RENDER_STATE_BUFFER_ROTATION;
}
result.SetOffset(GetOriginOffset());
return result;
}
示例3: LayerRenderState
LayerRenderState
ContentHostTexture::GetRenderState()
{
if (!mTextureHost) {
return LayerRenderState();
}
LayerRenderState result = mTextureHost->GetRenderState();
if (mBufferRotation != nsIntPoint()) {
result.mFlags |= LayerRenderStateFlags::BUFFER_ROTATION;
}
result.SetOffset(GetOriginOffset());
return result;
}
示例4: LOGD
bool
HwcComposer2D::PrepareLayerList(Layer* aLayer,
const nsIntRect& aClip,
const gfxMatrix& aParentTransform,
const gfxMatrix& aGLWorldTransform)
{
// NB: we fall off this path whenever there are container layers
// that require intermediate surfaces. That means all the
// GetEffective*() coordinates are relative to the framebuffer.
bool fillColor = false;
const nsIntRegion& visibleRegion = aLayer->GetEffectiveVisibleRegion();
if (visibleRegion.IsEmpty()) {
return true;
}
uint8_t opacity = std::min(0xFF, (int)(aLayer->GetEffectiveOpacity() * 256.0));
#if ANDROID_VERSION < 18
if (opacity < 0xFF) {
LOGD("%s Layer has planar semitransparency which is unsupported", aLayer->Name());
return false;
}
#endif
nsIntRect clip;
if (!HwcUtils::CalculateClipRect(aParentTransform * aGLWorldTransform,
aLayer->GetEffectiveClipRect(),
aClip,
&clip))
{
LOGD("%s Clip rect is empty. Skip layer", aLayer->Name());
return true;
}
// HWC supports only the following 2D transformations:
//
// Scaling via the sourceCrop and displayFrame in HwcLayer
// Translation via the sourceCrop and displayFrame in HwcLayer
// Rotation (in square angles only) via the HWC_TRANSFORM_ROT_* flags
// Reflection (horizontal and vertical) via the HWC_TRANSFORM_FLIP_* flags
//
// A 2D transform with PreservesAxisAlignedRectangles() has all the attributes
// above
gfxMatrix transform;
const gfx3DMatrix& transform3D = aLayer->GetEffectiveTransform();
if (!transform3D.Is2D(&transform) || !transform.PreservesAxisAlignedRectangles()) {
LOGD("Layer has a 3D transform or a non-square angle rotation");
return false;
}
if (ContainerLayer* container = aLayer->AsContainerLayer()) {
if (container->UseIntermediateSurface()) {
LOGD("Container layer needs intermediate surface");
return false;
}
nsAutoTArray<Layer*, 12> children;
container->SortChildrenBy3DZOrder(children);
for (uint32_t i = 0; i < children.Length(); i++) {
if (!PrepareLayerList(children[i], clip, transform, aGLWorldTransform)) {
return false;
}
}
return true;
}
LayerRenderState state = aLayer->GetRenderState();
nsIntSize surfaceSize;
if (state.mSurface.get()) {
surfaceSize = state.mSize;
} else {
if (aLayer->AsColorLayer() && mColorFill) {
fillColor = true;
} else {
LOGD("%s Layer doesn't have a gralloc buffer", aLayer->Name());
return false;
}
}
// Buffer rotation is not to be confused with the angled rotation done by a transform matrix
// It's a fancy ThebesLayer feature used for scrolling
if (state.BufferRotated()) {
LOGD("%s Layer has a rotated buffer", aLayer->Name());
return false;
}
// OK! We can compose this layer with hwc.
int current = mList ? mList->numHwLayers : 0;
if (!mList || current >= mMaxLayerCount) {
if (!ReallocLayerList() || current >= mMaxLayerCount) {
LOGE("PrepareLayerList failed! Could not increase the maximum layer count");
return false;
}
}
nsIntRect visibleRect = visibleRegion.GetBounds();
//.........这里部分代码省略.........
示例5: LOGD
bool
HwcComposer2D::PrepareLayerList(Layer* aLayer,
const nsIntRect& aClip,
const gfxMatrix& aParentTransform,
const gfxMatrix& aGLWorldTransform)
{
// NB: we fall off this path whenever there are container layers
// that require intermediate surfaces. That means all the
// GetEffective*() coordinates are relative to the framebuffer.
bool fillColor = false;
const nsIntRegion& visibleRegion = aLayer->GetEffectiveVisibleRegion();
if (visibleRegion.IsEmpty()) {
return true;
}
float opacity = aLayer->GetEffectiveOpacity();
if (opacity <= 0) {
LOGD("Layer is fully transparent so skip rendering");
return true;
}
else if (opacity < 1) {
LOGD("Layer has planar semitransparency which is unsupported");
return false;
}
if (visibleRegion.GetNumRects() > 1) {
// FIXME/bug 808339
LOGD("Layer has nontrivial visible region");
return false;
}
nsIntRect clip;
if (!CalculateClipRect(aParentTransform * aGLWorldTransform,
aLayer->GetEffectiveClipRect(),
aClip,
&clip))
{
LOGD("Clip rect is empty. Skip layer");
return true;
}
gfxMatrix transform;
const gfx3DMatrix& transform3D = aLayer->GetEffectiveTransform();
if (!transform3D.Is2D(&transform) || !transform.PreservesAxisAlignedRectangles()) {
LOGD("Layer has a 3D transform or a non-square angle rotation");
return false;
}
if (ContainerLayer* container = aLayer->AsContainerLayer()) {
if (container->UseIntermediateSurface()) {
LOGD("Container layer needs intermediate surface");
return false;
}
nsAutoTArray<Layer*, 12> children;
container->SortChildrenBy3DZOrder(children);
for (uint32_t i = 0; i < children.Length(); i++) {
if (!PrepareLayerList(children[i], clip, transform, aGLWorldTransform)) {
return false;
}
}
return true;
}
LayerOGL* layerGL = static_cast<LayerOGL*>(aLayer->ImplData());
LayerRenderState state = layerGL->GetRenderState();
if (!state.mSurface ||
state.mSurface->type() != SurfaceDescriptor::TSurfaceDescriptorGralloc) {
if (aLayer->AsColorLayer() && mColorFill) {
fillColor = true;
} else {
LOGD("Layer doesn't have a gralloc buffer");
return false;
}
}
if (state.BufferRotated()) {
LOGD("Layer has a rotated buffer");
return false;
}
// OK! We can compose this layer with hwc.
int current = mList ? mList->numHwLayers : 0;
if (!mList || current >= mMaxLayerCount) {
if (!ReallocLayerList() || current >= mMaxLayerCount) {
LOGE("PrepareLayerList failed! Could not increase the maximum layer count");
return false;
}
}
sp<GraphicBuffer> buffer = fillColor ? nullptr : GrallocBufferActor::GetFrom(*state.mSurface);
nsIntRect visibleRect = visibleRegion.GetBounds();
nsIntRect bufferRect;
//.........这里部分代码省略.........
示例6: LOGD
bool
HwcComposer2D::PrepareLayerList(Layer* aLayer,
const nsIntRect& aClip,
const Matrix& aParentTransform,
bool aFindSidebandStreams)
{
// NB: we fall off this path whenever there are container layers
// that require intermediate surfaces. That means all the
// GetEffective*() coordinates are relative to the framebuffer.
bool fillColor = false;
const nsIntRegion visibleRegion = aLayer->GetLocalVisibleRegion().ToUnknownRegion();
if (visibleRegion.IsEmpty()) {
return true;
}
uint8_t opacity = std::min(0xFF, (int)(aLayer->GetEffectiveOpacity() * 256.0));
if (opacity == 0) {
LOGD("%s Layer has zero opacity; skipping", aLayer->Name());
return true;
}
if (!mHal->SupportTransparency() && opacity < 0xFF && !aFindSidebandStreams) {
LOGD("%s Layer has planar semitransparency which is unsupported by hwcomposer", aLayer->Name());
return false;
}
if (aLayer->GetMaskLayer() && !aFindSidebandStreams) {
LOGD("%s Layer has MaskLayer which is unsupported by hwcomposer", aLayer->Name());
return false;
}
nsIntRect clip;
nsIntRect layerClip = aLayer->GetLocalClipRect().valueOr(ParentLayerIntRect()).ToUnknownRect();
nsIntRect* layerClipPtr = aLayer->GetLocalClipRect() ? &layerClip : nullptr;
if (!HwcUtils::CalculateClipRect(aParentTransform,
layerClipPtr,
aClip,
&clip))
{
LOGD("%s Clip rect is empty. Skip layer", aLayer->Name());
return true;
}
// HWC supports only the following 2D transformations:
//
// Scaling via the sourceCrop and displayFrame in HwcLayer
// Translation via the sourceCrop and displayFrame in HwcLayer
// Rotation (in square angles only) via the HWC_TRANSFORM_ROT_* flags
// Reflection (horizontal and vertical) via the HWC_TRANSFORM_FLIP_* flags
//
// A 2D transform with PreservesAxisAlignedRectangles() has all the attributes
// above
Matrix layerTransform;
if (!aLayer->GetEffectiveTransform().Is2D(&layerTransform) ||
!layerTransform.PreservesAxisAlignedRectangles()) {
LOGD("Layer EffectiveTransform has a 3D transform or a non-square angle rotation");
return false;
}
Matrix layerBufferTransform;
if (!aLayer->GetEffectiveTransformForBuffer().Is2D(&layerBufferTransform) ||
!layerBufferTransform.PreservesAxisAlignedRectangles()) {
LOGD("Layer EffectiveTransformForBuffer has a 3D transform or a non-square angle rotation");
return false;
}
if (ContainerLayer* container = aLayer->AsContainerLayer()) {
if (container->UseIntermediateSurface() && !aFindSidebandStreams) {
LOGD("Container layer needs intermediate surface");
return false;
}
AutoTArray<Layer*, 12> children;
container->SortChildrenBy3DZOrder(children);
for (uint32_t i = 0; i < children.Length(); i++) {
if (!PrepareLayerList(children[i], clip, layerTransform, aFindSidebandStreams) &&
!aFindSidebandStreams) {
return false;
}
}
return true;
}
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;
}
}
//.........这里部分代码省略.........
示例7: LOGD
bool
HwcComposer2D::PrepareLayerList(Layer* aLayer,
const nsIntRect& aClip,
const Matrix& aParentTransform)
{
// NB: we fall off this path whenever there are container layers
// that require intermediate surfaces. That means all the
// GetEffective*() coordinates are relative to the framebuffer.
bool fillColor = false;
const nsIntRegion& visibleRegion = aLayer->GetEffectiveVisibleRegion();
if (visibleRegion.IsEmpty()) {
return true;
}
uint8_t opacity = std::min(0xFF, (int)(aLayer->GetEffectiveOpacity() * 256.0));
#if ANDROID_VERSION < 18
if (opacity < 0xFF) {
LOGD("%s Layer has planar semitransparency which is unsupported by hwcomposer", aLayer->Name());
return false;
}
#endif
if (aLayer->GetMaskLayer()) {
LOGD("%s Layer has MaskLayer which is unsupported by hwcomposer", aLayer->Name());
return false;
}
nsIntRect clip;
if (!HwcUtils::CalculateClipRect(aParentTransform,
aLayer->GetEffectiveClipRect(),
aClip,
&clip))
{
LOGD("%s Clip rect is empty. Skip layer", aLayer->Name());
return true;
}
// HWC supports only the following 2D transformations:
//
// Scaling via the sourceCrop and displayFrame in HwcLayer
// Translation via the sourceCrop and displayFrame in HwcLayer
// Rotation (in square angles only) via the HWC_TRANSFORM_ROT_* flags
// Reflection (horizontal and vertical) via the HWC_TRANSFORM_FLIP_* flags
//
// A 2D transform with PreservesAxisAlignedRectangles() has all the attributes
// above
Matrix layerTransform;
if (!aLayer->GetEffectiveTransform().Is2D(&layerTransform) ||
!layerTransform.PreservesAxisAlignedRectangles()) {
LOGD("Layer EffectiveTransform has a 3D transform or a non-square angle rotation");
return false;
}
Matrix layerBufferTransform;
if (!aLayer->GetEffectiveTransformForBuffer().Is2D(&layerBufferTransform) ||
!layerBufferTransform.PreservesAxisAlignedRectangles()) {
LOGD("Layer EffectiveTransformForBuffer has a 3D transform or a non-square angle rotation");
return false;
}
if (ContainerLayer* container = aLayer->AsContainerLayer()) {
if (container->UseIntermediateSurface()) {
LOGD("Container layer needs intermediate surface");
return false;
}
nsAutoTArray<Layer*, 12> children;
container->SortChildrenBy3DZOrder(children);
for (uint32_t i = 0; i < children.Length(); i++) {
if (!PrepareLayerList(children[i], clip, layerTransform)) {
return false;
}
}
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;
//.........这里部分代码省略.........