aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2017-01-11 12:44:43 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-11 18:55:34 +0000
commit95e3c058ef633782f7549e9e1c2727d60dbc8ee5 (patch)
tree4db526398bc87c48db4565a2046b9321b7e2ee10 /tools
parent000ca636e6de2e2b8bf9c82e3dee2d7ad8e1bed8 (diff)
SkTypes.h : move SkAutoMalloc into SkAutoMalloc.h
* SkAutoFree moved to SkTemplates.h (now implmented with unique_ptr). * SkAutoMalloc and SkAutoSMalloc moved to SkAutoMalloc.h * "SkAutoFree X(sk_malloc_throw(N));" --> "SkAutoMalloc X(N);" Revert "Revert 'SkTypes.h : move SkAutoMalloc into SkAutoMalloc.h'" This reverts commit c456b73fef9589bbdc5eb83eaa83e53c357bb3da. Change-Id: Ie2c1a17c20134b8ceab85a68b3ae3e61c24fbaab Reviewed-on: https://skia-review.googlesource.com/6886 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/SkShaper_harfbuzz.cpp7
-rw-r--r--tools/debugger/SkDrawCommand.cpp3
-rw-r--r--tools/viewer/sk_app/VulkanWindowContext.cpp1
-rw-r--r--tools/viewer/sk_app/win/RasterWindowContext_win.cpp3
4 files changed, 8 insertions, 6 deletions
diff --git a/tools/SkShaper_harfbuzz.cpp b/tools/SkShaper_harfbuzz.cpp
index 2c4d21180d..9c7d69e92d 100644
--- a/tools/SkShaper_harfbuzz.cpp
+++ b/tools/SkShaper_harfbuzz.cpp
@@ -28,10 +28,9 @@ std::unique_ptr<hb_blob_t, HBFBlobDel> stream_to_blob(std::unique_ptr<SkStreamAs
[](void* p) { delete (SkStreamAsset*)p; }));
} else {
// SkDebugf("Extra SkStreamAsset copy\n");
- SkAutoMalloc autoMalloc(size);
- asset->read(autoMalloc.get(), size);
- void* ptr = autoMalloc.get();
- blob.reset(hb_blob_create((char*)autoMalloc.release(), SkToUInt(size),
+ void* ptr = size ? sk_malloc_throw(size) : nullptr;
+ asset->read(ptr, size);
+ blob.reset(hb_blob_create((char*)ptr, SkToUInt(size),
HB_MEMORY_MODE_READONLY, ptr, sk_free));
}
SkASSERT(blob);
diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp
index 4eaf2ea84a..6dea988831 100644
--- a/tools/debugger/SkDrawCommand.cpp
+++ b/tools/debugger/SkDrawCommand.cpp
@@ -9,6 +9,7 @@
#include "png.h"
+#include "SkAutoMalloc.h"
#include "SkBlurMaskFilter.h"
#include "SkColorFilter.h"
#include "SkDashPathEffect.h"
@@ -704,7 +705,7 @@ void SkDrawCommand::WritePNG(const uint8_t* rgba, unsigned width, unsigned heigh
bool SkDrawCommand::flatten(const SkImage& image, Json::Value* target,
UrlDataManager& urlDataManager) {
size_t rowBytes = 4 * image.width();
- SkAutoFree buffer(sk_malloc_throw(rowBytes * image.height()));
+ SkAutoMalloc buffer(rowBytes * image.height());
SkImageInfo dstInfo = SkImageInfo::Make(image.width(), image.height(),
kN32_SkColorType, kPremul_SkAlphaType);
if (!image.readPixels(dstInfo, buffer.get(), rowBytes, 0, 0)) {
diff --git a/tools/viewer/sk_app/VulkanWindowContext.cpp b/tools/viewer/sk_app/VulkanWindowContext.cpp
index c8335d28b4..4802e214b4 100644
--- a/tools/viewer/sk_app/VulkanWindowContext.cpp
+++ b/tools/viewer/sk_app/VulkanWindowContext.cpp
@@ -8,6 +8,7 @@
#include "GrContext.h"
#include "GrRenderTarget.h"
+#include "SkAutoMalloc.h"
#include "SkSurface.h"
#include "VulkanWindowContext.h"
diff --git a/tools/viewer/sk_app/win/RasterWindowContext_win.cpp b/tools/viewer/sk_app/win/RasterWindowContext_win.cpp
index ca738db288..96fe8f22a9 100644
--- a/tools/viewer/sk_app/win/RasterWindowContext_win.cpp
+++ b/tools/viewer/sk_app/win/RasterWindowContext_win.cpp
@@ -5,9 +5,10 @@
* found in the LICENSE file.
*/
-#include "WindowContextFactory_win.h"
#include "../RasterWindowContext.h"
+#include "SkAutoMalloc.h"
#include "SkSurface.h"
+#include "WindowContextFactory_win.h"
#include <Windows.h>