本文整理汇总了C++中LayerAndroid::setShouldInheritFromRootTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ LayerAndroid::setShouldInheritFromRootTransform方法的具体用法?C++ LayerAndroid::setShouldInheritFromRootTransform怎么用?C++ LayerAndroid::setShouldInheritFromRootTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayerAndroid
的用法示例。
在下文中一共展示了LayerAndroid::setShouldInheritFromRootTransform方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deserializeLayer
LayerAndroid* deserializeLayer(int version, SkStream* stream)
{
int type = stream->readU8();
if (type == LTNone)
return 0;
// Cast is to disambiguate between ctors.
LayerAndroid *layer;
if (type == LTLayerAndroid)
layer = new LayerAndroid((RenderLayer*) 0);
else if (type == LTScrollableLayerAndroid)
layer = new ScrollableLayerAndroid((RenderLayer*) 0);
else {
ALOGV("Unexpected layer type: %d, aborting!", type);
return 0;
}
// Layer fields
layer->setShouldInheritFromRootTransform(stream->readBool());
layer->setOpacity(stream->readScalar());
layer->setSize(stream->readScalar(), stream->readScalar());
layer->setPosition(stream->readScalar(), stream->readScalar());
layer->setAnchorPoint(stream->readScalar(), stream->readScalar());
layer->setMatrix(readMatrix(stream));
layer->setChildrenMatrix(readMatrix(stream));
// LayerAndroid fields
layer->m_haveClip = stream->readBool();
// Keep the legacy serialization/deserialization format...
bool isFixed = stream->readBool();
layer->m_backgroundColorSet = stream->readBool();
bool isIframe = stream->readBool();
// If we are a scrollable layer android, we are an iframe content
if (isIframe && type == LTScrollableLayerAndroid) {
IFrameContentLayerAndroid* iframeContent = new IFrameContentLayerAndroid(*layer);
layer->unref();
layer = iframeContent;
} else if (isIframe) { // otherwise we are just the iframe (we use it to compute offset)
IFrameLayerAndroid* iframe = new IFrameLayerAndroid(*layer);
layer->unref();
layer = iframe;
}
if (isFixed) {
FixedPositioning* fixedPosition = new FixedPositioning(layer);
fixedPosition->m_fixedLeft = readSkLength(stream);
fixedPosition->m_fixedTop = readSkLength(stream);
fixedPosition->m_fixedRight = readSkLength(stream);
fixedPosition->m_fixedBottom = readSkLength(stream);
fixedPosition->m_fixedMarginLeft = readSkLength(stream);
fixedPosition->m_fixedMarginTop = readSkLength(stream);
fixedPosition->m_fixedMarginRight = readSkLength(stream);
fixedPosition->m_fixedMarginBottom = readSkLength(stream);
fixedPosition->m_fixedRect = readSkRect(stream);
fixedPosition->m_renderLayerPos.setX(stream->readS32());
fixedPosition->m_renderLayerPos.setY(stream->readS32());
layer->setFixedPosition(fixedPosition);
} else {
// Not a fixed element, bypass the values in the stream
readSkLength(stream); // fixedLeft
readSkLength(stream); // fixedTop
readSkLength(stream); // fixedRight
readSkLength(stream); // fixedBottom
readSkLength(stream); // fixedMarginLeft
readSkLength(stream); // fixedMarginTop
readSkLength(stream); // fixedMarginRight
readSkLength(stream); // fixedMarginBottom
readSkRect(stream); // fixedRect
stream->readS32(); // renderLayerPos.x()
stream->readS32(); // renderLayerPos.y()
}
layer->m_backfaceVisibility = stream->readBool();
layer->m_visible = stream->readBool();
layer->m_backgroundColor = stream->readU32();
layer->m_preserves3D = stream->readBool();
layer->m_anchorPointZ = stream->readScalar();
layer->m_drawOpacity = stream->readScalar();
bool hasContentsImage = stream->readBool();
if (hasContentsImage) {
int size = stream->readU32();
SkAutoMalloc storage(size);
stream->read(storage.get(), size);
SkFlattenableReadBuffer buffer(storage.get(), size);
SkBitmap contentsImage;
contentsImage.unflatten(buffer);
SkBitmapRef* imageRef = new SkBitmapRef(contentsImage);
layer->setContentsImage(imageRef);
delete imageRef;
}
bool hasRecordingPicture = stream->readBool();
if (hasRecordingPicture) {
SkPicture* picture = new SkPicture(stream);
PictureLayerContent* content = new PictureLayerContent(picture);
layer->setContent(content);
SkSafeUnref(content);
//.........这里部分代码省略.........
示例2: deserializeLayer
LayerAndroid* deserializeLayer(SkStream* stream)
{
int type = stream->readU8();
if (type == LTNone)
return 0;
// Cast is to disambiguate between ctors.
LayerAndroid *layer;
if (type == LTLayerAndroid)
layer = new LayerAndroid((RenderLayer*) 0);
else if (type == LTScrollableLayerAndroid)
layer = new ScrollableLayerAndroid((RenderLayer*) 0);
else {
XLOG("Unexpected layer type: %d, aborting!", type);
return 0;
}
// Layer fields
layer->setShouldInheritFromRootTransform(stream->readBool());
layer->setOpacity(stream->readScalar());
layer->setSize(stream->readScalar(), stream->readScalar());
layer->setPosition(stream->readScalar(), stream->readScalar());
layer->setAnchorPoint(stream->readScalar(), stream->readScalar());
layer->setMatrix(readMatrix(stream));
layer->setChildrenMatrix(readMatrix(stream));
// LayerAndroid fields
layer->m_haveClip = stream->readBool();
layer->m_isFixed = stream->readBool();
layer->m_backgroundColorSet = stream->readBool();
layer->m_isIframe = stream->readBool();
layer->m_fixedLeft = readSkLength(stream);
layer->m_fixedTop = readSkLength(stream);
layer->m_fixedRight = readSkLength(stream);
layer->m_fixedBottom = readSkLength(stream);
layer->m_fixedMarginLeft = readSkLength(stream);
layer->m_fixedMarginTop = readSkLength(stream);
layer->m_fixedMarginRight = readSkLength(stream);
layer->m_fixedMarginBottom = readSkLength(stream);
layer->m_fixedRect = readSkRect(stream);
layer->m_renderLayerPos.setX(stream->readS32());
layer->m_renderLayerPos.setY(stream->readS32());
layer->m_backfaceVisibility = stream->readBool();
layer->m_visible = stream->readBool();
layer->m_backgroundColor = stream->readU32();
layer->m_preserves3D = stream->readBool();
layer->m_anchorPointZ = stream->readScalar();
layer->m_drawOpacity = stream->readScalar();
bool hasContentsImage = stream->readBool();
if (hasContentsImage) {
int size = stream->readU32();
SkAutoMalloc storage(size);
stream->read(storage.get(), size);
SkFlattenableReadBuffer buffer(storage.get(), size);
SkBitmap contentsImage;
contentsImage.unflatten(buffer);
SkBitmapRef* imageRef = new SkBitmapRef(contentsImage);
layer->setContentsImage(imageRef);
delete imageRef;
}
bool hasRecordingPicture = stream->readBool();
if (hasRecordingPicture) {
layer->m_recordingPicture = new SkPicture(stream);
}
int animationCount = stream->readU32(); // TODO: Support (maybe?)
readTransformationMatrix(stream, layer->m_transform);
readTransformationMatrix(stream, layer->m_childrenTransform);
if (type == LTScrollableLayerAndroid) {
ScrollableLayerAndroid* scrollableLayer =
static_cast<ScrollableLayerAndroid*>(layer);
scrollableLayer->m_scrollLimits.set(
stream->readScalar(),
stream->readScalar(),
stream->readScalar(),
stream->readScalar());
}
int childCount = stream->readU32();
for (int i = 0; i < childCount; i++) {
LayerAndroid *childLayer = deserializeLayer(stream);
if (childLayer)
layer->addChild(childLayer);
}
layer->needsRepaint();
XLOG("Created layer with id %d", layer->uniqueId());
return layer;
}
开发者ID:johnwpoliver,项目名称:Samsung-GT-P3113-AOSP-CM-Kernel-and-Ramdisk,代码行数:85,代码来源:ViewStateSerializer.cpp