Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(785)

Side by Side Diff: src/gpu/GrAARectRenderer.cpp

Issue 699943003: Move GrInvariantOutput out of GrProcessor and into its own class. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "GrInvariantOutput.h"
10 #include "gl/builders/GrGLProgramBuilder.h" 11 #include "gl/builders/GrGLProgramBuilder.h"
11 #include "gl/GrGLProcessor.h" 12 #include "gl/GrGLProcessor.h"
12 #include "gl/GrGLGeometryProcessor.h" 13 #include "gl/GrGLGeometryProcessor.h"
13 #include "GrTBackendProcessorFactory.h" 14 #include "GrTBackendProcessorFactory.h"
14 #include "SkColorPriv.h" 15 #include "SkColorPriv.h"
15 #include "GrGeometryProcessor.h" 16 #include "GrGeometryProcessor.h"
16 17
17 /////////////////////////////////////////////////////////////////////////////// 18 ///////////////////////////////////////////////////////////////////////////////
18 class GrGLAlignedRectEffect; 19 class GrGLAlignedRectEffect;
19 20
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 GrAlignedRectEffect() 95 GrAlignedRectEffect()
95 : fInRect(this->addVertexAttrib(GrShaderVar("inRect", 96 : fInRect(this->addVertexAttrib(GrShaderVar("inRect",
96 kVec4f_GrSLType, 97 kVec4f_GrSLType,
97 GrShaderVar::kAttribute_Type Modifier))) { 98 GrShaderVar::kAttribute_Type Modifier))) {
98 } 99 }
99 100
100 const GrShaderVar& fInRect; 101 const GrShaderVar& fInRect;
101 102
102 virtual bool onIsEqual(const GrGeometryProcessor&) const SK_OVERRIDE { retur n true; } 103 virtual bool onIsEqual(const GrGeometryProcessor&) const SK_OVERRIDE { retur n true; }
103 104
104 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE { 105 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE {
105 inout->mulByUnknownAlpha(); 106 inout->mulByUnknownAlpha();
106 } 107 }
107 108
108 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 109 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
109 110
110 typedef GrGeometryProcessor INHERITED; 111 typedef GrGeometryProcessor INHERITED;
111 }; 112 };
112 113
113 114
114 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrAlignedRectEffect); 115 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrAlignedRectEffect);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 GrShaderVar::kAttribute_ TypeModifier))) 231 GrShaderVar::kAttribute_ TypeModifier)))
231 , fInWidthHeight(this->addVertexAttrib( 232 , fInWidthHeight(this->addVertexAttrib(
232 GrShaderVar("inWidthHeight", 233 GrShaderVar("inWidthHeight",
233 kVec2f_GrSLType, 234 kVec2f_GrSLType,
234 GrShaderVar::kAttribute_TypeModifier))) { 235 GrShaderVar::kAttribute_TypeModifier))) {
235 this->setWillReadFragmentPosition(); 236 this->setWillReadFragmentPosition();
236 } 237 }
237 238
238 virtual bool onIsEqual(const GrGeometryProcessor&) const SK_OVERRIDE { retur n true; } 239 virtual bool onIsEqual(const GrGeometryProcessor&) const SK_OVERRIDE { retur n true; }
239 240
240 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE { 241 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE {
241 inout->mulByUnknownAlpha(); 242 inout->mulByUnknownAlpha();
242 } 243 }
243 244
244 const GrShaderVar& fInRectEdge; 245 const GrShaderVar& fInRectEdge;
245 const GrShaderVar& fInWidthHeight; 246 const GrShaderVar& fInWidthHeight;
246 247
247 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 248 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
248 249
249 typedef GrGeometryProcessor INHERITED; 250 typedef GrGeometryProcessor INHERITED;
250 }; 251 };
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 // can't call mapRect for devInside since it calls sort 911 // can't call mapRect for devInside since it calls sort
911 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2) ; 912 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2) ;
912 913
913 if (devInside.isEmpty()) { 914 if (devInside.isEmpty()) {
914 this->fillAARect(target, devOutside, SkMatrix::I(), devOutside); 915 this->fillAARect(target, devOutside, SkMatrix::I(), devOutside);
915 return; 916 return;
916 } 917 }
917 918
918 this->geometryStrokeAARect(target, devOutside, devOutsideAssist, devInside, true); 919 this->geometryStrokeAARect(target, devOutside, devOutsideAssist, devInside, true);
919 } 920 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698