Bug 1489632 - mark Skia bitmap layer as immutable before popping it. r=rhunt a=pascalc
authorLee Salzman <lsalzman@mozilla.com>
Wed, 19 Sep 2018 15:31:09 -0400
changeset 492575 f197ee75ff38460143b3d649154b830674b44886
parent 492574 93d45f9ae4c694e7950a02406d6ea9c511700109
child 492576 918738f6956f03c706b2da4b4ab92a86eb468214
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhunt, pascalc
Bug 1489632 - mark Skia bitmap layer as immutable before popping it. r=rhunt a=pascalc
--- a/gfx/skia/skia/src/core/SkBitmapDevice.h
+++ b/gfx/skia/skia/src/core/SkBitmapDevice.h
@@ -114,16 +114,17 @@ protected:
     void drawSpecial(SkSpecialImage*, int x, int y, const SkPaint&,
                      SkImage*, const SkMatrix&) override;
     sk_sp<SkSpecialImage> makeSpecial(const SkBitmap&) override;
     sk_sp<SkSpecialImage> makeSpecial(const SkImage*) override;
     sk_sp<SkSpecialImage> snapSpecial() override;
+    void setImmutable() override { fBitmap.setImmutable(); }
     bool onReadPixels(const SkPixmap&, int x, int y) override;
     bool onWritePixels(const SkPixmap&, int, int) override;
     bool onPeekPixels(SkPixmap*) override;
     bool onAccessPixels(SkPixmap*) override;
--- a/gfx/skia/skia/src/core/SkCanvas.cpp
+++ b/gfx/skia/skia/src/core/SkCanvas.cpp
@@ -1190,16 +1190,17 @@ void SkCanvas::internalRestore() {
     /*  Time to draw the layer's offscreen. We can't call the public drawSprite,
         since if we're being recorded, we don't want to record this (the
         recorder will have already recorded the restore).
     if (layer) {
         if (fMCRec) {
             const SkIPoint& origin = layer->fDevice->getOrigin();
+            layer->fDevice->setImmutable();
             this->internalDrawDevice(layer->fDevice.get(), origin.x(), origin.y(),
                                      layer->fClipImage.get(), layer->fClipMatrix);
             // restore what we smashed in internalSaveLayer
             fMCRec->fMatrix = layer->fStashedMatrix;
             // reset this, since internalDrawDevice will have set it to true
             delete layer;
         } else {
--- a/gfx/skia/skia/src/core/SkDevice.h
+++ b/gfx/skia/skia/src/core/SkDevice.h
@@ -266,16 +266,17 @@ protected:
     virtual void drawTextRSXform(const void* text, size_t len, const SkRSXform[],
                                  const SkPaint&);
     virtual void drawSpecial(SkSpecialImage*, int x, int y, const SkPaint&,
                              SkImage* clipImage, const SkMatrix& clipMatrix);
     virtual sk_sp<SkSpecialImage> makeSpecial(const SkBitmap&);
     virtual sk_sp<SkSpecialImage> makeSpecial(const SkImage*);
     virtual sk_sp<SkSpecialImage> snapSpecial();
+    virtual void setImmutable() {}
     bool readPixels(const SkPixmap&, int x, int y);
     virtual GrContext* context() const { return nullptr; }
     virtual sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps&);