SK_SUPPORT_LEGACY_GRTYPES to hide duplicate types from SkTypes.h
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 28 Mar 2014 17:58:28 +0000 (17:58 +0000)
committercommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 28 Mar 2014 17:58:28 +0000 (17:58 +0000)
BUG=skia:
R=bsalomon@google.com

Author: reed@google.com

Review URL: https://codereview.chromium.org/216503004

git-svn-id: http://skia.googlecode.com/svn/trunk@13982 2bbb7eff-a529-9590-31e7-b0007b416f81

38 files changed:
gm/beziereffects.cpp
include/gpu/GrContext.h
include/gpu/GrGlyph.h
include/gpu/GrPoint.h
include/gpu/GrTexture.h
include/gpu/GrTypes.h
include/gpu/GrTypesPriv.h
src/effects/SkColorFilters.cpp
src/gpu/GrAAConvexPathRenderer.cpp
src/gpu/GrAAHairLinePathRenderer.cpp
src/gpu/GrAARectRenderer.cpp
src/gpu/GrAllocPool.cpp
src/gpu/GrAllocator.h
src/gpu/GrBitmapTextContext.cpp
src/gpu/GrBitmapTextContext.h
src/gpu/GrBufferAllocPool.cpp
src/gpu/GrContext.cpp
src/gpu/GrDefaultPathRenderer.cpp
src/gpu/GrDistanceFieldTextContext.cpp
src/gpu/GrDistanceFieldTextContext.h
src/gpu/GrDrawState.h
src/gpu/GrDrawTarget.cpp
src/gpu/GrDrawTarget.h
src/gpu/GrInOrderDrawBuffer.cpp
src/gpu/GrMemoryPool.cpp
src/gpu/GrOvalRenderer.cpp
src/gpu/GrPathUtils.cpp
src/gpu/GrPathUtils.h
src/gpu/GrRenderTarget.cpp
src/gpu/SkGpuDevice.cpp
src/gpu/effects/GrConfigConversionEffect.cpp
src/gpu/effects/GrSimpleTextureEffect.cpp
src/gpu/gl/GrGLCaps.cpp
src/gpu/gl/GrGLNoOpInterface.cpp
src/gpu/gl/GrGLPath.cpp
src/gpu/gl/GrGLSL.cpp
src/gpu/gl/GrGLStencilBuffer.cpp
src/gpu/gl/GrGpuGL.cpp

index e80853c4de1b0b8559c798ac37a075c5d07e96e7..6a9e65bdecff24b3fccc64773358142b944af7f8 100644 (file)
@@ -26,7 +26,7 @@
 namespace {
 extern const GrVertexAttrib kAttribs[] = {
     {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding},
-    {kVec4f_GrVertexAttribType, sizeof(GrPoint), kEffect_GrVertexAttribBinding}
+    {kVec4f_GrVertexAttribType, sizeof(SkPoint), kEffect_GrVertexAttribBinding}
 };
 }
 
@@ -501,7 +501,7 @@ protected:
                                                   sizeof(Vertex));
 
                     GrPathUtils::QuadUVMatrix DevToUV(pts);
-                    DevToUV.apply<4, sizeof(Vertex), sizeof(GrPoint)>(verts);
+                    DevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts);
 
                     GrTestTarget tt;
                     context->getTestTarget(&tt);
index d2a3ada9d688a4cafdb42dd80dde2e907319ec9a..e8ce27f580c453cf7794cfa3f737aee3d3e25145 100644 (file)
@@ -488,8 +488,8 @@ public:
     void drawVertices(const GrPaint& paint,
                       GrPrimitiveType primitiveType,
                       int vertexCount,
-                      const GrPoint positions[],
-                      const GrPoint texs[],
+                      const SkPoint positions[],
+                      const SkPoint texs[],
                       const GrColor colors[],
                       const uint16_t indices[],
                       int indexCount);
index fe4c835773c3865ddb61a633795a7f0732ab9bca..6de0c57d985cda57dff6372a8457e39ea5044967 100644 (file)
@@ -50,22 +50,22 @@ struct GrGlyph {
 
     ///////////////////////////////////////////////////////////////////////////
 
-    static inline unsigned ExtractSubPixelBitsFromFixed(GrFixed pos) {
+    static inline unsigned ExtractSubPixelBitsFromFixed(SkFixed pos) {
         // two most significant fraction bits from fixed-point
         return (pos >> 14) & 3;
     }
 
-    static inline PackedID Pack(uint16_t glyphID, GrFixed x, GrFixed y) {
+    static inline PackedID Pack(uint16_t glyphID, SkFixed x, SkFixed y) {
         x = ExtractSubPixelBitsFromFixed(x);
         y = ExtractSubPixelBitsFromFixed(y);
         return (x << 18) | (y << 16) | glyphID;
     }
 
-    static inline GrFixed UnpackFixedX(PackedID packed) {
+    static inline SkFixed UnpackFixedX(PackedID packed) {
         return ((packed >> 18) & 3) << 14;
     }
 
-    static inline GrFixed UnpackFixedY(PackedID packed) {
+    static inline SkFixed UnpackFixedY(PackedID packed) {
         return ((packed >> 16) & 3) << 14;
     }
 
index c987b01134286d309a81e16ae5d3e031eaba8cd3..7be5736f563b6fe544ab02222e7927dc40dba0c8 100644 (file)
 #include "SkScalar.h"
 #include "SkPoint.h"
 
+#if 0
 #define GrPoint     SkPoint
 #define GrVec       SkVector
+#endif
 
 struct GrIPoint16 {
     int16_t fX, fY;
 
     void set(intptr_t x, intptr_t y) {
-        fX = GrToS16(x);
-        fY = GrToS16(y);
+        fX = SkToS16(x);
+        fY = SkToS16(y);
     }
 };
 
index e56f6f401c000161b4e32d22b2019182ab576e66..1df9dc6e0d4d1b2bdaf7d6d70302a9331943e9f2 100644 (file)
@@ -99,11 +99,11 @@ public:
      * Convert from texels to normalized texture coords for POT textures
      * only.
      */
-    GrFixed normalizeFixedX(GrFixed x) const {
+    SkFixed normalizeFixedX(SkFixed x) const {
         SkASSERT(GrIsPow2(fDesc.fWidth));
         return x >> fShiftFixedX;
     }
-    GrFixed normalizeFixedY(GrFixed y) const {
+    SkFixed normalizeFixedY(SkFixed y) const {
         SkASSERT(GrIsPow2(fDesc.fHeight));
         return y >> fShiftFixedY;
     }
index 0bb432d663c51eda8bfa7a91c2a2fa33e52f2827..c1b3554c6e008eb322d18838618a53cbeeb54495 100644 (file)
@@ -15,6 +15,8 @@
 #include "GrConfig.h"
 #include "SkMath.h"
 
+//#define SK_SUPPORT_LEGACY_GRTYPES
+
 ////////////////////////////////////////////////////////////////////////////////
 
 /**
@@ -50,6 +52,7 @@
     friend X operator & (X a, T b); \
 ////////////////////////////////////////////////////////////////////////////////
 
+#ifdef SK_SUPPORT_LEGACY_GRTYPES
 
 /**
  *  Macro to round n up to the next multiple of 4, or return it unchanged if
@@ -66,6 +69,31 @@ template <typename T> const T& GrMax(const T& a, const T& b) {
     return (b < a) ? a : b;
 }
 
+/**
+ *  Count elements in an array
+ */
+#define GR_ARRAY_COUNT(array)  SK_ARRAY_COUNT(array)
+
+/**
+ *  16.16 fixed point type
+ */
+typedef int32_t GrFixed;
+
+#ifdef SK_DEBUG
+
+static inline int16_t GrToS16(intptr_t x) {
+    SkASSERT((int16_t)x == x);
+    return (int16_t)x;
+}
+
+#else
+
+#define GrToS16(x)  x
+
+#endif
+
+#endif
+
 // compile time versions of min/max
 #define GR_CT_MAX(a, b) (((b) < (a)) ? (a) : (b))
 #define GR_CT_MIN(a, b) (((b) < (a)) ? (b) : (a))
@@ -120,11 +148,6 @@ static inline size_t GrSizeAlignDown(size_t x, uint32_t alignment) {
     return (x / alignment) * alignment;
 }
 
-/**
- *  Count elements in an array
- */
-#define GR_ARRAY_COUNT(array)  SK_ARRAY_COUNT(array)
-
 ///////////////////////////////////////////////////////////////////////////////
 
 /**
@@ -146,27 +169,6 @@ static inline int GrNextPow2(int n) {
     return n ? (1 << (32 - SkCLZ(n - 1))) : 1;
 }
 
-///////////////////////////////////////////////////////////////////////////////
-
-/**
- *  16.16 fixed point type
- */
-typedef int32_t GrFixed;
-
-#ifdef SK_DEBUG
-
-static inline int16_t GrToS16(intptr_t x) {
-    SkASSERT((int16_t)x == x);
-    return (int16_t)x;
-}
-
-#else
-
-#define GrToS16(x)  x
-
-#endif
-
-
 ///////////////////////////////////////////////////////////////////////////////
 
 /**
index 5a220459fd8c1c8da4ace74750458c02484747ef..f09f95d9185c456b95151d01af272691c6c4e19b 100644 (file)
@@ -45,7 +45,7 @@ static inline int GrSLTypeVectorCount(GrSLType type) {
     GR_STATIC_ASSERT(5 == kMat33f_GrSLType);
     GR_STATIC_ASSERT(6 == kMat44f_GrSLType);
     GR_STATIC_ASSERT(7 == kSampler2D_GrSLType);
-    GR_STATIC_ASSERT(GR_ARRAY_COUNT(kCounts) == kGrSLTypeCount);
+    GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrSLTypeCount);
 }
 
 /** Return the type enum for a vector of floats of length n (1..4),
@@ -89,7 +89,7 @@ static inline int GrVertexAttribTypeVectorCount(GrVertexAttribType type) {
     GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType);
     GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType);
     GR_STATIC_ASSERT(4 == kVec4ub_GrVertexAttribType);
-    GR_STATIC_ASSERT(GR_ARRAY_COUNT(kCounts) == kGrVertexAttribTypeCount);
+    GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrVertexAttribTypeCount);
 }
 
 /**
@@ -111,7 +111,7 @@ static inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) {
     GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType);
     GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType);
     GR_STATIC_ASSERT(4 == kVec4ub_GrVertexAttribType);
-    GR_STATIC_ASSERT(GR_ARRAY_COUNT(kSizes) == kGrVertexAttribTypeCount);
+    GR_STATIC_ASSERT(SK_ARRAY_COUNT(kSizes) == kGrVertexAttribTypeCount);
 }
 
 /**
index a048abca6b96454186ac9b0e48d68baa99121185..65766c1fc850a9a43da6f8159b72a8180717b64e 100644 (file)
@@ -305,7 +305,7 @@ namespace {
  * to which direction the 0.5 goes.
  */
 static inline int color_component_to_int(float value) {
-    return sk_float_round2int(GrMax(0.f, GrMin(1.f, value)) * 255.f);
+    return sk_float_round2int(SkTMax(0.f, SkTMin(1.f, value)) * 255.f);
 }
 
 /** MaskedColorExpr is used to evaluate the color and valid color component flags through the
index 3e1af80485308832d7c3b2bd6dae78047fe55112..2af5bb2e43f2589b93836a5db3e13d61feee46cc 100644 (file)
@@ -35,12 +35,12 @@ struct Segment {
     } fType;
 
     // line uses one pt, quad uses 2 pts
-    GrPoint fPts[2];
+    SkPoint fPts[2];
     // normal to edge ending at each pt
-    GrVec fNorms[2];
+    SkVector fNorms[2];
     // is the corner where the previous segment meets this segment
     // sharp. If so, fMid is a normalized bisector facing outward.
-    GrVec fMid;
+    SkVector fMid;
 
     int countPoints() {
         GR_STATIC_ASSERT(0 == kLine && 1 == kQuad);
@@ -118,11 +118,11 @@ static void compute_vectors(SegmentArray* segments,
     int count = segments->count();
 
     // Make the normals point towards the outside
-    GrPoint::Side normSide;
+    SkPoint::Side normSide;
     if (dir == SkPath::kCCW_Direction) {
-        normSide = GrPoint::kRight_Side;
+        normSide = SkPoint::kRight_Side;
     } else {
-        normSide = GrPoint::kLeft_Side;
+        normSide = SkPoint::kLeft_Side;
     }
 
     *vCount = 0;
@@ -133,7 +133,7 @@ static void compute_vectors(SegmentArray* segments,
         int b = (a + 1) % count;
         Segment& segb = (*segments)[b];
 
-        const GrPoint* prevPt = &sega.endPt();
+        const SkPoint* prevPt = &sega.endPt();
         int n = segb.countPoints();
         for (int p = 0; p < n; ++p) {
             segb.fNorms[p] = segb.fPts[p] - *prevPt;
@@ -173,15 +173,15 @@ struct DegenerateTestData {
         kLine,
         kNonDegenerate
     }           fStage;
-    GrPoint     fFirstPoint;
-    GrVec       fLineNormal;
+    SkPoint     fFirstPoint;
+    SkVector    fLineNormal;
     SkScalar    fLineC;
 };
 
 static const SkScalar kClose = (SK_Scalar1 / 16);
 static const SkScalar kCloseSqd = SkScalarMul(kClose, kClose);
 
-static void update_degenerate_test(DegenerateTestData* data, const GrPoint& pt) {
+static void update_degenerate_test(DegenerateTestData* data, const SkPoint& pt) {
     switch (data->fStage) {
         case DegenerateTestData::kInitial:
             data->fFirstPoint = pt;
@@ -288,7 +288,7 @@ static bool get_segments(const SkPath& path,
     }
 
     for (;;) {
-        GrPoint pts[4];
+        SkPoint pts[4];
         SkPath::Verb verb = iter.next(pts);
         switch (verb) {
             case SkPath::kMove_Verb:
@@ -330,8 +330,8 @@ static bool get_segments(const SkPath& path,
 }
 
 struct QuadVertex {
-    GrPoint  fPos;
-    GrPoint  fUV;
+    SkPoint  fPos;
+    SkPoint  fUV;
     SkScalar fD0;
     SkScalar fD1;
 };
@@ -439,9 +439,9 @@ static void create_vertices(const SegmentArray&  segments,
             *v += 5;
             *i += 9;
         } else {
-            GrPoint qpts[] = {sega.endPt(), segb.fPts[0], segb.fPts[1]};
+            SkPoint qpts[] = {sega.endPt(), segb.fPts[0], segb.fPts[1]};
 
-            GrVec midVec = segb.fNorms[0] + segb.fNorms[1];
+            SkVector midVec = segb.fNorms[0] + segb.fNorms[1];
             midVec.normalize();
 
             verts[*v + 0].fPos = fanPt;
@@ -468,7 +468,7 @@ static void create_vertices(const SegmentArray&  segments,
             verts[*v + 5].fD1 = -SK_ScalarMax/100;
 
             GrPathUtils::QuadUVMatrix toUV(qpts);
-            toUV.apply<6, sizeof(QuadVertex), sizeof(GrPoint)>(verts + *v);
+            toUV.apply<6, sizeof(QuadVertex), sizeof(SkPoint)>(verts + *v);
 
             idxs[*i + 0] = *v + 3;
             idxs[*i + 1] = *v + 1;
@@ -618,7 +618,7 @@ namespace {
 // position + edge
 extern const GrVertexAttrib gPathAttribs[] = {
     {kVec2f_GrVertexAttribType, 0,               kPosition_GrVertexAttribBinding},
-    {kVec4f_GrVertexAttribType, sizeof(GrPoint), kEffect_GrVertexAttribBinding}
+    {kVec4f_GrVertexAttribType, sizeof(SkPoint), kEffect_GrVertexAttribBinding}
 };
 
 };
index 60be5be9079e0e19b7760d166c72b55acf8cd773..864fa6851be57ede1037612729807022f2b217fe 100644 (file)
@@ -302,7 +302,7 @@ int num_quad_subdivs(const SkPoint p[3]) {
 
         // +1 since we're ignoring the mantissa contribution.
         int log = get_float_exp(dsqd/(gSubdivTol*gSubdivTol)) + 1;
-        log = GrMin(GrMax(0, log), kMaxSub);
+        log = SkTMin(SkTMax(0, log), kMaxSub);
         return log;
     }
 }
@@ -333,8 +333,8 @@ int generate_lines_and_quads(const SkPath& path,
     bool persp = m.hasPerspective();
 
     for (;;) {
-        GrPoint pathPts[4];
-        GrPoint devPts[4];
+        SkPoint pathPts[4];
+        SkPoint devPts[4];
         SkPath::Verb verb = iter.next(pathPts);
         switch (verb) {
             case SkPath::kConic_Verb: {
@@ -486,26 +486,26 @@ int generate_lines_and_quads(const SkPath& path,
 }
 
 struct LineVertex {
-    GrPoint fPos;
+    SkPoint fPos;
     GrColor fCoverage;
 };
 
 struct BezierVertex {
-    GrPoint fPos;
+    SkPoint fPos;
     union {
         struct {
             SkScalar fK;
             SkScalar fL;
             SkScalar fM;
         } fConic;
-        GrVec   fQuadCoord;
+        SkVector   fQuadCoord;
         struct {
             SkScalar fBogus[4];
         };
     };
 };
 
-GR_STATIC_ASSERT(sizeof(BezierVertex) == 3 * sizeof(GrPoint));
+GR_STATIC_ASSERT(sizeof(BezierVertex) == 3 * sizeof(SkPoint));
 
 void intersect_lines(const SkPoint& ptA, const SkVector& normA,
                      const SkPoint& ptB, const SkVector& normB,
@@ -528,7 +528,7 @@ void intersect_lines(const SkPoint& ptA, const SkVector& normA,
 void set_uv_quad(const SkPoint qpts[3], BezierVertex verts[kVertsPerQuad]) {
     // this should be in the src space, not dev coords, when we have perspective
     GrPathUtils::QuadUVMatrix DevToUV(qpts);
-    DevToUV.apply<kVertsPerQuad, sizeof(BezierVertex), sizeof(GrPoint)>(verts);
+    DevToUV.apply<kVertsPerQuad, sizeof(BezierVertex), sizeof(SkPoint)>(verts);
 }
 
 void bloat_quad(const SkPoint qpts[3], const SkMatrix* toDevice,
@@ -708,13 +708,13 @@ namespace {
 // position + edge
 extern const GrVertexAttrib gHairlineBezierAttribs[] = {
     {kVec2f_GrVertexAttribType, 0,                  kPosition_GrVertexAttribBinding},
-    {kVec4f_GrVertexAttribType, sizeof(GrPoint),    kEffect_GrVertexAttribBinding}
+    {kVec4f_GrVertexAttribType, sizeof(SkPoint),    kEffect_GrVertexAttribBinding}
 };
 
 // position + coverage
 extern const GrVertexAttrib gHairlineLineAttribs[] = {
     {kVec2f_GrVertexAttribType,  0,               kPosition_GrVertexAttribBinding},
-    {kVec4ub_GrVertexAttribType, sizeof(GrPoint), kCoverage_GrVertexAttribBinding},
+    {kVec4ub_GrVertexAttribType, sizeof(SkPoint), kCoverage_GrVertexAttribBinding},
 };
 
 };
@@ -949,7 +949,7 @@ bool GrAAHairLinePathRenderer::onDrawPath(const SkPath& path,
             target->setIndexSourceToBuffer(fLinesIndexBuffer);
             int lines = 0;
             while (lines < lineCnt) {
-                int n = GrMin(lineCnt - lines, kNumLineSegsInIdxBuffer);
+                int n = SkTMin(lineCnt - lines, kNumLineSegsInIdxBuffer);
                 target->drawIndexed(kTriangles_GrPrimitiveType,
                                     kVertsPerLineSeg*lines,     // startV
                                     0,                          // startI
@@ -1005,7 +1005,7 @@ bool GrAAHairLinePathRenderer::onDrawPath(const SkPath& path,
             drawState->addCoverageEffect(hairQuadEffect, kEdgeAttrIndex)->unref();
             int quads = 0;
             while (quads < quadCnt) {
-                int n = GrMin(quadCnt - quads, kNumQuadsInIdxBuffer);
+                int n = SkTMin(quadCnt - quads, kNumQuadsInIdxBuffer);
                 target->drawIndexed(kTriangles_GrPrimitiveType,
                                     kVertsPerQuad*quads,               // startV
                                     0,                                 // startI
@@ -1024,7 +1024,7 @@ bool GrAAHairLinePathRenderer::onDrawPath(const SkPath& path,
             drawState->addCoverageEffect(hairConicEffect, 1, 2)->unref();
             int conics = 0;
             while (conics < conicCnt) {
-                int n = GrMin(conicCnt - conics, kNumQuadsInIdxBuffer);
+                int n = SkTMin(conicCnt - conics, kNumQuadsInIdxBuffer);
                 target->drawIndexed(kTriangles_GrPrimitiveType,
                                     kVertsPerQuad*(quadCnt + conics),  // startV
                                     0,                                 // startI
index 2c21f09f00043c1cc139b1b3533fddcfe2b2c4e5..d23041f236113d61a60fffc06f4878e06e121d5a 100644 (file)
@@ -261,12 +261,12 @@ namespace {
 
 extern const GrVertexAttrib gAARectCoverageAttribs[] = {
     {kVec2f_GrVertexAttribType,  0,               kPosition_GrVertexAttribBinding},
-    {kVec4ub_GrVertexAttribType, sizeof(GrPoint), kCoverage_GrVertexAttribBinding},
+    {kVec4ub_GrVertexAttribType, sizeof(SkPoint), kCoverage_GrVertexAttribBinding},
 };
 
 extern const GrVertexAttrib gAARectColorAttribs[] = {
     {kVec2f_GrVertexAttribType,  0,               kPosition_GrVertexAttribBinding},
-    {kVec4ub_GrVertexAttribType, sizeof(GrPoint), kColor_GrVertexAttribBinding},
+    {kVec4ub_GrVertexAttribType, sizeof(SkPoint), kColor_GrVertexAttribBinding},
 };
 
 static void set_aa_rect_vertex_attributes(GrDrawState* drawState, bool useCoverage) {
@@ -277,7 +277,7 @@ static void set_aa_rect_vertex_attributes(GrDrawState* drawState, bool useCovera
     }
 }
 
-static void set_inset_fan(GrPoint* pts, size_t stride,
+static void set_inset_fan(SkPoint* pts, size_t stride,
                           const SkRect& r, SkScalar dx, SkScalar dy) {
     pts->setRectFan(r.fLeft + dx, r.fTop + dy,
                     r.fRight - dx, r.fBottom - dy, stride);
@@ -299,7 +299,7 @@ static const uint16_t gFillAARectIdx[] = {
     4, 5, 6, 6, 7, 4,
 };
 
-static const int kIndicesPerAAFillRect = GR_ARRAY_COUNT(gFillAARectIdx);
+static const int kIndicesPerAAFillRect = SK_ARRAY_COUNT(gFillAARectIdx);
 static const int kVertsPerAAFillRect = 8;
 static const int kNumAAFillRectsInIndexBuffer = 256;
 
@@ -414,8 +414,8 @@ static const uint16_t gBevelStrokeAARectIdx[] = {
 };
 
 int GrAARectRenderer::aaStrokeRectIndexCount(bool miterStroke) {
-    return miterStroke ? GR_ARRAY_COUNT(gMiterStrokeAARectIdx) :
-                         GR_ARRAY_COUNT(gBevelStrokeAARectIdx);
+    return miterStroke ? SK_ARRAY_COUNT(gMiterStrokeAARectIdx) :
+                         SK_ARRAY_COUNT(gBevelStrokeAARectIdx);
 }
 
 GrIndexBuffer* GrAARectRenderer::aaStrokeRectIndexBuffer(GrGpu* gpu, bool miterStroke) {
@@ -474,10 +474,10 @@ void GrAARectRenderer::geometryFillAARect(GrGpu* gpu,
 
     intptr_t verts = reinterpret_cast<intptr_t>(geo.vertices());
     size_t vsize = drawState->getVertexSize();
-    SkASSERT(sizeof(GrPoint) + sizeof(GrColor) == vsize);
+    SkASSERT(sizeof(SkPoint) + sizeof(GrColor) == vsize);
 
-    GrPoint* fan0Pos = reinterpret_cast<GrPoint*>(verts);
-    GrPoint* fan1Pos = reinterpret_cast<GrPoint*>(verts + 4 * vsize);
+    SkPoint* fan0Pos = reinterpret_cast<SkPoint*>(verts);
+    SkPoint* fan1Pos = reinterpret_cast<SkPoint*>(verts + 4 * vsize);
 
     SkScalar inset = SkMinScalar(devRect.width(), SK_Scalar1);
     inset = SK_ScalarHalf * SkMinScalar(inset, devRect.height());
@@ -531,7 +531,7 @@ void GrAARectRenderer::geometryFillAARect(GrGpu* gpu,
         *((SkPoint*)((intptr_t)fan0Pos + 3 * vsize)) += vec[0] - vec[1];
     }
 
-    verts += sizeof(GrPoint);
+    verts += sizeof(SkPoint);
     for (int i = 0; i < 4; ++i) {
         *reinterpret_cast<GrColor*>(verts + i * vsize) = 0;
     }
@@ -571,30 +571,30 @@ namespace {
 
 // Rotated
 struct RectVertex {
-    GrPoint fPos;
-    GrPoint fCenter;
-    GrPoint fDir;
-    GrPoint fWidthHeight;
+    SkPoint fPos;
+    SkPoint fCenter;
+    SkPoint fDir;
+    SkPoint fWidthHeight;
 };
 
 // Rotated
 extern const GrVertexAttrib gAARectVertexAttribs[] = {
     { kVec2f_GrVertexAttribType, 0,                 kPosition_GrVertexAttribBinding },
-    { kVec4f_GrVertexAttribType, sizeof(GrPoint),   kEffect_GrVertexAttribBinding },
-    { kVec2f_GrVertexAttribType, 3*sizeof(GrPoint), kEffect_GrVertexAttribBinding }
+    { kVec4f_GrVertexAttribType, sizeof(SkPoint),   kEffect_GrVertexAttribBinding },
+    { kVec2f_GrVertexAttribType, 3*sizeof(SkPoint), kEffect_GrVertexAttribBinding }
 };
 
 // Axis Aligned
 struct AARectVertex {
-    GrPoint fPos;
-    GrPoint fOffset;
-    GrPoint fWidthHeight;
+    SkPoint fPos;
+    SkPoint fOffset;
+    SkPoint fWidthHeight;
 };
 
 // Axis Aligned
 extern const GrVertexAttrib gAAAARectVertexAttribs[] = {
     { kVec2f_GrVertexAttribType, 0,                 kPosition_GrVertexAttribBinding },
-    { kVec4f_GrVertexAttribType, sizeof(GrPoint),   kEffect_GrVertexAttribBinding },
+    { kVec4f_GrVertexAttribType, sizeof(SkPoint),   kEffect_GrVertexAttribBinding },
 };
 
 };
@@ -695,7 +695,7 @@ void GrAARectRenderer::shaderFillAlignedAARect(GrGpu* gpu,
         devRect.fBottom + SK_ScalarHalf
     };
 
-    GrPoint widthHeight = {
+    SkPoint widthHeight = {
         SkScalarHalf(devRect.width()) + SK_ScalarHalf,
         SkScalarHalf(devRect.height()) + SK_ScalarHalf
     };
@@ -728,7 +728,7 @@ void GrAARectRenderer::strokeAARect(GrGpu* gpu,
                                     const SkRect& devRect,
                                     const SkStrokeRec* stroke,
                                     bool useVertexCoverage) {
-    GrVec devStrokeSize;
+    SkVector devStrokeSize;
     SkScalar width = stroke->getWidth();
     if (width > 0) {
         devStrokeSize.set(width, width);
@@ -755,7 +755,7 @@ void GrAARectRenderer::strokeAARect(GrGpu* gpu,
     {
         SkScalar w = devRect.width() - dx;
         SkScalar h = devRect.height() - dy;
-        spare = GrMin(w, h);
+        spare = SkTMin(w, h);
     }
 
     SkRect devOutside(devRect);
@@ -818,15 +818,15 @@ void GrAARectRenderer::geometryStrokeAARect(GrGpu* gpu,
 
     intptr_t verts = reinterpret_cast<intptr_t>(geo.vertices());
     size_t vsize = drawState->getVertexSize();
-    SkASSERT(sizeof(GrPoint) + sizeof(GrColor) == vsize);
+    SkASSERT(sizeof(SkPoint) + sizeof(GrColor) == vsize);
 
     // We create vertices for four nested rectangles. There are two ramps from 0 to full
     // coverage, one on the exterior of the stroke and the other on the interior.
     // The following pointers refer to the four rects, from outermost to innermost.
-    GrPoint* fan0Pos = reinterpret_cast<GrPoint*>(verts);
-    GrPoint* fan1Pos = reinterpret_cast<GrPoint*>(verts + outerVertexNum * vsize);
-    GrPoint* fan2Pos = reinterpret_cast<GrPoint*>(verts + 2 * outerVertexNum * vsize);
-    GrPoint* fan3Pos = reinterpret_cast<GrPoint*>(verts + (2 * outerVertexNum + innerVertexNum) * vsize);
+    SkPoint* fan0Pos = reinterpret_cast<SkPoint*>(verts);
+    SkPoint* fan1Pos = reinterpret_cast<SkPoint*>(verts + outerVertexNum * vsize);
+    SkPoint* fan2Pos = reinterpret_cast<SkPoint*>(verts + 2 * outerVertexNum * vsize);
+    SkPoint* fan3Pos = reinterpret_cast<SkPoint*>(verts + (2 * outerVertexNum + innerVertexNum) * vsize);
 
 #ifndef SK_IGNORE_THIN_STROKED_RECT_FIX
     // TODO: this only really works if the X & Y margins are the same all around
@@ -853,8 +853,8 @@ void GrAARectRenderer::geometryStrokeAARect(GrGpu* gpu,
         // innermost
         set_inset_fan(fan3Pos, vsize, devInside,   SK_ScalarHalf,  SK_ScalarHalf);
     } else {
-        GrPoint* fan0AssistPos = reinterpret_cast<GrPoint*>(verts + 4 * vsize);
-        GrPoint* fan1AssistPos = reinterpret_cast<GrPoint*>(verts + (outerVertexNum + 4) * vsize);
+        SkPoint* fan0AssistPos = reinterpret_cast<SkPoint*>(verts + 4 * vsize);
+        SkPoint* fan1AssistPos = reinterpret_cast<SkPoint*>(verts + (outerVertexNum + 4) * vsize);
         // outermost
         set_inset_fan(fan0Pos, vsize, devOutside, -SK_ScalarHalf, -SK_ScalarHalf);
         set_inset_fan(fan0AssistPos, vsize, devOutsideAssist, -SK_ScalarHalf, -SK_ScalarHalf);
@@ -868,7 +868,7 @@ void GrAARectRenderer::geometryStrokeAARect(GrGpu* gpu,
     }
 
     // The outermost rect has 0 coverage
-    verts += sizeof(GrPoint);
+    verts += sizeof(SkPoint);
     for (int i = 0; i < outerVertexNum; ++i) {
         *reinterpret_cast<GrColor*>(verts + i * vsize) = 0;
     }
index d7b553176d8eb4eee947a33021110a4e685b9c93..c92ebbd121a3740b973c8b6a0ccdb7672edfc88d 100644 (file)
@@ -42,7 +42,7 @@ struct GrAllocPool::Block {
 
     size_t release(size_t bytes) {
         SkASSERT(bytes > 0);
-        size_t free = GrMin(bytes, fBytesTotal - fBytesFree);
+        size_t free = SkTMin(bytes, fBytesTotal - fBytesFree);
         fBytesFree += free;
         fPtr -= free;
         return bytes - free;
@@ -55,7 +55,7 @@ struct GrAllocPool::Block {
 
 GrAllocPool::GrAllocPool(size_t blockSize) {
     fBlock = NULL;
-    fMinBlockSize = GrMax(blockSize, GrAllocPool_MIN_BLOCK_SIZE);
+    fMinBlockSize = SkTMax(blockSize, GrAllocPool_MIN_BLOCK_SIZE);
     SkDEBUGCODE(fBlocksAllocated = 0;)
 }
 
@@ -80,7 +80,7 @@ void* GrAllocPool::alloc(size_t size) {
     this->validate();
 
     if (!fBlock || !fBlock->canAlloc(size)) {
-        size_t blockSize = GrMax(fMinBlockSize, size);
+        size_t blockSize = SkTMax(fMinBlockSize, size);
         fBlock = Block::Create(blockSize, fBlock);
         SkDEBUGCODE(fBlocksAllocated += 1;)
     }
index f2afec8e46787724d3bf53d561d1cd3191925b71..4e47fb16076b8edfebf0b229b6fe05578a319a05 100644 (file)
@@ -80,7 +80,7 @@ public:
      * removes all added items
      */
     void reset() {
-        int blockCount = GrMax((unsigned)1,
+        int blockCount = SkTMax((unsigned)1,
                                GrUIDivRoundUp(fCount, fItemsPerBlock));
         for (int i = 1; i < blockCount; ++i) {
             sk_free(fBlocks[i]);
index 3683e97201889c55a39bfc6448c4c2a9b73b70fa..3b5e27a90cc173e4e82c77c299b70125e2033721 100755 (executable)
@@ -69,7 +69,7 @@ void GrBitmapTextContext::flushGlyphs() {
 
     if (fCurrVertex > 0) {
         // setup our sampler state for our text texture/atlas
-        SkASSERT(GrIsALIGN4(fCurrVertex));
+        SkASSERT(SkIsAlign4(fCurrVertex));
         SkASSERT(fCurrTexture);
         GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kNone_FilterMode);
 
@@ -475,13 +475,13 @@ namespace {
 // position + texture coord
 extern const GrVertexAttrib gTextVertexAttribs[] = {
     {kVec2f_GrVertexAttribType, 0,               kPosition_GrVertexAttribBinding},
-    {kVec2f_GrVertexAttribType, sizeof(GrPoint), kEffect_GrVertexAttribBinding}
+    {kVec2f_GrVertexAttribType, sizeof(SkPoint), kEffect_GrVertexAttribBinding}
 };
 
 };
 
 void GrBitmapTextContext::drawPackedGlyph(GrGlyph::PackedID packed,
-                                          GrFixed vx, GrFixed vy,
+                                          SkFixed vx, SkFixed vy,
                                           GrFontScaler* scaler) {
     if (NULL == fDrawTarget) {
         return;
@@ -500,8 +500,8 @@ void GrBitmapTextContext::drawPackedGlyph(GrGlyph::PackedID packed,
     vy += SkIntToFixed(glyph->fBounds.fTop);
 
     // keep them as ints until we've done the clip-test
-    GrFixed width = glyph->fBounds.width();
-    GrFixed height = glyph->fBounds.height();
+    SkFixed width = glyph->fBounds.width();
+    SkFixed height = glyph->fBounds.height();
 
     // check if we clipped out
     if (true || NULL == glyph->fPlot) {
@@ -608,11 +608,11 @@ HAS_ATLAS:
                                                                GrTCast<void**>(&fVertices),
                                                                NULL);
         GrAlwaysAssert(success);
-        SkASSERT(2*sizeof(GrPoint) == fDrawTarget->getDrawState().getVertexSize());
+        SkASSERT(2*sizeof(SkPoint) == fDrawTarget->getDrawState().getVertexSize());
     }
 
-    GrFixed tx = SkIntToFixed(glyph->fAtlasLocation.fX);
-    GrFixed ty = SkIntToFixed(glyph->fAtlasLocation.fY);
+    SkFixed tx = SkIntToFixed(glyph->fAtlasLocation.fX);
+    SkFixed ty = SkIntToFixed(glyph->fAtlasLocation.fY);
 
     SkRect r;
     r.fLeft = SkFixedToFloat(vx);
index 41229398492656f5cf86c1d95e136f5a7e09fe23..18f5cc0eef9b4ec5a2b41522ee8f8b82989b36cd 100644 (file)
@@ -33,7 +33,7 @@ private:
     GrTextStrike*          fStrike;
 
     void init(const GrPaint&, const SkPaint&);
-    void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontScaler*);
+    void drawPackedGlyph(GrGlyph::PackedID, SkFixed left, SkFixed top, GrFontScaler*);
     void flushGlyphs();                 // automatically called by destructor
     void finish();
 
index b34fe8a8e34b2ce7aa0c7e7fb2e3f2f4d760734a..2dbf3eb283fb37ae40b1f6a54e08267d5e7e0048 100644 (file)
@@ -28,7 +28,7 @@ GrBufferAllocPool::GrBufferAllocPool(GrGpu* gpu,
                                      bool frequentResetHint,
                                      size_t blockSize,
                                      int preallocBufferCnt) :
-        fBlocks(GrMax(8, 2*preallocBufferCnt)) {
+        fBlocks(SkTMax(8, 2*preallocBufferCnt)) {
 
     SkASSERT(NULL != gpu);
     fGpu = gpu;
@@ -38,7 +38,7 @@ GrBufferAllocPool::GrBufferAllocPool(GrGpu* gpu,
     fBufferType = bufferType;
     fFrequentResetHint = frequentResetHint;
     fBufferPtr = NULL;
-    fMinBlockSize = GrMax(GrBufferAllocPool_MIN_BLOCK_SIZE, blockSize);
+    fMinBlockSize = SkTMax(GrBufferAllocPool_MIN_BLOCK_SIZE, blockSize);
 
     fBytesInUse = 0;
 
@@ -258,7 +258,7 @@ void GrBufferAllocPool::putBack(size_t bytes) {
 
 bool GrBufferAllocPool::createBlock(size_t requestSize) {
 
-    size_t size = GrMax(requestSize, fMinBlockSize);
+    size_t size = SkTMax(requestSize, fMinBlockSize);
     SkASSERT(size >= GrBufferAllocPool_MIN_BLOCK_SIZE);
 
     VALIDATE();
index c26327eecfe373b6b7ba3e412887e25ba59e542b..c2f62d8d00bbaa5a3d9a7b4999aef3c3cf4276f4 100644 (file)
@@ -270,14 +270,14 @@ static void stretchImage(void* dst,
                          int srcW,
                          int srcH,
                          size_t bpp) {
-    GrFixed dx = (srcW << 16) / dstW;
-    GrFixed dy = (srcH << 16) / dstH;
+    SkFixed dx = (srcW << 16) / dstW;
+    SkFixed dy = (srcH << 16) / dstH;
 
-    GrFixed y = dy >> 1;
+    SkFixed y = dy >> 1;
 
     size_t dstXLimit = dstW*bpp;
     for (int j = 0; j < dstH; ++j) {
-        GrFixed x = dx >> 1;
+        SkFixed x = dx >> 1;
         void* srcRow = (uint8_t*)src + (y>>16)*srcW*bpp;
         void* dstRow = (uint8_t*)dst + j*dstW*bpp;
         for (size_t i = 0; i < dstXLimit; i += bpp) {
@@ -295,7 +295,7 @@ namespace {
 // position + local coordinate
 extern const GrVertexAttrib gVertexAttribs[] = {
     {kVec2f_GrVertexAttribType, 0,               kPosition_GrVertexAttribBinding},
-    {kVec2f_GrVertexAttribType, sizeof(GrPoint), kLocalCoord_GrVertexAttribBinding}
+    {kVec2f_GrVertexAttribType, sizeof(SkPoint), kLocalCoord_GrVertexAttribBinding}
 };
 
 };
@@ -342,9 +342,9 @@ GrTexture* GrContext::createResizedTexture(const GrTextureDesc& desc,
         GrDrawTarget::AutoReleaseGeometry arg(fGpu, 4, 0);
 
         if (arg.succeeded()) {
-            GrPoint* verts = (GrPoint*) arg.vertices();
-            verts[0].setIRectFan(0, 0, texture->width(), texture->height(), 2 * sizeof(GrPoint));
-            verts[1].setIRectFan(0, 0, 1, 1, 2 * sizeof(GrPoint));
+            SkPoint* verts = (SkPoint*) arg.vertices();
+            verts[0].setIRectFan(0, 0, texture->width(), texture->height(), 2 * sizeof(SkPoint));
+            verts[1].setIRectFan(0, 0, 1, 1, 2 * sizeof(SkPoint));
             fGpu->drawNonIndexed(kTriangleFan_GrPrimitiveType, 0, 4);
         }
     } else {
@@ -439,8 +439,8 @@ GrTexture* GrContext::lockAndRefScratchTexture(const GrTextureDesc& inDesc, Scra
     if (kApprox_ScratchTexMatch == match) {
         // bin by pow2 with a reasonable min
         static const int MIN_SIZE = 16;
-        desc.fWidth  = GrMax(MIN_SIZE, GrNextPow2(desc.fWidth));
-        desc.fHeight = GrMax(MIN_SIZE, GrNextPow2(desc.fHeight));
+        desc.fWidth  = SkTMax(MIN_SIZE, GrNextPow2(desc.fWidth));
+        desc.fHeight = SkTMax(MIN_SIZE, GrNextPow2(desc.fHeight));
     }
 
     GrResource* resource = NULL;
@@ -580,7 +580,7 @@ void GrContext::setTextureCacheLimits(int maxTextures, size_t maxTextureBytes) {
 }
 
 int GrContext::getMaxTextureSize() const {
-    return GrMin(fGpu->caps()->maxTextureSize(), fMaxTextureSizeOverride);
+    return SkTMin(fGpu->caps()->maxTextureSize(), fMaxTextureSizeOverride);
 }
 
 int GrContext::getMaxRenderTargetSize() const {
@@ -680,7 +680,7 @@ void GrContext::dumpFontCache() const {
  could use an indices array, and then only send 8 verts, but not sure that
  would be faster.
  */
-static void setStrokeRectStrip(GrPoint verts[10], SkRect rect,
+static void setStrokeRectStrip(SkPoint verts[10], SkRect rect,
                                SkScalar width) {
     const SkScalar rad = SkScalarHalf(width);
     rect.sort();
@@ -856,7 +856,7 @@ void GrContext::drawRect(const GrPaint& paint,
 
         GrPrimitiveType primType;
         int vertCount;
-        GrPoint* vertex = geo.positions();
+        SkPoint* vertex = geo.positions();
 
         if (width > 0) {
             vertCount = 10;
@@ -904,17 +904,17 @@ namespace {
 
 extern const GrVertexAttrib gPosUVColorAttribs[] = {
     {kVec2f_GrVertexAttribType,  0, kPosition_GrVertexAttribBinding },
-    {kVec2f_GrVertexAttribType,  sizeof(GrPoint), kLocalCoord_GrVertexAttribBinding },
-    {kVec4ub_GrVertexAttribType, 2*sizeof(GrPoint), kColor_GrVertexAttribBinding}
+    {kVec2f_GrVertexAttribType,  sizeof(SkPoint), kLocalCoord_GrVertexAttribBinding },
+    {kVec4ub_GrVertexAttribType, 2*sizeof(SkPoint), kColor_GrVertexAttribBinding}
 };
 
 extern const GrVertexAttrib gPosColorAttribs[] = {
     {kVec2f_GrVertexAttribType,  0, kPosition_GrVertexAttribBinding},
-    {kVec4ub_GrVertexAttribType, sizeof(GrPoint), kColor_GrVertexAttribBinding},
+    {kVec4ub_GrVertexAttribType, sizeof(SkPoint), kColor_GrVertexAttribBinding},
 };
 
 static void set_vertex_attributes(GrDrawState* drawState,
-                                  const GrPoint* texCoords,
+                                  const SkPoint* texCoords,
                                   const GrColor* colors,
                                   int* colorOffset,
                                   int* texOffset) {
@@ -922,14 +922,14 @@ static void set_vertex_attributes(GrDrawState* drawState,
     *colorOffset = -1;
 
     if (NULL != texCoords && NULL != colors) {
-        *texOffset = sizeof(GrPoint);
-        *colorOffset = 2*sizeof(GrPoint);
+        *texOffset = sizeof(SkPoint);
+        *colorOffset = 2*sizeof(SkPoint);
         drawState->setVertexAttribs<gPosUVColorAttribs>(3);
     } else if (NULL != texCoords) {
-        *texOffset = sizeof(GrPoint);
+        *texOffset = sizeof(SkPoint);
         drawState->setVertexAttribs<gPosUVColorAttribs>(2);
     } else if (NULL != colors) {
-        *colorOffset = sizeof(GrPoint);
+        *colorOffset = sizeof(SkPoint);
         drawState->setVertexAttribs<gPosColorAttribs>(2);
     } else {
         drawState->setVertexAttribs<gPosColorAttribs>(1);
@@ -941,8 +941,8 @@ static void set_vertex_attributes(GrDrawState* drawState,
 void GrContext::drawVertices(const GrPaint& paint,
                              GrPrimitiveType primitiveType,
                              int vertexCount,
-                             const GrPoint positions[],
-                             const GrPoint texCoords[],
+                             const SkPoint positions[],
+                             const SkPoint texCoords[],
                              const GrColor colors[],
                              const uint16_t indices[],
                              int indexCount) {
@@ -960,7 +960,7 @@ void GrContext::drawVertices(const GrPaint& paint,
     set_vertex_attributes(drawState, texCoords, colors, &colorOffset, &texOffset);
 
     size_t vertexSize = drawState->getVertexSize();
-    if (sizeof(GrPoint) != vertexSize) {
+    if (sizeof(SkPoint) != vertexSize) {
         if (!geo.set(target, vertexCount, 0)) {
             GrPrintf("Failed to get space for vertices!\n");
             return;
@@ -968,10 +968,10 @@ void GrContext::drawVertices(const GrPaint& paint,
         void* curVertex = geo.vertices();
 
         for (int i = 0; i < vertexCount; ++i) {
-            *((GrPoint*)curVertex) = positions[i];
+            *((SkPoint*)curVertex) = positions[i];
 
             if (texOffset >= 0) {
-                *(GrPoint*)((intptr_t)curVertex + texOffset) = texCoords[i];
+                *(SkPoint*)((intptr_t)curVertex + texOffset) = texCoords[i];
             }
             if (colorOffset >= 0) {
                 *(GrColor*)((intptr_t)curVertex + colorOffset) = colors[i];
index 8d2b2b7267f7741f7f89b3cc4d5499870acd6243..01e1a94adc8bd8e5603a83c6bd61ea1c9ad7f8ea 100644 (file)
@@ -239,11 +239,11 @@ bool GrDefaultPathRenderer::createGeom(const SkPath& path,
     uint16_t* idx = idxBase;
     uint16_t subpathIdxStart = 0;
 
-    GrPoint* base = reinterpret_cast<GrPoint*>(arg->vertices());
+    SkPoint* base = reinterpret_cast<SkPoint*>(arg->vertices());
     SkASSERT(NULL != base);
-    GrPoint* vert = base;
+    SkPoint* vert = base;
 
-    GrPoint pts[4];
+    SkPoint pts[4];
 
     bool first = true;
     int subpath = 0;
index 4ce336beb01db0a309b242b17e75289d4850ab03..638ec597074bbef9010c3faaea188000af41c4e1 100755 (executable)
@@ -76,7 +76,7 @@ void GrDistanceFieldTextContext::flushGlyphs() {
 
     if (fCurrVertex > 0) {
         // setup our sampler state for our text texture/atlas
-        SkASSERT(GrIsALIGN4(fCurrVertex));
+        SkASSERT(SkIsAlign4(fCurrVertex));
         SkASSERT(fCurrTexture);
         GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kBilerp_FilterMode);
 
@@ -126,13 +126,13 @@ namespace {
 // position + texture coord
 extern const GrVertexAttrib gTextVertexAttribs[] = {
     {kVec2f_GrVertexAttribType, 0,               kPosition_GrVertexAttribBinding},
-    {kVec2f_GrVertexAttribType, sizeof(GrPoint), kEffect_GrVertexAttribBinding}
+    {kVec2f_GrVertexAttribType, sizeof(SkPoint), kEffect_GrVertexAttribBinding}
 };
 
 };
 
 void GrDistanceFieldTextContext::drawPackedGlyph(GrGlyph::PackedID packed,
-                                                 GrFixed vx, GrFixed vy,
+                                                 SkFixed vx, SkFixed vy,
                                                  GrFontScaler* scaler) {
     if (NULL == fDrawTarget) {
         return;
@@ -257,7 +257,7 @@ HAS_ATLAS:
                                                                GrTCast<void**>(&fVertices),
                                                                NULL);
         GrAlwaysAssert(success);
-        SkASSERT(2*sizeof(GrPoint) == fDrawTarget->getDrawState().getVertexSize());
+        SkASSERT(2*sizeof(SkPoint) == fDrawTarget->getDrawState().getVertexSize());
     }
 
     SkScalar dx = SkIntToScalar(glyph->fBounds.fLeft);
@@ -273,10 +273,10 @@ HAS_ATLAS:
     width *= scale;
     height *= scale;
 
-    GrFixed tx = SkIntToFixed(glyph->fAtlasLocation.fX);
-    GrFixed ty = SkIntToFixed(glyph->fAtlasLocation.fY);
-    GrFixed tw = SkIntToFixed(glyph->fBounds.width());
-    GrFixed th = SkIntToFixed(glyph->fBounds.height());
+    SkFixed tx = SkIntToFixed(glyph->fAtlasLocation.fX);
+    SkFixed ty = SkIntToFixed(glyph->fAtlasLocation.fY);
+    SkFixed tw = SkIntToFixed(glyph->fBounds.width());
+    SkFixed th = SkIntToFixed(glyph->fBounds.height());
 
     static const size_t kVertexSize = 2 * sizeof(SkPoint);
     fVertices[2*fCurrVertex].setRectFan(sx,
index 63fe8efcb803faf034808502bcc8546b13b4cd7c..26208822d9c4b50ff15dfea15941e61379f9775c 100644 (file)
@@ -34,7 +34,7 @@ private:
     SkScalar                fTextRatio;
 
     void init(const GrPaint&, const SkPaint&);
-    void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontScaler*);
+    void drawPackedGlyph(GrGlyph::PackedID, SkFixed left, SkFixed top, GrFontScaler*);
     void flushGlyphs();                 // automatically called by destructor
     void finish();
 
index 3de0b12e8593164cda09d74e851487c8c0d5e878..de28600ddfd8da43fe6b4b88796e16d15b33cab0 100644 (file)
@@ -185,20 +185,20 @@ public:
      *                      Defaults to zero (corresponding to vertex position)
      * @return pointer to the vertex component as a GrPoint
      */
-    static GrPoint* GetVertexPoint(void* vertices,
+    static SkPoint* GetVertexPoint(void* vertices,
                                    int vertexIndex,
                                    int vertexSize,
                                    int offset = 0) {
         intptr_t start = GrTCast<intptr_t>(vertices);
-        return GrTCast<GrPoint*>(start + offset +
+        return GrTCast<SkPoint*>(start + offset +
                                  vertexIndex * vertexSize);
     }
-    static const GrPoint* GetVertexPoint(const void* vertices,
+    static const SkPoint* GetVertexPoint(const void* vertices,
                                          int vertexIndex,
                                          int vertexSize,
                                          int offset = 0) {
         intptr_t start = GrTCast<intptr_t>(vertices);
-        return GrTCast<const GrPoint*>(start + offset +
+        return GrTCast<const SkPoint*>(start + offset +
                                        vertexIndex * vertexSize);
     }
 
index 10698442b258b5f556f1243bd7b998b2e84d1ee2..593932e76d397e0680570a8d16dab33e50f44ca3 100644 (file)
@@ -651,7 +651,7 @@ void GrDrawTarget::drawIndexedInstances(GrPrimitiveType type,
     }
 
     while (instanceCount) {
-        info.fInstanceCount = GrMin(instanceCount, maxInstancesPerDraw);
+        info.fInstanceCount = SkTMin(instanceCount, maxInstancesPerDraw);
         info.fVertexCount = info.fInstanceCount * verticesPerInstance;
         info.fIndexCount = info.fInstanceCount * indicesPerInstance;
 
@@ -674,7 +674,7 @@ namespace {
 // position + (optional) texture coord
 extern const GrVertexAttrib gBWRectPosUVAttribs[] = {
     {kVec2f_GrVertexAttribType, 0,               kPosition_GrVertexAttribBinding},
-    {kVec2f_GrVertexAttribType, sizeof(GrPoint), kLocalCoord_GrVertexAttribBinding}
+    {kVec2f_GrVertexAttribType, sizeof(SkPoint), kLocalCoord_GrVertexAttribBinding}
 };
 
 void set_vertex_attributes(GrDrawState* drawState, bool hasUVs) {
@@ -708,8 +708,8 @@ void GrDrawTarget::onDrawRect(const SkRect& rect,
     size_t vsize = this->drawState()->getVertexSize();
     geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vsize);
     if (NULL != localRect) {
-        GrPoint* coords = GrTCast<GrPoint*>(GrTCast<intptr_t>(geo.vertices()) +
-                                            sizeof(GrPoint));
+        SkPoint* coords = GrTCast<SkPoint*>(GrTCast<intptr_t>(geo.vertices()) +
+                                            sizeof(SkPoint));
         coords->setRectFan(localRect->fLeft, localRect->fTop,
                            localRect->fRight, localRect->fBottom,
                            vsize);
index 6b3d4637ccf08a55d556bc30cf907c1770fcc3ed..ece2b8822e1d746313bd7f249b97ae32c2ebb067 100644 (file)
@@ -607,8 +607,8 @@ public:
         bool succeeded() const { return NULL != fTarget; }
         void* vertices() const { SkASSERT(this->succeeded()); return fVertices; }
         void* indices() const { SkASSERT(this->succeeded()); return fIndices; }
-        GrPoint* positions() const {
-            return static_cast<GrPoint*>(this->vertices());
+        SkPoint* positions() const {
+            return static_cast<SkPoint*>(this->vertices());
         }
 
     private:
index 8d34e6cf763fdc5fea3c8ee4348ebed26f8b1ce7..d0ec73c9eb212da8bff3921a50a18dea77f2d2e3 100644 (file)
@@ -62,13 +62,13 @@ void get_vertex_bounds(const void* vertices,
                        size_t vertexSize,
                        int vertexCount,
                        SkRect* bounds) {
-    SkASSERT(vertexSize >= sizeof(GrPoint));
+    SkASSERT(vertexSize >= sizeof(SkPoint));
     SkASSERT(vertexCount > 0);
-    const GrPoint* point = static_cast<const GrPoint*>(vertices);
+    const SkPoint* point = static_cast<const SkPoint*>(vertices);
     bounds->fLeft = bounds->fRight = point->fX;
     bounds->fTop = bounds->fBottom = point->fY;
     for (int i = 1; i < vertexCount; ++i) {
-        point = reinterpret_cast<GrPoint*>(reinterpret_cast<intptr_t>(point) + vertexSize);
+        point = reinterpret_cast<SkPoint*>(reinterpret_cast<intptr_t>(point) + vertexSize);
         bounds->growToInclude(point->fX, point->fY);
     }
 }
@@ -79,14 +79,14 @@ namespace {
 
 extern const GrVertexAttrib kRectPosColorUVAttribs[] = {
     {kVec2f_GrVertexAttribType,  0,               kPosition_GrVertexAttribBinding},
-    {kVec4ub_GrVertexAttribType, sizeof(GrPoint), kColor_GrVertexAttribBinding},
-    {kVec2f_GrVertexAttribType,  sizeof(GrPoint)+sizeof(GrColor),
+    {kVec4ub_GrVertexAttribType, sizeof(SkPoint), kColor_GrVertexAttribBinding},
+    {kVec2f_GrVertexAttribType,  sizeof(SkPoint)+sizeof(GrColor),
                                                   kLocalCoord_GrVertexAttribBinding},
 };
 
 extern const GrVertexAttrib kRectPosUVAttribs[] = {
     {kVec2f_GrVertexAttribType,  0,              kPosition_GrVertexAttribBinding},
-    {kVec2f_GrVertexAttribType, sizeof(GrPoint), kLocalCoord_GrVertexAttribBinding},
+    {kVec2f_GrVertexAttribType, sizeof(SkPoint), kLocalCoord_GrVertexAttribBinding},
 };
 
 static void set_vertex_attributes(GrDrawState* drawState,
@@ -102,14 +102,14 @@ static void set_vertex_attributes(GrDrawState* drawState,
     // dual-source blending isn't available. This comes into play when there is coverage. If colors
     // were a stage it could take a hint that every vertex's color will be opaque.
     if (hasColor && hasUVs) {
-        *colorOffset = sizeof(GrPoint);
-        *localOffset = sizeof(GrPoint) + sizeof(GrColor);
+        *colorOffset = sizeof(SkPoint);
+        *localOffset = sizeof(SkPoint) + sizeof(GrColor);
         drawState->setVertexAttribs<kRectPosColorUVAttribs>(3);
     } else if (hasColor) {
-        *colorOffset = sizeof(GrPoint);
+        *colorOffset = sizeof(SkPoint);
         drawState->setVertexAttribs<kRectPosColorUVAttribs>(2);
     } else if (hasUVs) {
-        *localOffset = sizeof(GrPoint);
+        *localOffset = sizeof(SkPoint);
         drawState->setVertexAttribs<kRectPosUVAttribs>(2);
     } else {
         drawState->setVertexAttribs<kRectPosUVAttribs>(1);
@@ -192,7 +192,7 @@ void GrInOrderDrawBuffer::onDrawRect(const SkRect& rect,
     get_vertex_bounds(geo.vertices(), vsize, 4, &devBounds);
 
     if (localOffset >= 0) {
-        GrPoint* coords = GrTCast<GrPoint*>(GrTCast<intptr_t>(geo.vertices()) + localOffset);
+        SkPoint* coords = GrTCast<SkPoint*>(GrTCast<intptr_t>(geo.vertices()) + localOffset);
         coords->setRectFan(localRect->fLeft, localRect->fTop,
                            localRect->fRight, localRect->fBottom,
                             vsize);
@@ -300,12 +300,12 @@ int GrInOrderDrawBuffer::concatInstancedDraw(const DrawInfo& info) {
     // how many instances can be concat'ed onto draw given the size of the index buffer
     int instancesToConcat = this->indexCountInCurrentSource() / info.indicesPerInstance();
     instancesToConcat -= draw->instanceCount();
-    instancesToConcat = GrMin(instancesToConcat, info.instanceCount());
+    instancesToConcat = SkTMin(instancesToConcat, info.instanceCount());
 
     // update the amount of reserved vertex data actually referenced in draws
     size_t vertexBytes = instancesToConcat * info.verticesPerInstance() *
                          drawState.getVertexSize();
-    poolState.fUsedPoolVertexBytes = GrMax(poolState.fUsedPoolVertexBytes, vertexBytes);
+    poolState.fUsedPoolVertexBytes = SkTMax(poolState.fUsedPoolVertexBytes, vertexBytes);
 
     draw->adjustInstanceCount(instancesToConcat);
 
@@ -380,7 +380,7 @@ void GrInOrderDrawBuffer::onDraw(const DrawInfo& info) {
         case kArray_GeometrySrcType: {
             size_t vertexBytes = (info.vertexCount() + info.startVertex()) *
                                  drawState.getVertexSize();
-            poolState.fUsedPoolVertexBytes = GrMax(poolState.fUsedPoolVertexBytes, vertexBytes);
+            poolState.fUsedPoolVertexBytes = SkTMax(poolState.fUsedPoolVertexBytes, vertexBytes);
             draw->fVertexBuffer = poolState.fPoolVertexBuffer;
             draw->adjustStartVertex(poolState.fPoolStartVertex);
             break;
@@ -398,7 +398,7 @@ void GrInOrderDrawBuffer::onDraw(const DrawInfo& info) {
             case kReserved_GeometrySrcType: // fallthrough
             case kArray_GeometrySrcType: {
                 size_t indexBytes = (info.indexCount() + info.startIndex()) * sizeof(uint16_t);
-                poolState.fUsedPoolIndexBytes = GrMax(poolState.fUsedPoolIndexBytes, indexBytes);
+                poolState.fUsedPoolIndexBytes = SkTMax(poolState.fUsedPoolIndexBytes, indexBytes);
                 draw->fIndexBuffer = poolState.fPoolIndexBuffer;
                 draw->adjustStartIndex(poolState.fPoolStartIndex);
                 break;
index 75a3c9a3b9c4257fd9546d406306ff7cd8c19b1c..8839c66d07c9e4b6c2427d6f15e55a8cf9209ff7 100644 (file)
 GrMemoryPool::GrMemoryPool(size_t preallocSize, size_t minAllocSize) {
     SkDEBUGCODE(fAllocationCnt = 0);
 
-    minAllocSize = GrMax<size_t>(minAllocSize, 1 << 10);
+    minAllocSize = SkTMax<size_t>(minAllocSize, 1 << 10);
     fMinAllocSize = GrSizeAlignUp(minAllocSize + kPerAllocPad, kAlignment),
     fPreallocSize = GrSizeAlignUp(preallocSize + kPerAllocPad, kAlignment);
-    fPreallocSize = GrMax(fPreallocSize, fMinAllocSize);
+    fPreallocSize = SkTMax(fPreallocSize, fMinAllocSize);
 
     fHead = CreateBlock(fPreallocSize);
     fTail = fHead;
@@ -42,7 +42,7 @@ void* GrMemoryPool::allocate(size_t size) {
     size += kPerAllocPad;
     if (fTail->fFreeSize < size) {
         size_t blockSize = size;
-        blockSize = GrMax<size_t>(blockSize, fMinAllocSize);
+        blockSize = SkTMax<size_t>(blockSize, fMinAllocSize);
         BlockHeader* block = CreateBlock(blockSize);
 
         block->fPrev = fTail;
index 23ce230bfa8ffa6008b29774d283b323cc2c0632..190bf9d257006fa4e52a84987c29896517d1256c 100644 (file)
 namespace {
 
 struct CircleVertex {
-    GrPoint  fPos;
-    GrPoint  fOffset;
+    SkPoint  fPos;
+    SkPoint  fOffset;
     SkScalar fOuterRadius;
     SkScalar fInnerRadius;
 };
 
 struct EllipseVertex {
-    GrPoint  fPos;
-    GrPoint  fOffset;
-    GrPoint  fOuterRadii;
-    GrPoint  fInnerRadii;
+    SkPoint  fPos;
+    SkPoint  fOffset;
+    SkPoint  fOuterRadii;
+    SkPoint  fInnerRadii;
 };
 
 struct DIEllipseVertex {
-    GrPoint  fPos;
-    GrPoint  fOuterOffset;
-    GrPoint  fInnerOffset;
+    SkPoint  fPos;
+    SkPoint  fOuterOffset;
+    SkPoint  fInnerOffset;
 };
 
 inline bool circle_stays_circle(const SkMatrix& m) {
@@ -492,7 +492,7 @@ bool GrOvalRenderer::drawOval(GrDrawTarget* target, const GrContext* context, bo
 // position + edge
 extern const GrVertexAttrib gCircleVertexAttribs[] = {
     {kVec2f_GrVertexAttribType, 0,               kPosition_GrVertexAttribBinding},
-    {kVec4f_GrVertexAttribType, sizeof(GrPoint), kEffect_GrVertexAttribBinding}
+    {kVec4f_GrVertexAttribType, sizeof(SkPoint), kEffect_GrVertexAttribBinding}
 };
 
 void GrOvalRenderer::drawCircle(GrDrawTarget* target,
@@ -503,7 +503,7 @@ void GrOvalRenderer::drawCircle(GrDrawTarget* target,
     GrDrawState* drawState = target->drawState();
 
     const SkMatrix& vm = drawState->getViewMatrix();
-    GrPoint center = GrPoint::Make(circle.centerX(), circle.centerY());
+    SkPoint center = SkPoint::Make(circle.centerX(), circle.centerY());
     vm.mapPoints(&center, 1);
     SkScalar radius = vm.mapRadius(SkScalarHalf(circle.width()));
     SkScalar strokeWidth = vm.mapRadius(stroke.getWidth());
@@ -589,15 +589,15 @@ void GrOvalRenderer::drawCircle(GrDrawTarget* target,
 // position + offset + 1/radii
 extern const GrVertexAttrib gEllipseVertexAttribs[] = {
     {kVec2f_GrVertexAttribType, 0,                 kPosition_GrVertexAttribBinding},
-    {kVec2f_GrVertexAttribType, sizeof(GrPoint),   kEffect_GrVertexAttribBinding},
-    {kVec4f_GrVertexAttribType, 2*sizeof(GrPoint), kEffect_GrVertexAttribBinding}
+    {kVec2f_GrVertexAttribType, sizeof(SkPoint),   kEffect_GrVertexAttribBinding},
+    {kVec4f_GrVertexAttribType, 2*sizeof(SkPoint), kEffect_GrVertexAttribBinding}
 };
 
 // position + offsets
 extern const GrVertexAttrib gDIEllipseVertexAttribs[] = {
     {kVec2f_GrVertexAttribType, 0,                 kPosition_GrVertexAttribBinding},
-    {kVec2f_GrVertexAttribType, sizeof(GrPoint),   kEffect_GrVertexAttribBinding},
-    {kVec2f_GrVertexAttribType, 2*sizeof(GrPoint), kEffect_GrVertexAttribBinding},
+    {kVec2f_GrVertexAttribType, sizeof(SkPoint),   kEffect_GrVertexAttribBinding},
+    {kVec2f_GrVertexAttribType, 2*sizeof(SkPoint), kEffect_GrVertexAttribBinding},
 };
 
 bool GrOvalRenderer::drawEllipse(GrDrawTarget* target,
@@ -616,7 +616,7 @@ bool GrOvalRenderer::drawEllipse(GrDrawTarget* target,
 
     // do any matrix crunching before we reset the draw state for device coords
     const SkMatrix& vm = drawState->getViewMatrix();
-    GrPoint center = GrPoint::Make(ellipse.centerX(), ellipse.centerY());
+    SkPoint center = SkPoint::Make(ellipse.centerX(), ellipse.centerY());
     vm.mapPoints(&center, 1);
     SkScalar ellipseXRadius = SkScalarHalf(ellipse.width());
     SkScalar ellipseYRadius = SkScalarHalf(ellipse.height());
@@ -740,7 +740,7 @@ bool GrOvalRenderer::drawDIEllipse(GrDrawTarget* target,
     GrDrawState* drawState = target->drawState();
     const SkMatrix& vm = drawState->getViewMatrix();
 
-    GrPoint center = GrPoint::Make(ellipse.centerX(), ellipse.centerY());
+    SkPoint center = SkPoint::Make(ellipse.centerX(), ellipse.centerY());
     SkScalar xRadius = SkScalarHalf(ellipse.width());
     SkScalar yRadius = SkScalarHalf(ellipse.height());
 
@@ -1031,7 +1031,7 @@ bool GrOvalRenderer::drawSimpleRRect(GrDrawTarget* target, GrContext* context, b
         }
 
         // drop out the middle quad if we're stroked
-        int indexCnt = isStroked ? GR_ARRAY_COUNT(gRRectIndices)-6 : GR_ARRAY_COUNT(gRRectIndices);
+        int indexCnt = isStroked ? SK_ARRAY_COUNT(gRRectIndices)-6 : SK_ARRAY_COUNT(gRRectIndices);
         target->setIndexSourceToBuffer(indexBuffer);
         target->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 16, indexCnt, &bounds);
 
@@ -1140,7 +1140,7 @@ bool GrOvalRenderer::drawSimpleRRect(GrDrawTarget* target, GrContext* context, b
         }
 
         // drop out the middle quad if we're stroked
-        int indexCnt = isStroked ? GR_ARRAY_COUNT(gRRectIndices)-6 : GR_ARRAY_COUNT(gRRectIndices);
+        int indexCnt = isStroked ? SK_ARRAY_COUNT(gRRectIndices)-6 : SK_ARRAY_COUNT(gRRectIndices);
         target->setIndexSourceToBuffer(indexBuffer);
         target->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 16, indexCnt, &bounds);
     }
index 2f6006947fd12d5536656be5c8f7327267e22d10..5fead5dea26153c5473dbd70b28eb0ec09310564 100644 (file)
@@ -36,7 +36,7 @@ SkScalar GrPathUtils::scaleToleranceToSrc(SkScalar devTol,
 static const int MAX_POINTS_PER_CURVE = 1 << 10;
 static const SkScalar gMinCurveTol = 0.0001f;
 
-uint32_t GrPathUtils::quadraticPointCount(const GrPoint points[],
+uint32_t GrPathUtils::quadraticPointCount(const SkPoint points[],
                                           SkScalar tol) {
     if (tol < gMinCurveTol) {
         tol = gMinCurveTol;
@@ -59,15 +59,15 @@ uint32_t GrPathUtils::quadraticPointCount(const GrPoint points[],
         if (pow2 < 1) {
             pow2 = 1;
         }
-        return GrMin(pow2, MAX_POINTS_PER_CURVE);
+        return SkTMin(pow2, MAX_POINTS_PER_CURVE);
     }
 }
 
-uint32_t GrPathUtils::generateQuadraticPoints(const GrPoint& p0,
-                                              const GrPoint& p1,
-                                              const GrPoint& p2,
+uint32_t GrPathUtils::generateQuadraticPoints(const SkPoint& p0,
+                                              const SkPoint& p1,
+                                              const SkPoint& p2,
                                               SkScalar tolSqd,
-                                              GrPoint** points,
+                                              SkPoint** points,
                                               uint32_t pointsLeft) {
     if (pointsLeft < 2 ||
         (p1.distanceToLineSegmentBetweenSqd(p0, p2)) < tolSqd) {
@@ -76,11 +76,11 @@ uint32_t GrPathUtils::generateQuadraticPoints(const GrPoint& p0,
         return 1;
     }
 
-    GrPoint q[] = {
+    SkPoint q[] = {
         { SkScalarAve(p0.fX, p1.fX), SkScalarAve(p0.fY, p1.fY) },
         { SkScalarAve(p1.fX, p2.fX), SkScalarAve(p1.fY, p2.fY) },
     };
-    GrPoint r = { SkScalarAve(q[0].fX, q[1].fX), SkScalarAve(q[0].fY, q[1].fY) };
+    SkPoint r = { SkScalarAve(q[0].fX, q[1].fX), SkScalarAve(q[0].fY, q[1].fY) };
 
     pointsLeft >>= 1;
     uint32_t a = generateQuadraticPoints(p0, q[0], r, tolSqd, points, pointsLeft);
@@ -88,14 +88,14 @@ uint32_t GrPathUtils::generateQuadraticPoints(const GrPoint& p0,
     return a + b;
 }
 
-uint32_t GrPathUtils::cubicPointCount(const GrPoint points[],
+uint32_t GrPathUtils::cubicPointCount(const SkPoint points[],
                                            SkScalar tol) {
     if (tol < gMinCurveTol) {
         tol = gMinCurveTol;
     }
     SkASSERT(tol > 0);
 
-    SkScalar d = GrMax(
+    SkScalar d = SkTMax(
         points[1].distanceToLineSegmentBetweenSqd(points[0], points[3]),
         points[2].distanceToLineSegmentBetweenSqd(points[0], points[3]));
     d = SkScalarSqrt(d);
@@ -110,16 +110,16 @@ uint32_t GrPathUtils::cubicPointCount(const GrPoint points[],
         if (pow2 < 1) {
             pow2 = 1;
         }
-        return GrMin(pow2, MAX_POINTS_PER_CURVE);
+        return SkTMin(pow2, MAX_POINTS_PER_CURVE);
     }
 }
 
-uint32_t GrPathUtils::generateCubicPoints(const GrPoint& p0,
-                                          const GrPoint& p1,
-                                          const GrPoint& p2,
-                                          const GrPoint& p3,
+uint32_t GrPathUtils::generateCubicPoints(const SkPoint& p0,
+                                          const SkPoint& p1,
+                                          const SkPoint& p2,
+                                          const SkPoint& p3,
                                           SkScalar tolSqd,
-                                          GrPoint** points,
+                                          SkPoint** points,
                                           uint32_t pointsLeft) {
     if (pointsLeft < 2 ||
         (p1.distanceToLineSegmentBetweenSqd(p0, p3) < tolSqd &&
@@ -128,16 +128,16 @@ uint32_t GrPathUtils::generateCubicPoints(const GrPoint& p0,
             *points += 1;
             return 1;
         }
-    GrPoint q[] = {
+    SkPoint q[] = {
         { SkScalarAve(p0.fX, p1.fX), SkScalarAve(p0.fY, p1.fY) },
         { SkScalarAve(p1.fX, p2.fX), SkScalarAve(p1.fY, p2.fY) },
         { SkScalarAve(p2.fX, p3.fX), SkScalarAve(p2.fY, p3.fY) }
     };
-    GrPoint r[] = {
+    SkPoint r[] = {
         { SkScalarAve(q[0].fX, q[1].fX), SkScalarAve(q[0].fY, q[1].fY) },
         { SkScalarAve(q[1].fX, q[2].fX), SkScalarAve(q[1].fY, q[2].fY) }
     };
-    GrPoint s = { SkScalarAve(r[0].fX, r[1].fX), SkScalarAve(r[0].fY, r[1].fY) };
+    SkPoint s = { SkScalarAve(r[0].fX, r[1].fX), SkScalarAve(r[0].fY, r[1].fY) };
     pointsLeft >>= 1;
     uint32_t a = generateCubicPoints(p0, q[0], r[0], s, tolSqd, points, pointsLeft);
     uint32_t b = generateCubicPoints(s, r[1], q[2], p3, tolSqd, points, pointsLeft);
@@ -159,7 +159,7 @@ int GrPathUtils::worstCasePointCount(const SkPath& path, int* subpaths,
     SkPath::Iter iter(path, false);
     SkPath::Verb verb;
 
-    GrPoint pts[4];
+    SkPoint pts[4];
     while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
 
         switch (verb) {
@@ -186,7 +186,7 @@ int GrPathUtils::worstCasePointCount(const SkPath& path, int* subpaths,
     return pointCount;
 }
 
-void GrPathUtils::QuadUVMatrix::set(const GrPoint qPts[3]) {
+void GrPathUtils::QuadUVMatrix::set(const SkPoint qPts[3]) {
     SkMatrix m;
     // We want M such that M * xy_pt = uv_pt
     // We know M * control_pts = [0  1/2 1]
@@ -226,11 +226,11 @@ void GrPathUtils::QuadUVMatrix::set(const GrPoint qPts[3]) {
         // We could have a tolerance here, not sure if it would improve anything
         if (maxD > 0) {
             // Set the matrix to give (u = 0, v = distance_to_line)
-            GrVec lineVec = qPts[(maxEdge + 1)%3] - qPts[maxEdge];
+            SkVector lineVec = qPts[(maxEdge + 1)%3] - qPts[maxEdge];
             // when looking from the point 0 down the line we want positive
             // distances to be to the left. This matches the non-degenerate
             // case.
-            lineVec.setOrthog(lineVec, GrPoint::kLeft_Side);
+            lineVec.setOrthog(lineVec, SkPoint::kLeft_Side);
             lineVec.dot(qPts[0]);
             // first row
             fM[0] = 0;
@@ -519,7 +519,7 @@ void convert_noninflect_cubic_to_quads(const SkPoint p[4],
 }
 }
 
-void GrPathUtils::convertCubicToQuads(const GrPoint p[4],
+void GrPathUtils::convertCubicToQuads(const SkPoint p[4],
                                       SkScalar tolScale,
                                       bool constrainWithinTangents,
                                       SkPath::Direction dir,
index 71f6e0b9c1ef4ff240ace9da79f8643960263d6c..d6c18ea4a8917e169b25999212c18ba16e29574d 100644 (file)
@@ -31,25 +31,25 @@ namespace GrPathUtils {
 
     /// Since we divide by tol if we're computing exact worst-case bounds,
     /// very small tolerances will be increased to gMinCurveTol.
-    uint32_t quadraticPointCount(const GrPoint points[], SkScalar tol);
+    uint32_t quadraticPointCount(const SkPoint points[], SkScalar tol);
 
-    uint32_t generateQuadraticPoints(const GrPoint& p0,
-                                     const GrPoint& p1,
-                                     const GrPoint& p2,
+    uint32_t generateQuadraticPoints(const SkPoint& p0,
+                                     const SkPoint& p1,
+                                     const SkPoint& p2,
                                      SkScalar tolSqd,
-                                     GrPoint** points,
+                                     SkPoint** points,
                                      uint32_t pointsLeft);
 
     /// Since we divide by tol if we're computing exact worst-case bounds,
     /// very small tolerances will be increased to gMinCurveTol.
-    uint32_t cubicPointCount(const GrPoint points[], SkScalar tol);
+    uint32_t cubicPointCount(const SkPoint points[], SkScalar tol);
 
-    uint32_t generateCubicPoints(const GrPoint& p0,
-                                 const GrPoint& p1,
-                                 const GrPoint& p2,
-                                 const GrPoint& p3,
+    uint32_t generateCubicPoints(const SkPoint& p0,
+                                 const SkPoint& p1,
+                                 const SkPoint& p2,
+                                 const SkPoint& p3,
                                  SkScalar tolSqd,
-                                 GrPoint** points,
+                                 SkPoint** points,
                                  uint32_t pointsLeft);
 
     // A 2x3 matrix that goes from the 2d space coordinates to UV space where
@@ -59,8 +59,8 @@ namespace GrPathUtils {
     public:
         QuadUVMatrix() {};
         // Initialize the matrix from the control pts
-        QuadUVMatrix(const GrPoint controlPts[3]) { this->set(controlPts); }
-        void set(const GrPoint controlPts[3]);
+        QuadUVMatrix(const SkPoint controlPts[3]) { this->set(controlPts); }
+        void set(const SkPoint controlPts[3]);
 
         /**
          * Applies the matrix to vertex positions to compute UV coords. This
@@ -85,8 +85,8 @@ namespace GrPathUtils {
             float sy = fM[4];
             float ty = fM[5];
             for (int i = 0; i < N; ++i) {
-                const GrPoint* xy = reinterpret_cast<const GrPoint*>(xyPtr);
-                GrPoint* uv = reinterpret_cast<GrPoint*>(uvPtr);
+                const SkPoint* xy = reinterpret_cast<const SkPoint*>(xyPtr);
+                SkPoint* uv = reinterpret_cast<SkPoint*>(uvPtr);
                 uv->fX = sx * xy->fX + kx * xy->fY + tx;
                 uv->fY = ky * xy->fX + sy * xy->fY + ty;
                 xyPtr += STRIDE;
@@ -119,7 +119,7 @@ namespace GrPathUtils {
     // Setting constrainWithinTangents to true enforces this property. When this
     // is true the cubic must be simple and dir must specify the orientation of
     // the cubic. Otherwise, dir is ignored.
-    void convertCubicToQuads(const GrPoint p[4],
+    void convertCubicToQuads(const SkPoint p[4],
                              SkScalar tolScale,
                              bool constrainWithinTangents,
                              SkPath::Direction dir,
index 729aa0d469a086f5d1a3b1ce8b301cb3c4acc7f5..9348dc16a68aeb60d7779b5c980f28d3db427171 100644 (file)
@@ -73,7 +73,7 @@ size_t GrRenderTarget::sizeInBytes() const {
     uint64_t size = fDesc.fWidth;
     size *= fDesc.fHeight;
     size *= colorBits;
-    size *= GrMax(1, fDesc.fSampleCnt);
+    size *= SkTMax(1, fDesc.fSampleCnt);
     return (size_t)(size / 8);
 }
 
index a849c84e4ec71ba2e713ef3f4ab5c77a0dfa64bd..1e52d23fba19f5238636ba5f9c8246ab00843f33 100644 (file)
@@ -609,7 +609,7 @@ void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode,
     fContext->drawVertices(grPaint,
                            gPointMode2PrimtiveType[mode],
                            SkToS32(count),
-                           (GrPoint*)pts,
+                           (SkPoint*)pts,
                            NULL,
                            NULL,
                            NULL,
@@ -1797,8 +1797,8 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
     fContext->drawVertices(grPaint,
                            gVertexMode2PrimitiveType[vmode],
                            vertexCount,
-                           (GrPoint*) vertices,
-                           (GrPoint*) texs,
+                           vertices,
+                           texs,
                            colors,
                            indices,
                            indexCount);
index daf51414f2943a72050bafeb9f530f03590ea6f3..9b342fb463dde2e961c693c8a35bd5520e045146 100644 (file)
@@ -154,9 +154,9 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
         for (int x = 0; x < 256; ++x) {
             uint8_t* color = reinterpret_cast<uint8_t*>(&srcData[256*y + x]);
             color[3] = y;
-            color[2] = GrMin(x, y);
-            color[1] = GrMin(x, y);
-            color[0] = GrMin(x, y);
+            color[2] = SkTMin(x, y);
+            color[1] = SkTMin(x, y);
+            color[0] = SkTMin(x, y);
         }
     }
 
@@ -190,7 +190,7 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
 
     bool failed = true;
 
-    for (size_t i = 0; i < GR_ARRAY_COUNT(kConversionRules) && failed; ++i) {
+    for (size_t i = 0; i < SK_ARRAY_COUNT(kConversionRules) && failed; ++i) {
         *pmToUPMRule = kConversionRules[i][0];
         *upmToPMRule = kConversionRules[i][1];
 
index b27b737f39f36dc653a2c641c44efa0354f985af..841561baa970df615a5d9ee2e419537980bf896d 100644 (file)
@@ -73,7 +73,7 @@ GrEffectRef* GrSimpleTextureEffect::TestCreate(SkRandom* random,
         kLocal_GrCoordSet,
         kPosition_GrCoordSet
     };
-    GrCoordSet coordSet = kCoordSets[random->nextULessThan(GR_ARRAY_COUNT(kCoordSets))];
+    GrCoordSet coordSet = kCoordSets[random->nextULessThan(SK_ARRAY_COUNT(kCoordSets))];
 
     const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random);
     return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet);
index bf7939ccee8da793625a0bbd6600e9a6ddf07153..c4b7c2fbedd60a3c1f286e630f13699c9f555c0d 100644 (file)
@@ -310,7 +310,7 @@ void GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
     GR_GL_GetIntegerv(gli, GR_GL_MAX_RENDERBUFFER_SIZE, &fMaxRenderTargetSize);
     // Our render targets are always created with textures as the color
     // attachment, hence this min:
-    fMaxRenderTargetSize = GrMin(fMaxTextureSize, fMaxRenderTargetSize);
+    fMaxRenderTargetSize = SkTMin(fMaxTextureSize, fMaxRenderTargetSize);
 
     fPathRenderingSupport = ctxInfo.hasExtension("GL_NV_path_rendering");
     SkASSERT(!fPathRenderingSupport || fFixedFunctionSupport);
@@ -620,7 +620,7 @@ SkString GrGLCaps::dump() const {
     GR_STATIC_ASSERT(4 == kES_Apple_MSFBOType);
     GR_STATIC_ASSERT(5 == kES_IMG_MsToTexture_MSFBOType);
     GR_STATIC_ASSERT(6 == kES_EXT_MsToTexture_MSFBOType);
-    GR_STATIC_ASSERT(GR_ARRAY_COUNT(kMSFBOExtStr) == kLast_MSFBOType + 1);
+    GR_STATIC_ASSERT(SK_ARRAY_COUNT(kMSFBOExtStr) == kLast_MSFBOType + 1);
 
     static const char* kFBFetchTypeStr[] = {
         "None",
@@ -630,7 +630,7 @@ SkString GrGLCaps::dump() const {
     GR_STATIC_ASSERT(0 == kNone_FBFetchType);
     GR_STATIC_ASSERT(1 == kEXT_FBFetchType);
     GR_STATIC_ASSERT(2 == kNV_FBFetchType);
-    GR_STATIC_ASSERT(GR_ARRAY_COUNT(kFBFetchTypeStr) == kLast_FBFetchType + 1);
+    GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFBFetchTypeStr) == kLast_FBFetchType + 1);
 
 
     r.appendf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO"));
index 65729c962db8d8c9c6c2f637135754071630c3e9..de38f6aaa694fa3fae86f8a73820c37d0dddbb3c 100644 (file)
@@ -37,11 +37,11 @@ const GrGLubyte* combined_extensions_string() {
     static SkMutex gMutex;
     gMutex.acquire();
     if (0 == gExtString.size()) {
-        for (size_t i = 0; i < GR_ARRAY_COUNT(kExtensions) - 1; ++i) {
+        for (size_t i = 0; i < SK_ARRAY_COUNT(kExtensions) - 1; ++i) {
             gExtString.append(kExtensions[i]);
             gExtString.append(" ");
         }
-        gExtString.append(kExtensions[GR_ARRAY_COUNT(kExtensions) - 1]);
+        gExtString.append(kExtensions[SK_ARRAY_COUNT(kExtensions) - 1]);
     }
     gMutex.release();
     return (const GrGLubyte*) gExtString.c_str();
@@ -509,7 +509,7 @@ GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetIntegerv(GrGLenum pname, GrGLint* params)
             *params = kDefaultMaxVaryingVectors;
             break;
         case GR_GL_NUM_EXTENSIONS:
-            *params = GR_ARRAY_COUNT(kExtensions);
+            *params = SK_ARRAY_COUNT(kExtensions);
             break;
         default:
             GrCrash("Unexpected pname to GetIntegerv");
@@ -623,7 +623,7 @@ const GrGLubyte* GR_GL_FUNCTION_TYPE noOpGLGetString(GrGLenum name) {
 const GrGLubyte* GR_GL_FUNCTION_TYPE noOpGLGetStringi(GrGLenum name, GrGLuint i) {
     switch (name) {
         case GR_GL_EXTENSIONS:
-            if (static_cast<size_t>(i) <= GR_ARRAY_COUNT(kExtensions)) {
+            if (static_cast<size_t>(i) <= SK_ARRAY_COUNT(kExtensions)) {
                 return (const GrGLubyte*) kExtensions[i];
             } else {
                 return NULL;
index 514c8c738c99a045c50e67961d3d2fce4a67fd73..879edd50905e5978eca3b7277e31ac610bfdf275 100644 (file)
@@ -30,7 +30,7 @@ inline GrGLubyte verb_to_gl_path_cmd(SkPath::Verb verb) {
     GR_STATIC_ASSERT(4 == SkPath::kCubic_Verb);
     GR_STATIC_ASSERT(5 == SkPath::kClose_Verb);
 
-    SkASSERT(verb >= 0 && (size_t)verb < GR_ARRAY_COUNT(gTable));
+    SkASSERT(verb >= 0 && (size_t)verb < SK_ARRAY_COUNT(gTable));
     return gTable[verb];
 }
 
@@ -50,7 +50,7 @@ inline int num_pts(SkPath::Verb verb) {
     GR_STATIC_ASSERT(4 == SkPath::kCubic_Verb);
     GR_STATIC_ASSERT(5 == SkPath::kClose_Verb);
 
-    SkASSERT(verb >= 0 && (size_t)verb < GR_ARRAY_COUNT(gTable));
+    SkASSERT(verb >= 0 && (size_t)verb < SK_ARRAY_COUNT(gTable));
     return gTable[verb];
 }
 #endif
@@ -65,7 +65,7 @@ inline GrGLenum join_to_gl_join(SkPaint::Join join) {
     GR_STATIC_ASSERT(0 == SkPaint::kMiter_Join);
     GR_STATIC_ASSERT(1 == SkPaint::kRound_Join);
     GR_STATIC_ASSERT(2 == SkPaint::kBevel_Join);
-    GR_STATIC_ASSERT(GR_ARRAY_COUNT(gSkJoinsToGrGLJoins) == SkPaint::kJoinCount);
+    GR_STATIC_ASSERT(SK_ARRAY_COUNT(gSkJoinsToGrGLJoins) == SkPaint::kJoinCount);
 }
 
 inline GrGLenum cap_to_gl_cap(SkPaint::Cap cap) {
@@ -78,7 +78,7 @@ inline GrGLenum cap_to_gl_cap(SkPaint::Cap cap) {
     GR_STATIC_ASSERT(0 == SkPaint::kButt_Cap);
     GR_STATIC_ASSERT(1 == SkPaint::kRound_Cap);
     GR_STATIC_ASSERT(2 == SkPaint::kSquare_Cap);
-    GR_STATIC_ASSERT(GR_ARRAY_COUNT(gSkCapsToGrGLCaps) == SkPaint::kCapCount);
+    GR_STATIC_ASSERT(SK_ARRAY_COUNT(gSkCapsToGrGLCaps) == SkPaint::kCapCount);
 }
 
 }
index a7948cc4bcd4f98af5ba7c682d255d29d2b7712d..1ff0850a1db5d89768894f6aed5c1f4e53630ce0 100644 (file)
@@ -67,7 +67,7 @@ namespace {
     void append_tabs(SkString* outAppend, int tabCnt) {
         static const char kTabs[] = "\t\t\t\t\t\t\t\t";
         while (tabCnt) {
-            int cnt = GrMin((int)GR_ARRAY_COUNT(kTabs), tabCnt);
+            int cnt = SkTMin((int)SK_ARRAY_COUNT(kTabs), tabCnt);
             outAppend->append(kTabs, cnt);
             tabCnt -= cnt;
         }
index d9322c26dbd9763ed6ca552d202c849ee7f5180d..33e346c617305e18d2f301f73408d39b2638b735 100644 (file)
@@ -17,7 +17,7 @@ size_t GrGLStencilBuffer::sizeInBytes() const {
     uint64_t size = this->width();
     size *= this->height();
     size *= fFormat.fTotalBits;
-    size *= GrMax(1,this->numSamples());
+    size *= SkTMax(1,this->numSamples());
     return static_cast<size_t>(size / 8);
 }
 
index 78bf8f91cfdcd8063461fd8d65347156a0a163fe..a89bb9d64a799f6b40635e5eaa04f95fea363abb 100644 (file)
@@ -81,7 +81,7 @@ bool GrGpuGL::BlendCoeffReferencesConstant(GrBlendCoeff coeff) {
     };
     return gCoeffReferencesBlendConst[coeff];
     GR_STATIC_ASSERT(kTotalGrBlendCoeffCount ==
-                     GR_ARRAY_COUNT(gCoeffReferencesBlendConst));
+                     SK_ARRAY_COUNT(gCoeffReferencesBlendConst));
 
     GR_STATIC_ASSERT(0 == kZero_GrBlendCoeff);
     GR_STATIC_ASSERT(1 == kOne_GrBlendCoeff);
@@ -105,7 +105,7 @@ bool GrGpuGL::BlendCoeffReferencesConstant(GrBlendCoeff coeff) {
 
     // assertion for gXfermodeCoeff2Blend have to be in GrGpu scope
     GR_STATIC_ASSERT(kTotalGrBlendCoeffCount ==
-                     GR_ARRAY_COUNT(gXfermodeCoeff2Blend));
+                     SK_ARRAY_COUNT(gXfermodeCoeff2Blend));
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -879,7 +879,7 @@ GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc,
         return return_null_texture();
     }
     // If the sample count exceeds the max then we clamp it.
-    glTexDesc.fSampleCnt = GrMin(desc.fSampleCnt, this->caps()->maxSampleCount());
+    glTexDesc.fSampleCnt = SkTMin(desc.fSampleCnt, this->caps()->maxSampleCount());
 
     glTexDesc.fFlags  = desc.fFlags;
     glTexDesc.fWidth  = desc.fWidth;
@@ -1598,7 +1598,7 @@ void GrGpuGL::onGpuDraw(const DrawInfo& info) {
     size_t indexOffsetInBytes;
     this->setupGeometry(info, &indexOffsetInBytes);
 
-    SkASSERT((size_t)info.primitiveType() < GR_ARRAY_COUNT(gPrimitiveType2GLMode));
+    SkASSERT((size_t)info.primitiveType() < SK_ARRAY_COUNT(gPrimitiveType2GLMode));
 
     if (info.isIndexed()) {
         GrGLvoid* indices =
@@ -1859,7 +1859,7 @@ GrGLenum gr_to_gl_stencil_func(GrStencilFunc basicFunc) {
         GR_GL_EQUAL,            // kEqual_StencilFunc,
         GR_GL_NOTEQUAL,         // kNotEqual_StencilFunc,
     };
-    GR_STATIC_ASSERT(GR_ARRAY_COUNT(gTable) == kBasicStencilFuncCount);
+    GR_STATIC_ASSERT(SK_ARRAY_COUNT(gTable) == kBasicStencilFuncCount);
     GR_STATIC_ASSERT(0 == kAlways_StencilFunc);
     GR_STATIC_ASSERT(1 == kNever_StencilFunc);
     GR_STATIC_ASSERT(2 == kGreater_StencilFunc);
@@ -1884,7 +1884,7 @@ GrGLenum gr_to_gl_stencil_op(GrStencilOp op) {
         GR_GL_ZERO,        // kZero_StencilOp
         GR_GL_INVERT,      // kInvert_StencilOp
     };
-    GR_STATIC_ASSERT(GR_ARRAY_COUNT(gTable) == kStencilOpCount);
+    GR_STATIC_ASSERT(SK_ARRAY_COUNT(gTable) == kStencilOpCount);
     GR_STATIC_ASSERT(0 == kKeep_StencilOp);
     GR_STATIC_ASSERT(1 == kReplace_StencilOp);
     GR_STATIC_ASSERT(2 == kIncWrap_StencilOp);