aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkBitmapDevice.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2014-09-03 11:54:58 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-03 11:54:58 -0700
commite5ea500d4714a7d84de2bf913e81be3b65d2de68 (patch)
tree0c94feeb709b17b954f5e97fad463ec9cfc4dc18 /src/core/SkBitmapDevice.cpp
parent42b0dfeb29e993b7fd247dcecff705d3dd4cf191 (diff)
Hide fields in SkImageInfo
R=rmistry@google.com TBR=bsalomon Author: reed@google.com Review URL: https://codereview.chromium.org/536003002
Diffstat (limited to 'src/core/SkBitmapDevice.cpp')
-rw-r--r--src/core/SkBitmapDevice.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 2287864bae..2711004aef 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -70,11 +70,12 @@ SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties&
SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& origInfo,
const SkDeviceProperties* props) {
- SkImageInfo info = origInfo;
- if (!valid_for_bitmap_device(info, &info.fAlphaType)) {
+ SkAlphaType newAT = origInfo.alphaType();
+ if (!valid_for_bitmap_device(origInfo, &newAT)) {
return NULL;
}
+ const SkImageInfo info = origInfo.makeAlphaType(newAT);
SkBitmap bitmap;
if (kUnknown_SkColorType == info.colorType()) {
@@ -150,9 +151,7 @@ bool SkBitmapDevice::onWritePixels(const SkImageInfo& srcInfo, const void* srcPi
return false;
}
- SkImageInfo dstInfo = fBitmap.info();
- dstInfo.fWidth = srcInfo.width();
- dstInfo.fHeight = srcInfo.height();
+ const SkImageInfo dstInfo = fBitmap.info().makeWH(srcInfo.width(), srcInfo.height());
void* dstPixels = fBitmap.getAddr(x, y);
size_t dstRowBytes = fBitmap.rowBytes();