aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/gradients/SkGradientShader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/effects/gradients/SkGradientShader.cpp')
-rw-r--r--src/effects/gradients/SkGradientShader.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 2776199346..5d200d18d3 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -513,13 +513,14 @@ const uint16_t* SkGradientShaderBase::getCache16() const {
const SkPMColor* SkGradientShaderBase::getCache32() const {
if (fCache32 == NULL) {
- // double the count for dither entries
- const int entryCount = kCache32Count * 4;
- const size_t allocSize = sizeof(SkPMColor) * entryCount;
+ SkImageInfo info;
+ info.fWidth = kCache32Count;
+ info.fHeight = 4; // for our 4 dither rows
+ info.fAlphaType = kPremul_SkAlphaType;
+ info.fColorType = kPMColor_SkColorType;
if (NULL == fCache32PixelRef) {
- fCache32PixelRef = SkNEW_ARGS(SkMallocPixelRef,
- (NULL, allocSize, NULL));
+ fCache32PixelRef = SkMallocPixelRef::NewAllocate(info, 0, NULL);
}
fCache32 = (SkPMColor*)fCache32PixelRef->getAddr();
if (fColorCount == 2) {
@@ -541,8 +542,7 @@ const SkPMColor* SkGradientShaderBase::getCache32() const {
}
if (fMapper) {
- SkMallocPixelRef* newPR = SkNEW_ARGS(SkMallocPixelRef,
- (NULL, allocSize, NULL));
+ SkMallocPixelRef* newPR = SkMallocPixelRef::NewAllocate(info, 0, NULL);
SkPMColor* linear = fCache32; // just computed linear data
SkPMColor* mapped = (SkPMColor*)newPR->getAddr(); // storage for mapped data
SkUnitMapper* map = fMapper;