Fix for skp chunk sizes when clips are used outside of any save
https://codereview.appspot.com/7342047/ git-svn-id: http://skia.googlecode.com/svn/trunk@7748 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
2ca1aaaa44
commit
f92915089f
@ -352,8 +352,12 @@ void SkPictureRecord::recordRestoreOffsetPlaceholder(SkRegion::Op op) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SkPictureRecord::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
|
bool SkPictureRecord::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
|
||||||
// id + rect + clip params + restore offset
|
// id + rect + clip params
|
||||||
uint32_t size = 1 * kUInt32Size + sizeof(rect) + 2 * kUInt32Size;
|
uint32_t size = 1 * kUInt32Size + sizeof(rect) + 1 * kUInt32Size;
|
||||||
|
if (!fRestoreOffsetStack.isEmpty()) {
|
||||||
|
// + restore offset
|
||||||
|
size += kUInt32Size;
|
||||||
|
}
|
||||||
uint32_t initialOffset = this->addDraw(CLIP_RECT, &size);
|
uint32_t initialOffset = this->addDraw(CLIP_RECT, &size);
|
||||||
addRect(rect);
|
addRect(rect);
|
||||||
addInt(ClipParams_pack(op, doAA));
|
addInt(ClipParams_pack(op, doAA));
|
||||||
@ -368,8 +372,12 @@ bool SkPictureRecord::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA
|
|||||||
return this->SkPictureRecord::clipRect(rrect.getBounds(), op, doAA);
|
return this->SkPictureRecord::clipRect(rrect.getBounds(), op, doAA);
|
||||||
}
|
}
|
||||||
|
|
||||||
// op + rrect + clip params + restore offset
|
// op + rrect + clip params
|
||||||
uint32_t size = 1 * kUInt32Size + SkRRect::kSizeInMemory + 2 * kUInt32Size;
|
uint32_t size = 1 * kUInt32Size + SkRRect::kSizeInMemory + 1 * kUInt32Size;
|
||||||
|
if (!fRestoreOffsetStack.isEmpty()) {
|
||||||
|
// + restore offset
|
||||||
|
size += kUInt32Size;
|
||||||
|
}
|
||||||
uint32_t initialOffset = this->addDraw(CLIP_RRECT, &size);
|
uint32_t initialOffset = this->addDraw(CLIP_RRECT, &size);
|
||||||
addRRect(rrect);
|
addRRect(rrect);
|
||||||
addInt(ClipParams_pack(op, doAA));
|
addInt(ClipParams_pack(op, doAA));
|
||||||
@ -391,8 +399,12 @@ bool SkPictureRecord::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
|
|||||||
return this->clipRect(r, op, doAA);
|
return this->clipRect(r, op, doAA);
|
||||||
}
|
}
|
||||||
|
|
||||||
// op + path index + clip params + restore offset
|
// op + path index + clip params
|
||||||
uint32_t size = 4 * kUInt32Size;
|
uint32_t size = 3 * kUInt32Size;
|
||||||
|
if (!fRestoreOffsetStack.isEmpty()) {
|
||||||
|
// + restore offset
|
||||||
|
size += kUInt32Size;
|
||||||
|
}
|
||||||
uint32_t initialOffset = this->addDraw(CLIP_PATH, &size);
|
uint32_t initialOffset = this->addDraw(CLIP_PATH, &size);
|
||||||
addPath(path);
|
addPath(path);
|
||||||
addInt(ClipParams_pack(op, doAA));
|
addInt(ClipParams_pack(op, doAA));
|
||||||
@ -408,8 +420,12 @@ bool SkPictureRecord::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SkPictureRecord::clipRegion(const SkRegion& region, SkRegion::Op op) {
|
bool SkPictureRecord::clipRegion(const SkRegion& region, SkRegion::Op op) {
|
||||||
// op + region index + clip params + restore offset
|
// op + region index + clip params
|
||||||
uint32_t size = 4 * kUInt32Size;
|
uint32_t size = 3 * kUInt32Size;
|
||||||
|
if (!fRestoreOffsetStack.isEmpty()) {
|
||||||
|
// + restore offset
|
||||||
|
size += kUInt32Size;
|
||||||
|
}
|
||||||
uint32_t initialOffset = this->addDraw(CLIP_REGION, &size);
|
uint32_t initialOffset = this->addDraw(CLIP_REGION, &size);
|
||||||
addRegion(region);
|
addRegion(region);
|
||||||
addInt(ClipParams_pack(op, false));
|
addInt(ClipParams_pack(op, false));
|
||||||
|
Loading…
Reference in New Issue
Block a user