Chromium Code Reviews| Index: src/core/SkBitmap.cpp |
| diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp |
| index cb8ac7231b29a9728dcf0d4804c6660c40291a04..79c63d32919abbc311e9e5c35b337bfa48d7f9d5 100644 |
| --- a/src/core/SkBitmap.cpp |
| +++ b/src/core/SkBitmap.cpp |
| @@ -333,6 +333,31 @@ bool SkBitmap::setAlphaType(SkAlphaType alphaType) { |
| return true; |
| } |
| +SkPixelRef* SkBitmap::installPixelRef(SkPixelRef* pr, const SkIRect* subset) { |
| + if (NULL == pr) { |
| + this->reset(); |
| + return NULL; |
| + } |
| + |
| + const SkImageInfo& info = pr->info(); |
| + |
| + fConfig = SkColorTypeToBitmapConfig(info.fColorType); |
| + fAlphaType = info.fAlphaType; |
| + fBytesPerPixel = info.bytesPerPixel(); |
| + |
| + SkIRect bounds = { 0, 0, info.fWidth, info.fHeight }; |
| + if (subset && !bounds.intersect(*subset)) { |
| + bounds.setEmpty(); |
| + } |
| + |
| + fRowBytes = 0; // not known until we're locked |
| + fPixelRefOrigin.set(bounds.left(), bounds.top()); |
| + fWidth = bounds.width(); |
| + fHeight = bounds.height(); |
| + |
| + return this->setPixelRef(pr); |
|
scroggo
2014/01/09 00:02:11
This will overwrite fPixelRefOrigin. Instead, I th
reed1
2014/01/13 16:27:26
Done.
|
| +} |
| + |
| void SkBitmap::updatePixelsFromRef() const { |
| if (NULL != fPixelRef) { |
| if (fPixelLockCount > 0) { |