int SkPictureRecord::saveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags) { // record the offset to us, making it non-positive to distinguish a save // from a clip entry. fRestoreOffsetStack.push(-(int32_t)fWriter.size()); addDraw(SAVE_LAYER); addRectPtr(bounds); addPaintPtr(paint); addInt(flags); if (kNoSavedLayerIndex == fFirstSavedLayerIndex) { fFirstSavedLayerIndex = fRestoreOffsetStack.count(); } validate(); /* Don't actually call saveLayer, because that will try to allocate an offscreen device (potentially very big) which we don't actually need at this time (and may not be able to afford since during record our clip starts out the size of the picture, which is often much larger than the size of the actual device we'll use during playback). */ int count = this->INHERITED::save(flags); this->clipRectBounds(bounds, flags, NULL); return count; }
void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst, const SkPaint* paint) { addDraw(DRAW_BITMAP_RECT_TO_RECT); addPaintPtr(paint); addBitmap(bitmap); addRectPtr(src); // may be null addRect(dst); validate(); }
int SkPictureRecord::saveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags) { addDraw(SAVE_LAYER); addRectPtr(bounds); addPaintPtr(paint); addInt(flags); fRestoreOffsetStack.push(0); validate(); /* Don't actually call saveLayer, because that will try to allocate an offscreen device (potentially very big) which we don't actually need at this time (and may not be able to afford since during record our clip starts out the size of the picture, which is often much larger than the size of the actual device we'll use during playback). */ return this->INHERITED::save(flags); }