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

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
« no previous file with comments | « include/core/SkImageInfo.h ('k') | src/core/SkImageFilterUtils.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmap.cpp
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index f950e28cdccb2ca6b3a8a57ee9dc387621172f16..6615b1c52b3b46bfa0b2a969f5b15471d77bbb1f 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -333,6 +333,30 @@ 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();
+ // not known until we're locked
+ fRowBytes = 0;
+
+ SkIRect bounds = { 0, 0, info.fWidth, info.fHeight };
+ if (subset && !bounds.intersect(*subset)) {
+ bounds.setEmpty();
+ }
+
+ fWidth = bounds.width();
+ fHeight = bounds.height();
+ return this->setPixelRef(pr, bounds.left(), bounds.top());
+}
+
void SkBitmap::updatePixelsFromRef() const {
if (NULL != fPixelRef) {
if (fPixelLockCount > 0) {
« no previous file with comments | « include/core/SkImageInfo.h ('k') | src/core/SkImageFilterUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698