From 1a8b79a79e8aa6d4723588fd1125cb3b08886af8 Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Tue, 31 Jan 2017 11:26:26 -0500 Subject: [PATCH] Work around GCC 4.6 issue with constructing unique_ptr from a T*. Change-Id: I74f309f56e5042ad58c7e959d5bc434de1446efa Reviewed-on: https://skia-review.googlesource.com/7793 Reviewed-by: Brian Salomon Reviewed-by: Hal Canary Commit-Queue: Brian Salomon --- src/utils/SkShadowTessellator.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/utils/SkShadowTessellator.cpp b/src/utils/SkShadowTessellator.cpp index 147ff53..fdbdf7f 100755 --- a/src/utils/SkShadowTessellator.cpp +++ b/src/utils/SkShadowTessellator.cpp @@ -25,9 +25,17 @@ public: int vertexCount() const { return fPositions.count(); } int indexCount() const { return fIndices.count(); } - UniqueArray releasePositions() { return UniqueArray(fPositions.release()); } - UniqueArray releaseColors() { return UniqueArray(fColors.release()); } - UniqueArray releaseIndices() { return UniqueArray(fIndices.release()); } + // The casts are needed to work around a, older GCC issue where the fact that the pointers are + // T* and not const T* causes calls to a deleted unique_ptr constructor. + UniqueArray releasePositions() { + return UniqueArray(static_cast(fPositions.release())); + } + UniqueArray releaseColors() { + return UniqueArray(static_cast(fColors.release())); + } + UniqueArray releaseIndices() { + return UniqueArray(static_cast(fIndices.release())); + } private: void handleLine(const SkPoint& p); @@ -367,9 +375,17 @@ public: int vertexCount() const { return fPositions.count(); } int indexCount() const { return fIndices.count(); } - UniqueArray releasePositions() { return UniqueArray(fPositions.release()); } - UniqueArray releaseColors() { return UniqueArray(fColors.release()); } - UniqueArray releaseIndices() { return UniqueArray(fIndices.release()); } + // The casts are needed to work around an older GCC issue where the fact that the pointers are + // T* and not const T* causes calls to a deleted unique_ptr constructor. + UniqueArray releasePositions() { + return UniqueArray(static_cast(fPositions.release())); + } + UniqueArray releaseColors() { + return UniqueArray(static_cast(fColors.release())); + } + UniqueArray releaseIndices() { + return UniqueArray(static_cast(fIndices.release())); + } private: void computeClipBounds(const SkPath& path); -- 2.7.4