Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 Sk64 size; | 215 Sk64 size; |
| 216 size.setMul(SkToS32(SkBitmap::ComputeRowBytes(c, width)), height); | 216 size.setMul(SkToS32(SkBitmap::ComputeRowBytes(c, width)), height); |
| 217 return size; | 217 return size; |
| 218 } | 218 } |
| 219 | 219 |
| 220 size_t SkBitmap::ComputeSize(Config c, int width, int height) { | 220 size_t SkBitmap::ComputeSize(Config c, int width, int height) { |
| 221 Sk64 size = SkBitmap::ComputeSize64(c, width, height); | 221 Sk64 size = SkBitmap::ComputeSize64(c, width, height); |
| 222 return isPos32Bits(size) ? size.get32() : 0; | 222 return isPos32Bits(size) ? size.get32() : 0; |
| 223 } | 223 } |
| 224 | 224 |
| 225 Sk64 SkBitmap::ComputeSize64(const SkImageInfo& info) { | |
|
reed1
2013/12/17 17:38:52
Why are these in bitmap, rather than SkImageInfo?
hal.canary
2013/12/17 21:00:22
Good question. Now that I look in SkImageInfo, I
| |
| 226 return SkBitmap::ComputeSize64(SkImageInfoToBitmapConfig(info), | |
| 227 info.fWidth, info.fHeight); | |
| 228 } | |
| 229 | |
| 230 size_t SkBitmap::ComputeSize(const SkImageInfo& info) { | |
| 231 return SkBitmap::ComputeSize(SkImageInfoToBitmapConfig(info), | |
| 232 info.fWidth, info.fHeight); | |
| 233 } | |
| 234 | |
| 225 Sk64 SkBitmap::ComputeSafeSize64(Config config, | 235 Sk64 SkBitmap::ComputeSafeSize64(Config config, |
| 226 uint32_t width, | 236 uint32_t width, |
| 227 uint32_t height, | 237 uint32_t height, |
| 228 size_t rowBytes) { | 238 size_t rowBytes) { |
| 229 Sk64 safeSize; | 239 Sk64 safeSize; |
| 230 safeSize.setZero(); | 240 safeSize.setZero(); |
| 231 if (height > 0) { | 241 if (height > 0) { |
| 232 // TODO: Handle the case where the return value from | 242 // TODO: Handle the case where the return value from |
| 233 // ComputeRowBytes is more than 31 bits. | 243 // ComputeRowBytes is more than 31 bits. |
| 234 safeSize.set(SkToS32(ComputeRowBytes(config, width))); | 244 safeSize.set(SkToS32(ComputeRowBytes(config, width))); |
| (...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1711 if (NULL != uri) { | 1721 if (NULL != uri) { |
| 1712 str->appendf(" uri:\"%s\"", uri); | 1722 str->appendf(" uri:\"%s\"", uri); |
| 1713 } else { | 1723 } else { |
| 1714 str->appendf(" pixelref:%p", pr); | 1724 str->appendf(" pixelref:%p", pr); |
| 1715 } | 1725 } |
| 1716 } | 1726 } |
| 1717 | 1727 |
| 1718 str->append(")"); | 1728 str->append(")"); |
| 1719 } | 1729 } |
| 1720 #endif | 1730 #endif |
| OLD | NEW |