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

Side by Side Diff: gm/rrects.cpp

Issue 582963002: Solo gp (Closed) Base URL: https://skia.googlesource.com/skia.git@no_peb
Patch Set: fix Created 6 years, 3 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
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 "gm.h" 8 #include "gm.h"
9 #if SK_SUPPORT_GPU 9 #if SK_SUPPORT_GPU
10 #include "GrTest.h" 10 #include "GrTest.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 80
81 static const SkRect kMaxTileBound = SkRect::MakeWH(SkIntToScalar(kTileX) , 81 static const SkRect kMaxTileBound = SkRect::MakeWH(SkIntToScalar(kTileX) ,
82 SkIntToScalar(kTileY) ); 82 SkIntToScalar(kTileY) );
83 #ifdef SK_DEBUG 83 #ifdef SK_DEBUG
84 static const SkRect kMaxImageBound = SkRect::MakeWH(SkIntToScalar(kImage Width), 84 static const SkRect kMaxImageBound = SkRect::MakeWH(SkIntToScalar(kImage Width),
85 SkIntToScalar(kImage Height)); 85 SkIntToScalar(kImage Height));
86 #endif 86 #endif
87 87
88 #if SK_SUPPORT_GPU 88 #if SK_SUPPORT_GPU
89 int lastEdgeType = (kEffect_Type == fType) ? kLast_GrEffectEdgeType: 0; 89 int lastEdgeType = (kEffect_Type == fType) ? kLast_GrProcessorEdgeType: 0;
90 #else 90 #else
91 int lastEdgeType = 0; 91 int lastEdgeType = 0;
92 #endif 92 #endif
93 93
94 int y = 1; 94 int y = 1;
95 for (int et = 0; et <= lastEdgeType; ++et) { 95 for (int et = 0; et <= lastEdgeType; ++et) {
96 int x = 1; 96 int x = 1;
97 for (int curRRect = 0; curRRect < kNumRRects; ++curRRect) { 97 for (int curRRect = 0; curRRect < kNumRRects; ++curRRect) {
98 bool drew = true; 98 bool drew = true;
99 #ifdef SK_DEBUG 99 #ifdef SK_DEBUG
100 SkASSERT(kMaxTileBound.contains(fRRects[curRRect].getBounds())); 100 SkASSERT(kMaxTileBound.contains(fRRects[curRRect].getBounds()));
101 SkRect imageSpaceBounds = fRRects[curRRect].getBounds(); 101 SkRect imageSpaceBounds = fRRects[curRRect].getBounds();
102 imageSpaceBounds.offset(SkIntToScalar(x), SkIntToScalar(y)); 102 imageSpaceBounds.offset(SkIntToScalar(x), SkIntToScalar(y));
103 SkASSERT(kMaxImageBound.contains(imageSpaceBounds)); 103 SkASSERT(kMaxImageBound.contains(imageSpaceBounds));
104 #endif 104 #endif
105 canvas->save(); 105 canvas->save();
106 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); 106 canvas->translate(SkIntToScalar(x), SkIntToScalar(y));
107 if (kEffect_Type == fType) { 107 if (kEffect_Type == fType) {
108 #if SK_SUPPORT_GPU 108 #if SK_SUPPORT_GPU
109 GrTestTarget tt; 109 GrTestTarget tt;
110 context->getTestTarget(&tt); 110 context->getTestTarget(&tt);
111 if (NULL == tt.target()) { 111 if (NULL == tt.target()) {
112 SkDEBUGFAIL("Couldn't get Gr test target."); 112 SkDEBUGFAIL("Couldn't get Gr test target.");
113 return; 113 return;
114 } 114 }
115 GrDrawState* drawState = tt.target()->drawState(); 115 GrDrawState* drawState = tt.target()->drawState();
116 116
117 SkRRect rrect = fRRects[curRRect]; 117 SkRRect rrect = fRRects[curRRect];
118 rrect.offset(SkIntToScalar(x), SkIntToScalar(y)); 118 rrect.offset(SkIntToScalar(x), SkIntToScalar(y));
119 GrEffectEdgeType edgeType = (GrEffectEdgeType) et; 119 GrProcessorEdgeType edgeType = (GrProcessorEdgeType) et;
120 SkAutoTUnref<GrEffect> effect(GrRRectEffect::Create(edge Type, rrect)); 120 SkAutoTUnref<GrFragmentProcessor> fp(GrRRectEffect::Crea te(edgeType,
121 if (effect) { 121 rrect));
122 drawState->addCoverageEffect(effect); 122 if (fp) {
123 drawState->addCoverageProcessor(fp);
123 drawState->setIdentityViewMatrix(); 124 drawState->setIdentityViewMatrix();
124 drawState->setRenderTarget(rt); 125 drawState->setRenderTarget(rt);
125 drawState->setColor(0xff000000); 126 drawState->setColor(0xff000000);
126 127
127 SkRect bounds = rrect.getBounds(); 128 SkRect bounds = rrect.getBounds();
128 bounds.outset(2.f, 2.f); 129 bounds.outset(2.f, 2.f);
129 130
130 tt.target()->drawSimpleRect(bounds); 131 tt.target()->drawSimpleRect(bounds);
131 } else { 132 } else {
132 drew = false; 133 drew = false;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 262
262 DEF_GM( return new RRectGM(RRectGM::kAA_Draw_Type); ) 263 DEF_GM( return new RRectGM(RRectGM::kAA_Draw_Type); )
263 DEF_GM( return new RRectGM(RRectGM::kBW_Draw_Type); ) 264 DEF_GM( return new RRectGM(RRectGM::kBW_Draw_Type); )
264 DEF_GM( return new RRectGM(RRectGM::kAA_Clip_Type); ) 265 DEF_GM( return new RRectGM(RRectGM::kAA_Clip_Type); )
265 DEF_GM( return new RRectGM(RRectGM::kBW_Clip_Type); ) 266 DEF_GM( return new RRectGM(RRectGM::kBW_Clip_Type); )
266 #if SK_SUPPORT_GPU 267 #if SK_SUPPORT_GPU
267 DEF_GM( return new RRectGM(RRectGM::kEffect_Type); ) 268 DEF_GM( return new RRectGM(RRectGM::kEffect_Type); )
268 #endif 269 #endif
269 270
270 } 271 }
OLDNEW
« no previous file with comments | « gm/convexpolyeffect.cpp ('k') | gm/texdata.cpp » ('j') | include/gpu/GrGeometryProcessor.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698