| Index: src/core/SkRecords.h
|
| diff --git a/src/core/SkRecords.h b/src/core/SkRecords.h
|
| index d6fc723b39c866598a339d9c1e709af4c7099b66..d8dfb2b93729a60babe2dabfcbce3f3ed9cf19ad 100644
|
| --- a/src/core/SkRecords.h
|
| +++ b/src/core/SkRecords.h
|
| @@ -183,15 +183,24 @@ private:
|
|
|
| // Like SkBitmap, but deep copies pixels if they're not immutable.
|
| // Using this, we guarantee the immutability of all bitmaps we record.
|
| -struct ImmutableBitmap : public SkBitmap {
|
| +class ImmutableBitmap : SkNoncopyable {
|
| +public:
|
| explicit ImmutableBitmap(const SkBitmap& bitmap) {
|
| if (bitmap.isImmutable()) {
|
| - *(SkBitmap*)this = bitmap;
|
| + fBitmap = bitmap;
|
| } else {
|
| - bitmap.copyTo(this);
|
| + bitmap.copyTo(&fBitmap);
|
| }
|
| - this->setImmutable();
|
| + fBitmap.setImmutable();
|
| }
|
| +
|
| + int width() const { return fBitmap.width(); }
|
| + int height() const { return fBitmap.height(); }
|
| +
|
| + // While the pixels are immutable, SkBitmap itself is not thread-safe, so return a copy.
|
| + SkBitmap shallowCopy() const { return fBitmap; }
|
| +private:
|
| + SkBitmap fBitmap;
|
| };
|
|
|
| // SkPath::getBounds() isn't thread safe unless we precache the bounds in a singlethreaded context.
|
|
|