Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Unified Diff: src/core/SkBitmap.cpp

Issue 129423002: add SkBitmap::installPixelRef() (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698