aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkBitmap.cpp24
-rw-r--r--src/core/SkImageFilterUtils.cpp10
-rw-r--r--src/core/SkScaledImageCache.cpp12
3 files changed, 16 insertions, 30 deletions
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 6615b1c52b..f950e28cdc 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -333,30 +333,6 @@ 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) {
diff --git a/src/core/SkImageFilterUtils.cpp b/src/core/SkImageFilterUtils.cpp
index 076ef9bb91..92fe67e84c 100644
--- a/src/core/SkImageFilterUtils.cpp
+++ b/src/core/SkImageFilterUtils.cpp
@@ -15,8 +15,14 @@
#include "SkGr.h"
bool SkImageFilterUtils::WrapTexture(GrTexture* texture, int width, int height, SkBitmap* result) {
- SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
- result->installPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref();
+ SkImageInfo info = {
+ width,
+ height,
+ kPMColor_SkColorType,
+ kPremul_SkAlphaType,
+ };
+ result->setConfig(info);
+ result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref();
return true;
}
diff --git a/src/core/SkScaledImageCache.cpp b/src/core/SkScaledImageCache.cpp
index 68663f03b0..fc3148bdd8 100644
--- a/src/core/SkScaledImageCache.cpp
+++ b/src/core/SkScaledImageCache.cpp
@@ -293,10 +293,14 @@ bool SkScaledImageCacheDiscardableAllocator::allocPixelRef(SkBitmap* bitmap,
return false;
}
- SkImageInfo info = SkImageInfo::MakeN32(bitmap->width(), bitmap->height(),
- bitmap->alphaType());
-
- bitmap->installPixelRef(SkNEW_ARGS(SkOneShotDiscardablePixelRef,
+ SkImageInfo info = {
+ bitmap->width(),
+ bitmap->height(),
+ kPMColor_SkColorType,
+ bitmap->alphaType()
+ };
+
+ bitmap->setPixelRef(SkNEW_ARGS(SkOneShotDiscardablePixelRef,
(info, dm, bitmap->rowBytes())))->unref();
bitmap->lockPixels();
return bitmap->readyToDraw();