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

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

Issue 24853002: Make GPU coord transforms automatic (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 2 months 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrClipMaskManager.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "gl/GrGLEffect.h" 10 #include "gl/GrGLEffect.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 class GLEffect : public GrGLEffect { 42 class GLEffect : public GrGLEffect {
43 public: 43 public:
44 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) 44 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&)
45 : INHERITED (factory) {} 45 : INHERITED (factory) {}
46 46
47 virtual void emitCode(GrGLShaderBuilder* builder, 47 virtual void emitCode(GrGLShaderBuilder* builder,
48 const GrDrawEffect& drawEffect, 48 const GrDrawEffect& drawEffect,
49 EffectKey key, 49 EffectKey key,
50 const char* outputColor, 50 const char* outputColor,
51 const char* inputColor, 51 const char* inputColor,
52 const TransformedCoordsArray&,
52 const TextureSamplerArray& samplers) SK_OVERRIDE { 53 const TextureSamplerArray& samplers) SK_OVERRIDE {
53 GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder->getVertex Builder(); 54 GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder->getVertex Builder();
54 SkASSERT(NULL != vertexBuilder); 55 SkASSERT(NULL != vertexBuilder);
55 56
56 // setup the varying for the Axis aligned rect effect 57 // setup the varying for the Axis aligned rect effect
57 // xy -> interpolated offset 58 // xy -> interpolated offset
58 // zw -> w/2+0.5, h/2+0.5 59 // zw -> w/2+0.5, h/2+0.5
59 const char *vsRectName, *fsRectName; 60 const char *vsRectName, *fsRectName;
60 vertexBuilder->addVarying(kVec4f_GrSLType, "Rect", &vsRectName, &fsR ectName); 61 vertexBuilder->addVarying(kVec4f_GrSLType, "Rect", &vsRectName, &fsR ectName);
61 const SkString* attr0Name = 62 const SkString* attr0Name =
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 class GLEffect : public GrGLEffect { 163 class GLEffect : public GrGLEffect {
163 public: 164 public:
164 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) 165 GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&)
165 : INHERITED (factory) {} 166 : INHERITED (factory) {}
166 167
167 virtual void emitCode(GrGLShaderBuilder* builder, 168 virtual void emitCode(GrGLShaderBuilder* builder,
168 const GrDrawEffect& drawEffect, 169 const GrDrawEffect& drawEffect,
169 EffectKey key, 170 EffectKey key,
170 const char* outputColor, 171 const char* outputColor,
171 const char* inputColor, 172 const char* inputColor,
173 const TransformedCoordsArray&,
172 const TextureSamplerArray& samplers) SK_OVERRIDE { 174 const TextureSamplerArray& samplers) SK_OVERRIDE {
173 GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder->getVertex Builder(); 175 GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder->getVertex Builder();
174 SkASSERT(NULL != vertexBuilder); 176 SkASSERT(NULL != vertexBuilder);
175 177
176 // setup the varying for the center point and the unit vector 178 // setup the varying for the center point and the unit vector
177 // that points down the height of the rect 179 // that points down the height of the rect
178 const char *vsRectEdgeName, *fsRectEdgeName; 180 const char *vsRectEdgeName, *fsRectEdgeName;
179 vertexBuilder->addVarying(kVec4f_GrSLType, "RectEdge", 181 vertexBuilder->addVarying(kVec4f_GrSLType, "RectEdge",
180 &vsRectEdgeName, &fsRectEdgeName); 182 &vsRectEdgeName, &fsRectEdgeName);
181 const SkString* attr0Name = 183 const SkString* attr0Name =
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 // can't call mapRect for devInside since it calls sort 811 // can't call mapRect for devInside since it calls sort
810 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2) ; 812 combinedMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2) ;
811 813
812 if (devInside.isEmpty()) { 814 if (devInside.isEmpty()) {
813 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside, use VertexCoverage); 815 this->fillAARect(gpu, target, devOutside, SkMatrix::I(), devOutside, use VertexCoverage);
814 return; 816 return;
815 } 817 }
816 818
817 this->geometryStrokeAARect(gpu, target, devOutside, devInside, useVertexCove rage); 819 this->geometryStrokeAARect(gpu, target, devOutside, devInside, useVertexCove rage);
818 } 820 }
OLDNEW
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrClipMaskManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698