Work around GCC 4.6 issue with constructing unique_ptr<const T[]> from a T*.
Change-Id: I74f309f56e5042ad58c7e959d5bc434de1446efa
Reviewed-on: https://skia-review.googlesource.com/7793
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
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 @@
int vertexCount() const { return fPositions.count(); }
int indexCount() const { return fIndices.count(); }
- UniqueArray<SkPoint> releasePositions() { return UniqueArray<SkPoint>(fPositions.release()); }
- UniqueArray<SkColor> releaseColors() { return UniqueArray<SkColor>(fColors.release()); }
- UniqueArray<uint16_t> releaseIndices() { return UniqueArray<uint16_t>(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<SkPoint> releasePositions() {
+ return UniqueArray<SkPoint>(static_cast<const SkPoint*>(fPositions.release()));
+ }
+ UniqueArray<SkColor> releaseColors() {
+ return UniqueArray<SkColor>(static_cast<const SkColor*>(fColors.release()));
+ }
+ UniqueArray<uint16_t> releaseIndices() {
+ return UniqueArray<uint16_t>(static_cast<const uint16_t*>(fIndices.release()));
+ }
private:
void handleLine(const SkPoint& p);
@@ -367,9 +375,17 @@
int vertexCount() const { return fPositions.count(); }
int indexCount() const { return fIndices.count(); }
- UniqueArray<SkPoint> releasePositions() { return UniqueArray<SkPoint>(fPositions.release()); }
- UniqueArray<SkColor> releaseColors() { return UniqueArray<SkColor>(fColors.release()); }
- UniqueArray<uint16_t> releaseIndices() { return UniqueArray<uint16_t>(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<SkPoint> releasePositions() {
+ return UniqueArray<SkPoint>(static_cast<const SkPoint*>(fPositions.release()));
+ }
+ UniqueArray<SkColor> releaseColors() {
+ return UniqueArray<SkColor>(static_cast<const SkColor*>(fColors.release()));
+ }
+ UniqueArray<uint16_t> releaseIndices() {
+ return UniqueArray<uint16_t>(static_cast<const uint16_t*>(fIndices.release()));
+ }
private:
void computeClipBounds(const SkPath& path);