| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrAARectRenderer.h" | 8 #include "GrAARectRenderer.h" |
| 9 #include "GrGpu.h" | 9 #include "GrGpu.h" |
| 10 #include "gl/builders/GrGLFullProgramBuilder.h" | 10 #include "gl/builders/GrGLSkiaProgramBuilder.h" |
| 11 #include "gl/GrGLProcessor.h" | 11 #include "gl/GrGLProcessor.h" |
| 12 #include "gl/GrGLGeometryProcessor.h" | 12 #include "gl/GrGLGeometryProcessor.h" |
| 13 #include "GrTBackendProcessorFactory.h" | 13 #include "GrTBackendProcessorFactory.h" |
| 14 #include "SkColorPriv.h" | 14 #include "SkColorPriv.h" |
| 15 #include "GrGeometryProcessor.h" | 15 #include "GrGeometryProcessor.h" |
| 16 | 16 |
| 17 /////////////////////////////////////////////////////////////////////////////// | 17 /////////////////////////////////////////////////////////////////////////////// |
| 18 class GrGLAlignedRectEffect; | 18 class GrGLAlignedRectEffect; |
| 19 | 19 |
| 20 // Axis Aligned special case | 20 // Axis Aligned special case |
| (...skipping 18 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE { | 40 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE { |
| 41 return GrTBackendGeometryProcessorFactory<GrAlignedRectEffect>::getInsta
nce(); | 41 return GrTBackendGeometryProcessorFactory<GrAlignedRectEffect>::getInsta
nce(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 class GLProcessor : public GrGLGeometryProcessor { | 44 class GLProcessor : public GrGLGeometryProcessor { |
| 45 public: | 45 public: |
| 46 GLProcessor(const GrBackendProcessorFactory& factory, const GrProcessor&
) | 46 GLProcessor(const GrBackendProcessorFactory& factory, const GrProcessor&
) |
| 47 : INHERITED (factory) {} | 47 : INHERITED (factory) {} |
| 48 | 48 |
| 49 virtual void emitCode(GrGLFullProgramBuilder* builder, | 49 virtual void emitCode(GrGLGeometryProcessorProgramBuilder* builder, |
| 50 const GrGeometryProcessor& geometryProcessor, | 50 const GrGeometryProcessor& geometryProcessor, |
| 51 const GrProcessorKey& key, | 51 const GrProcessorKey& key, |
| 52 const char* outputColor, | 52 const char* outputColor, |
| 53 const char* inputColor, | 53 const char* inputColor, |
| 54 const TransformedCoordsArray&, | 54 const TransformedCoordsArray&, |
| 55 const TextureSamplerArray& samplers) SK_OVERRIDE { | 55 const TextureSamplerArray& samplers) SK_OVERRIDE { |
| 56 // setup the varying for the Axis aligned rect effect | 56 // setup the varying for the Axis aligned rect effect |
| 57 // xy -> interpolated offset | 57 // xy -> interpolated offset |
| 58 // zw -> w/2+0.5, h/2+0.5 | 58 // zw -> w/2+0.5, h/2+0.5 |
| 59 const char *vsRectName, *fsRectName; | 59 const char *vsRectName, *fsRectName; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE { | 166 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE { |
| 167 return GrTBackendGeometryProcessorFactory<GrRectEffect>::getInstance(); | 167 return GrTBackendGeometryProcessorFactory<GrRectEffect>::getInstance(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 class GLProcessor : public GrGLGeometryProcessor { | 170 class GLProcessor : public GrGLGeometryProcessor { |
| 171 public: | 171 public: |
| 172 GLProcessor(const GrBackendProcessorFactory& factory, const GrProcessor&
) | 172 GLProcessor(const GrBackendProcessorFactory& factory, const GrProcessor&
) |
| 173 : INHERITED (factory) {} | 173 : INHERITED (factory) {} |
| 174 | 174 |
| 175 virtual void emitCode(GrGLFullProgramBuilder* builder, | 175 virtual void emitCode(GrGLGeometryProcessorProgramBuilder* builder, |
| 176 const GrGeometryProcessor& geometryProcessor, | 176 const GrGeometryProcessor& geometryProcessor, |
| 177 const GrProcessorKey& key, | 177 const GrProcessorKey& key, |
| 178 const char* outputColor, | 178 const char* outputColor, |
| 179 const char* inputColor, | 179 const char* inputColor, |
| 180 const TransformedCoordsArray&, | 180 const TransformedCoordsArray&, |
| 181 const TextureSamplerArray& samplers) SK_OVERRIDE { | 181 const TextureSamplerArray& samplers) SK_OVERRIDE { |
| 182 // setup the varying for the center point and the unit vector | 182 // setup the varying for the center point and the unit vector |
| 183 // that points down the height of the rect | 183 // that points down the height of the rect |
| 184 const char *vsRectEdgeName, *fsRectEdgeName; | 184 const char *vsRectEdgeName, *fsRectEdgeName; |
| 185 builder->addVarying(kVec4f_GrSLType, "RectEdge", | 185 builder->addVarying(kVec4f_GrSLType, "RectEdge", |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 // can't call mapRect for devInside since it calls sort | 963 // can't call mapRect for devInside since it calls sort |
| 964 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2)
; | 964 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2)
; |
| 965 | 965 |
| 966 if (devInside.isEmpty()) { | 966 if (devInside.isEmpty()) { |
| 967 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside); | 967 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside); |
| 968 return; | 968 return; |
| 969 } | 969 } |
| 970 | 970 |
| 971 this->geometryStrokeAARect(gpu, target, devOutside, devOutsideAssist, devIns
ide, true); | 971 this->geometryStrokeAARect(gpu, target, devOutside, devOutsideAssist, devIns
ide, true); |
| 972 } | 972 } |
| OLD | NEW |