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

Side by Side Diff: src/core/SkDraw.cpp

Issue 1516833003: Switch SkAutoMalloc to SkAutoTMalloc to avoid cast (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Go back to patch set 3 Created 5 years 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 unified diff | Download patch
« no previous file with comments | « src/core/SkBitmap.cpp ('k') | src/effects/SkColorCubeFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #define __STDC_LIMIT_MACROS 7 #define __STDC_LIMIT_MACROS
8 8
9 #include "SkDraw.h" 9 #include "SkDraw.h"
10 #include "SkBlitter.h" 10 #include "SkBlitter.h"
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 1227
1228 mask.fFormat = SkMask::kA8_Format; 1228 mask.fFormat = SkMask::kA8_Format;
1229 mask.fRowBytes = SkAlign4(mask.fBounds.width()); 1229 mask.fRowBytes = SkAlign4(mask.fBounds.width());
1230 size_t size = mask.computeImageSize(); 1230 size_t size = mask.computeImageSize();
1231 if (0 == size) { 1231 if (0 == size) {
1232 // the mask is too big to allocated, draw nothing 1232 // the mask is too big to allocated, draw nothing
1233 return; 1233 return;
1234 } 1234 }
1235 1235
1236 // allocate (and clear) our temp buffer to hold the transformed bitmap 1236 // allocate (and clear) our temp buffer to hold the transformed bitmap
1237 SkAutoMalloc storage(size); 1237 SkAutoTMalloc<uint8_t> storage(size);
1238 mask.fImage = (uint8_t*)storage.get(); 1238 mask.fImage = storage.get();
1239 memset(mask.fImage, 0, size); 1239 memset(mask.fImage, 0, size);
1240 1240
1241 // now draw our bitmap(src) into mask(dst), transformed by the matrix 1241 // now draw our bitmap(src) into mask(dst), transformed by the matrix
1242 { 1242 {
1243 SkBitmap device; 1243 SkBitmap device;
1244 device.installPixels(SkImageInfo::MakeA8(mask.fBounds.width(), mask. fBounds.height()), 1244 device.installPixels(SkImageInfo::MakeA8(mask.fBounds.width(), mask. fBounds.height()),
1245 mask.fImage, mask.fRowBytes); 1245 mask.fImage, mask.fRowBytes);
1246 1246
1247 SkCanvas c(device); 1247 SkCanvas c(device);
1248 // need the unclipped top/left for the translate 1248 // need the unclipped top/left for the translate
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
2080 mask->fImage = SkMask::AllocImage(size); 2080 mask->fImage = SkMask::AllocImage(size);
2081 memset(mask->fImage, 0, mask->computeImageSize()); 2081 memset(mask->fImage, 0, mask->computeImageSize());
2082 } 2082 }
2083 2083
2084 if (SkMask::kJustComputeBounds_CreateMode != mode) { 2084 if (SkMask::kJustComputeBounds_CreateMode != mode) {
2085 draw_into_mask(*mask, devPath, style); 2085 draw_into_mask(*mask, devPath, style);
2086 } 2086 }
2087 2087
2088 return true; 2088 return true;
2089 } 2089 }
OLDNEW
« no previous file with comments | « src/core/SkBitmap.cpp ('k') | src/effects/SkColorCubeFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698