Chromium Code Reviews| Index: src/image/SkSurface_Picture.cpp |
| diff --git a/src/image/SkSurface_Picture.cpp b/src/image/SkSurface_Picture.cpp |
| index 8cfe6e87d564561eed959319cfbe6b58c5482ce5..18e2da6e3d1258fdeb612115188e6a7d56962b24 100644 |
| --- a/src/image/SkSurface_Picture.cpp |
| +++ b/src/image/SkSurface_Picture.cpp |
| @@ -25,6 +25,7 @@ public: |
| virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, |
| const SkPaint*) SK_OVERRIDE; |
| virtual void onCopyOnWrite(ContentChangeMode) SK_OVERRIDE; |
| + virtual void onDiscard() SK_OVERRIDE; |
| private: |
| SkPicture* fPicture; |
| @@ -75,9 +76,18 @@ void SkSurface_Picture::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, |
| SkImagePrivDrawPicture(canvas, fPicture, x, y, paint); |
| } |
| -void SkSurface_Picture::onCopyOnWrite(ContentChangeMode /*mode*/) { |
| +void SkSurface_Picture::onCopyOnWrite(ContentChangeMode mode) { |
| // We always spawn a copy of the recording picture when we |
| // are asked for a snapshot, so we never need to do anything here. |
| + if (kDiscard_ContentChangeMode == mode) { |
| + this->SkSurface_Picture::onDiscard(); |
| + } |
| +} |
| + |
| +void SkSurface_Picture::onDiscard() { |
|
robertphillips
2014/03/27 12:19:44
NULL != ?
bsalomon
2014/03/27 13:13:17
Done.
|
| + if (fPicture) { |
| + fPicture->beginRecording(this->width(), this->height()); |
| + } |
| } |
| /////////////////////////////////////////////////////////////////////////////// |