aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-01-31 11:26:26 -0500
committerGravatar Hal Canary <halcanary@google.com>2017-01-31 16:42:16 +0000
commit1a8b79a79e8aa6d4723588fd1125cb3b08886af8 (patch)
treec0b23280f5c59a54fdc0e7ef2d010dd3616a4277 /src
parent10d36c54559586a2776c49d540ece409b4294e8d (diff)
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>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/utils/SkShadowTessellator.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/utils/SkShadowTessellator.cpp b/src/utils/SkShadowTessellator.cpp
index 147ff5399d..fdbdf7f245 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<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 @@ public:
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);