diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ARGBImageEncoderTest.cpp | 5 | ||||
-rw-r--r-- | tests/BitmapCopyTest.cpp | 5 | ||||
-rw-r--r-- | tests/CanvasTest.cpp | 5 | ||||
-rw-r--r-- | tests/TextureCompressionTest.cpp | 5 | ||||
-rw-r--r-- | tests/Writer32Test.cpp | 11 |
5 files changed, 16 insertions, 15 deletions
diff --git a/tests/ARGBImageEncoderTest.cpp b/tests/ARGBImageEncoderTest.cpp index 4d16f4cc6d..62167f0f2a 100644 --- a/tests/ARGBImageEncoderTest.cpp +++ b/tests/ARGBImageEncoderTest.cpp @@ -10,6 +10,7 @@ #include "SkBitmap.h" #include "SkCanvas.h" #include "SkStream.h" +#include "SkTemplates.h" #include "Test.h" static SkColorType gColorTypes[] = { @@ -49,8 +50,8 @@ DEF_TEST(ARGBImageEncoder, reporter) { // Transform the bitmap. int bufferSize = bitmap.width() * bitmap.height() * 4; - SkAutoMalloc pixelBufferManager(bufferSize); - char *pixelBuffer = static_cast<char *>(pixelBufferManager.get()); + SkAutoTMalloc<char> pixelBufferManager(bufferSize); + char* pixelBuffer = pixelBufferManager.get(); SkMemoryWStream out(pixelBuffer, bufferSize); REPORTER_ASSERT(reporter, enc->encodeStream(&out, bitmap, SkImageEncoder::kDefaultQuality)); diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp index 65427ffd7b..6db63fae45 100644 --- a/tests/BitmapCopyTest.cpp +++ b/tests/BitmapCopyTest.cpp @@ -7,6 +7,7 @@ #include "SkBitmap.h" #include "SkRect.h" +#include "SkTemplates.h" #include "Test.h" static const char* boolStr(bool value) { @@ -420,8 +421,8 @@ DEF_TEST(BitmapCopy, reporter) { // raw buffer pointer. const size_t bufSize = subH * SkColorTypeMinRowBytes(src.colorType(), subW) * 2; - SkAutoMalloc autoBuf (bufSize); - uint8_t* buf = static_cast<uint8_t*>(autoBuf.get()); + SkAutoTMalloc<uint8_t> autoBuf (bufSize); + uint8_t* buf = autoBuf.get(); SkBitmap bufBm; // Attach buf to this bitmap. bool successExpected; diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp index 2ec25e4bab..87705dc7f5 100644 --- a/tests/CanvasTest.cpp +++ b/tests/CanvasTest.cpp @@ -61,6 +61,7 @@ #include "SkShader.h" #include "SkStream.h" #include "SkSurface.h" +#include "SkTemplates.h" #include "SkTDArray.h" #include "Test.h" @@ -635,8 +636,8 @@ static void test_newraster(skiatest::Reporter* reporter) { SkImageInfo info = SkImageInfo::MakeN32Premul(10, 10); const size_t minRowBytes = info.minRowBytes(); const size_t size = info.getSafeSize(minRowBytes); - SkAutoMalloc storage(size); - SkPMColor* baseAddr = static_cast<SkPMColor*>(storage.get()); + SkAutoTMalloc<SkPMColor> storage(size); + SkPMColor* baseAddr = storage.get(); sk_bzero(baseAddr, size); SkCanvas* canvas = SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes); diff --git a/tests/TextureCompressionTest.cpp b/tests/TextureCompressionTest.cpp index d2e6db209b..18afebeff2 100644 --- a/tests/TextureCompressionTest.cpp +++ b/tests/TextureCompressionTest.cpp @@ -9,6 +9,7 @@ #include "SkData.h" #include "SkEndian.h" #include "SkImageInfo.h" +#include "SkTemplates.h" #include "SkTextureCompressor.h" #include "Test.h" @@ -136,8 +137,8 @@ DEF_TEST(CompressCheckerboard, reporter) { } } - SkAutoMalloc decompMemory(kWidth*kHeight); - uint8_t* decompBuffer = reinterpret_cast<uint8_t*>(decompMemory.get()); + SkAutoTMalloc<uint8_t> decompMemory(kWidth*kHeight); + uint8_t* decompBuffer = decompMemory.get(); REPORTER_ASSERT(reporter, decompBuffer); if (nullptr == decompBuffer) { return; diff --git a/tests/Writer32Test.cpp b/tests/Writer32Test.cpp index 5849d731ef..39ae79cff6 100644 --- a/tests/Writer32Test.cpp +++ b/tests/Writer32Test.cpp @@ -144,16 +144,13 @@ static void test2(skiatest::Reporter* reporter, SkWriter32* writer) { static void testWritePad(skiatest::Reporter* reporter, SkWriter32* writer) { // Create some random data to write. - const size_t dataSize = 10<<2; - SkASSERT(SkIsAlign4(dataSize)); + const size_t dataSize = 10; - SkAutoMalloc originalData(dataSize); + SkAutoTMalloc<uint32_t> originalData(dataSize); { SkRandom rand(0); - uint32_t* ptr = static_cast<uint32_t*>(originalData.get()); - uint32_t* stop = ptr + (dataSize>>2); - while (ptr < stop) { - *ptr++ = rand.nextU(); + for (size_t i = 0; i < dataSize; i++) { + originalData[(int) i] = rand.nextU(); } // Write the random data to the writer at different lengths for |