diff options
author | joshualitt <joshualitt@chromium.org> | 2015-07-17 06:40:29 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-17 06:40:29 -0700 |
commit | 9ec0d4342d248f0d53f527fb3e461a00eaa0c283 (patch) | |
tree | a3cc71c3fdf1e0fa399bcdaaecf909dcebf62497 /src | |
parent | 73d5de5763b4813c87e523adf2002ab48d3f4278 (diff) |
Removing GrTemplates.h
BUG=skia:
Review URL: https://codereview.chromium.org/1233923004
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/GrDrawTarget.cpp | 1 | ||||
-rw-r--r-- | src/gpu/GrFontScaler.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrInOrderCommandBuilder.cpp | 1 | ||||
-rw-r--r-- | src/gpu/GrRectBatch.cpp | 11 | ||||
-rw-r--r-- | src/gpu/GrTemplates.h | 25 | ||||
-rw-r--r-- | src/gpu/gl/GrGLGpu.cpp | 1 |
6 files changed, 5 insertions, 36 deletions
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp index e0dde04b56..37faacf383 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -20,7 +20,6 @@ #include "GrResourceProvider.h" #include "GrRenderTargetPriv.h" #include "GrSurfacePriv.h" -#include "GrTemplates.h" #include "GrTexture.h" #include "GrVertexBuffer.h" diff --git a/src/gpu/GrFontScaler.cpp b/src/gpu/GrFontScaler.cpp index 364944eef9..cc98ac58ad 100644 --- a/src/gpu/GrFontScaler.cpp +++ b/src/gpu/GrFontScaler.cpp @@ -6,8 +6,6 @@ * found in the LICENSE file. */ - -#include "GrTemplates.h" #include "GrFontScaler.h" #include "SkDescriptor.h" #include "SkDistanceFieldGen.h" diff --git a/src/gpu/GrInOrderCommandBuilder.cpp b/src/gpu/GrInOrderCommandBuilder.cpp index 5083e58d5a..6cd60822c6 100644 --- a/src/gpu/GrInOrderCommandBuilder.cpp +++ b/src/gpu/GrInOrderCommandBuilder.cpp @@ -9,7 +9,6 @@ #include "GrColor.h" #include "GrInOrderDrawBuffer.h" -#include "GrTemplates.h" #include "SkPoint.h" static bool path_fill_type_is_winding(const GrStencilSettings& pathStencilSettings) { diff --git a/src/gpu/GrRectBatch.cpp b/src/gpu/GrRectBatch.cpp index 6933dc1c57..2977fdb1ce 100644 --- a/src/gpu/GrRectBatch.cpp +++ b/src/gpu/GrRectBatch.cpp @@ -12,7 +12,6 @@ #include "GrBatchTest.h" #include "GrDefaultGeoProcFactory.h" #include "GrPrimitiveProcessor.h" -#include "GrTemplates.h" /** We always use per-vertex colors so that rects can be batched across color changes. Sometimes we have explicit local coords and sometimes not. We *could* always provide explicit local coords @@ -119,12 +118,12 @@ public: return; } - for (int i = 0; i < instanceCount; i++) { const Geometry& geom = fGeoData[i]; - intptr_t offset = GrTCast<intptr_t>(vertices) + kVerticesPerQuad * i * vertexStride; - SkPoint* positions = GrTCast<SkPoint*>(offset); + intptr_t offset = reinterpret_cast<intptr_t>(vertices) + + kVerticesPerQuad * i * vertexStride; + SkPoint* positions = reinterpret_cast<SkPoint*>(offset); positions->setRectFan(geom.fRect.fLeft, geom.fRect.fTop, geom.fRect.fRight, geom.fRect.fBottom, vertexStride); @@ -132,7 +131,7 @@ public: if (geom.fHasLocalRect) { static const int kLocalOffset = sizeof(SkPoint) + sizeof(GrColor); - SkPoint* coords = GrTCast<SkPoint*>(offset + kLocalOffset); + SkPoint* coords = reinterpret_cast<SkPoint*>(offset + kLocalOffset); coords->setRectFan(geom.fLocalRect.fLeft, geom.fLocalRect.fTop, geom.fLocalRect.fRight, geom.fLocalRect.fBottom, vertexStride); @@ -142,7 +141,7 @@ public: } static const int kColorOffset = sizeof(SkPoint); - GrColor* vertColor = GrTCast<GrColor*>(offset + kColorOffset); + GrColor* vertColor = reinterpret_cast<GrColor*>(offset + kColorOffset); for (int j = 0; j < 4; ++j) { *vertColor = geom.fColor; vertColor = (GrColor*) ((intptr_t) vertColor + vertexStride); diff --git a/src/gpu/GrTemplates.h b/src/gpu/GrTemplates.h deleted file mode 100644 index 8eab9c5ef3..0000000000 --- a/src/gpu/GrTemplates.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2010 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrTemplates_DEFINED -#define GrTemplates_DEFINED - -#include "SkTypes.h" - -/** - * Use to cast a ptr to a different type, and maintain strict-aliasing - */ -template <typename Dst, typename Src> Dst GrTCast(Src src) { - union { - Src src; - Dst dst; - } data; - data.src = src; - return data.dst; -} - -#endif diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 1a9566ae38..784a62fa27 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -14,7 +14,6 @@ #include "GrPipeline.h" #include "GrRenderTargetPriv.h" #include "GrSurfacePriv.h" -#include "GrTemplates.h" #include "GrTexturePriv.h" #include "GrTypes.h" #include "GrVertices.h" |