Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 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 // This test only works with the GPU backend. | 9 // This test only works with the GPU backend. |
| 10 | 10 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 // vertically/horizontally thin rects that don't cover pixel centers | 140 // vertically/horizontally thin rects that don't cover pixel centers |
| 141 fRects.addToTail(SkRect::MakeLTRB(5.55f, 0.5f, 5.75f, 24.5f)); | 141 fRects.addToTail(SkRect::MakeLTRB(5.55f, 0.5f, 5.75f, 24.5f)); |
| 142 fRects.addToTail(SkRect::MakeLTRB(5.5f, .05f, 29.5f, .25f)); | 142 fRects.addToTail(SkRect::MakeLTRB(5.5f, .05f, 29.5f, .25f)); |
| 143 // small in x and y | 143 // small in x and y |
| 144 fRects.addToTail(SkRect::MakeLTRB(5.05f, .55f, 5.45f, .85f)); | 144 fRects.addToTail(SkRect::MakeLTRB(5.05f, .55f, 5.45f, .85f)); |
| 145 // inverted in x and y | 145 // inverted in x and y |
| 146 fRects.addToTail(SkRect::MakeLTRB(100.f, 50.5f, 5.f, 0.5f)); | 146 fRects.addToTail(SkRect::MakeLTRB(100.f, 50.5f, 5.f, 0.5f)); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void onDraw(SkCanvas* canvas) override { | 149 void onDraw(SkCanvas* canvas) override { |
| 150 using namespace GrDefaultGeoProcFactory; | |
| 150 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget (); | 151 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget (); |
| 151 if (NULL == rt) { | 152 if (NULL == rt) { |
| 152 this->drawGpuOnlyMessage(canvas); | 153 this->drawGpuOnlyMessage(canvas); |
| 153 return; | 154 return; |
| 154 } | 155 } |
| 155 GrContext* context = rt->getContext(); | 156 GrContext* context = rt->getContext(); |
| 156 if (NULL == context) { | 157 if (NULL == context) { |
| 157 return; | 158 return; |
| 158 } | 159 } |
| 159 | 160 |
| 160 static const GrColor color = 0xff000000; | 161 GrColor color = 0xff000000; |
|
robertphillips
2015/07/29 13:09:44
"Color gpColor(0xFF000000);" ?
| |
| 162 Color gpColor(color); | |
| 163 Coverage coverage(Coverage::kSolid_Type); | |
| 164 LocalCoords localCoords(LocalCoords::kUnused_Type); | |
| 161 SkAutoTUnref<const GrGeometryProcessor> gp( | 165 SkAutoTUnref<const GrGeometryProcessor> gp( |
| 162 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPositi on_GPType, color, | 166 GrDefaultGeoProcFactory::Create(gpColor, coverage, localCoords)) ; |
| 163 false, false)); | |
| 164 | 167 |
| 165 SkScalar y = 0; | 168 SkScalar y = 0; |
| 166 for (SkTLList<SkPath>::Iter iter(fPaths, SkTLList<SkPath>::Iter::kHead_I terStart); | 169 for (SkTLList<SkPath>::Iter iter(fPaths, SkTLList<SkPath>::Iter::kHead_I terStart); |
| 167 iter.get(); | 170 iter.get(); |
| 168 iter.next()) { | 171 iter.next()) { |
| 169 const SkPath* path = iter.get(); | 172 const SkPath* path = iter.get(); |
| 170 SkScalar x = 0; | 173 SkScalar x = 0; |
| 171 | 174 |
| 172 for (int et = 0; et < kGrProcessorEdgeTypeCnt; ++et) { | 175 for (int et = 0; et < kGrProcessorEdgeTypeCnt; ++et) { |
| 173 GrTestTarget tt; | 176 GrTestTarget tt; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 SkTLList<SkPath> fPaths; | 271 SkTLList<SkPath> fPaths; |
| 269 SkTLList<SkRect> fRects; | 272 SkTLList<SkRect> fRects; |
| 270 | 273 |
| 271 typedef GM INHERITED; | 274 typedef GM INHERITED; |
| 272 }; | 275 }; |
| 273 | 276 |
| 274 DEF_GM( return SkNEW(ConvexPolyEffect); ) | 277 DEF_GM( return SkNEW(ConvexPolyEffect); ) |
| 275 } | 278 } |
| 276 | 279 |
| 277 #endif | 280 #endif |
| OLD | NEW |