| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrGLPath.h" | 9 #include "GrGLPath.h" |
| 10 #include "GrGpuGL.h" | 10 #include "GrGpuGL.h" |
| 11 | 11 |
| 12 #define GPUGL static_cast<GrGpuGL*>(this->getGpu()) | 12 #define GPUGL static_cast<GrGpuGL*>(this->getGpu()) |
| 13 | 13 |
| 14 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X) | 14 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X) |
| 15 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(GPUGL->glInterface(), R, X) | 15 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(GPUGL->glInterface(), R, X) |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 inline GrGLubyte verb_to_gl_path_cmd(const SkPath::Verb verb) { | 18 inline GrGLubyte verb_to_gl_path_cmd(const SkPath::Verb verb) { |
| 19 static const GrGLubyte gTable[] = { | 19 static const GrGLubyte gTable[] = { |
| 20 GR_GL_MOVE_TO, | 20 GR_GL_MOVE_TO, |
| 21 GR_GL_LINE_TO, | 21 GR_GL_LINE_TO, |
| 22 GR_GL_QUADRATIC_CURVE_TO, | 22 GR_GL_QUADRATIC_CURVE_TO, |
| 23 0xFF, // conic |
| 23 GR_GL_CUBIC_CURVE_TO, | 24 GR_GL_CUBIC_CURVE_TO, |
| 24 GR_GL_CLOSE_PATH, | 25 GR_GL_CLOSE_PATH, |
| 25 }; | 26 }; |
| 26 GR_STATIC_ASSERT(0 == SkPath::kMove_Verb); | 27 GR_STATIC_ASSERT(0 == SkPath::kMove_Verb); |
| 27 GR_STATIC_ASSERT(1 == SkPath::kLine_Verb); | 28 GR_STATIC_ASSERT(1 == SkPath::kLine_Verb); |
| 28 GR_STATIC_ASSERT(2 == SkPath::kQuad_Verb); | 29 GR_STATIC_ASSERT(2 == SkPath::kQuad_Verb); |
| 29 GR_STATIC_ASSERT(3 == SkPath::kCubic_Verb); | 30 GR_STATIC_ASSERT(4 == SkPath::kCubic_Verb); |
| 30 GR_STATIC_ASSERT(4 == SkPath::kClose_Verb); | 31 GR_STATIC_ASSERT(5 == SkPath::kClose_Verb); |
| 31 | 32 |
| 32 GrAssert(verb >= 0 && (size_t)verb < GR_ARRAY_COUNT(gTable)); | 33 GrAssert(verb >= 0 && (size_t)verb < GR_ARRAY_COUNT(gTable)); |
| 33 return gTable[verb]; | 34 return gTable[verb]; |
| 34 } | 35 } |
| 35 | 36 |
| 36 #ifdef SK_DEBUG | 37 #ifdef SK_DEBUG |
| 37 inline int num_pts(const SkPath::Verb verb) { | 38 inline int num_pts(const SkPath::Verb verb) { |
| 38 static const int gTable[] = { | 39 static const int gTable[] = { |
| 39 1, // move | 40 1, // move |
| 40 1, // line | 41 1, // line |
| 41 2, // quad | 42 2, // quad |
| 43 2, // conic |
| 42 3, // cubic | 44 3, // cubic |
| 43 0, // close | 45 0, // close |
| 44 }; | 46 }; |
| 45 GR_STATIC_ASSERT(0 == SkPath::kMove_Verb); | 47 GR_STATIC_ASSERT(0 == SkPath::kMove_Verb); |
| 46 GR_STATIC_ASSERT(1 == SkPath::kLine_Verb); | 48 GR_STATIC_ASSERT(1 == SkPath::kLine_Verb); |
| 47 GR_STATIC_ASSERT(2 == SkPath::kQuad_Verb); | 49 GR_STATIC_ASSERT(2 == SkPath::kQuad_Verb); |
| 48 GR_STATIC_ASSERT(3 == SkPath::kCubic_Verb); | 50 GR_STATIC_ASSERT(4 == SkPath::kCubic_Verb); |
| 49 GR_STATIC_ASSERT(4 == SkPath::kClose_Verb); | 51 GR_STATIC_ASSERT(5 == SkPath::kClose_Verb); |
| 50 | 52 |
| 51 GrAssert(verb >= 0 && (size_t)verb < GR_ARRAY_COUNT(gTable)); | 53 GrAssert(verb >= 0 && (size_t)verb < GR_ARRAY_COUNT(gTable)); |
| 52 return gTable[verb]; | 54 return gTable[verb]; |
| 53 } | 55 } |
| 54 #endif | 56 #endif |
| 55 } | 57 } |
| 56 | 58 |
| 57 static const bool kIsWrapped = false; // The constructor creates the GL path obj
ect. | 59 static const bool kIsWrapped = false; // The constructor creates the GL path obj
ect. |
| 58 | 60 |
| 59 GrGLPath::GrGLPath(GrGpuGL* gpu, const SkPath& path) : INHERITED(gpu, kIsWrapped
) { | 61 GrGLPath::GrGLPath(GrGpuGL* gpu, const SkPath& path) : INHERITED(gpu, kIsWrapped
) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } | 102 } |
| 101 | 103 |
| 102 INHERITED::onRelease(); | 104 INHERITED::onRelease(); |
| 103 } | 105 } |
| 104 | 106 |
| 105 void GrGLPath::onAbandon() { | 107 void GrGLPath::onAbandon() { |
| 106 fPathID = 0; | 108 fPathID = 0; |
| 107 | 109 |
| 108 INHERITED::onAbandon(); | 110 INHERITED::onAbandon(); |
| 109 } | 111 } |
| OLD | NEW |