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

Side by Side Diff: gm/beziereffects.cpp

Issue 216503004: SK_SUPPORT_LEGACY_GRTYPES to hide duplicate types from SkTypes.h (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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 | « no previous file | include/gpu/GrContext.h » ('j') | include/gpu/GrPoint.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 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
11 #include "gm.h" 11 #include "gm.h"
12 12
13 #if SK_SUPPORT_GPU 13 #if SK_SUPPORT_GPU
14 14
15 #include "GrContext.h" 15 #include "GrContext.h"
16 #include "GrPathUtils.h" 16 #include "GrPathUtils.h"
17 #include "GrTest.h" 17 #include "GrTest.h"
18 #include "SkColorPriv.h" 18 #include "SkColorPriv.h"
19 #include "SkDevice.h" 19 #include "SkDevice.h"
20 #include "SkGeometry.h" 20 #include "SkGeometry.h"
21 21
22 #include "effects/GrBezierEffect.h" 22 #include "effects/GrBezierEffect.h"
23 23
24 // Position & KLM line eq values. These are the vertex attributes for Bezier cur ves. The last value 24 // Position & KLM line eq values. These are the vertex attributes for Bezier cur ves. The last value
25 // of the Vec4f is ignored. 25 // of the Vec4f is ignored.
26 namespace { 26 namespace {
27 extern const GrVertexAttrib kAttribs[] = { 27 extern const GrVertexAttrib kAttribs[] = {
28 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding}, 28 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding},
29 {kVec4f_GrVertexAttribType, sizeof(GrPoint), kEffect_GrVertexAttribBinding} 29 {kVec4f_GrVertexAttribType, sizeof(SkPoint), kEffect_GrVertexAttribBinding}
30 }; 30 };
31 } 31 }
32 32
33 static inline SkScalar eval_line(const SkPoint& p, const SkScalar lineEq[3], SkS calar sign) { 33 static inline SkScalar eval_line(const SkPoint& p, const SkScalar lineEq[3], SkS calar sign) {
34 return sign * (lineEq[0] * p.fX + lineEq[1] * p.fY + lineEq[2]); 34 return sign * (lineEq[0] * p.fX + lineEq[1] * p.fY + lineEq[2]);
35 } 35 }
36 36
37 namespace skiagm { 37 namespace skiagm {
38 /** 38 /**
39 * This GM directly exercises effects that draw Bezier curves in the GPU backend . 39 * This GM directly exercises effects that draw Bezier curves in the GPU backend .
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 boundsPaint.setStrokeWidth(0); 494 boundsPaint.setStrokeWidth(0);
495 boundsPaint.setStyle(SkPaint::kStroke_Style); 495 boundsPaint.setStyle(SkPaint::kStroke_Style);
496 canvas->drawRect(bounds, boundsPaint); 496 canvas->drawRect(bounds, boundsPaint);
497 497
498 Vertex verts[4]; 498 Vertex verts[4];
499 verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop, 499 verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop,
500 bounds.fRight, bounds.fBottom, 500 bounds.fRight, bounds.fBottom,
501 sizeof(Vertex)); 501 sizeof(Vertex));
502 502
503 GrPathUtils::QuadUVMatrix DevToUV(pts); 503 GrPathUtils::QuadUVMatrix DevToUV(pts);
504 DevToUV.apply<4, sizeof(Vertex), sizeof(GrPoint)>(verts); 504 DevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts);
505 505
506 GrTestTarget tt; 506 GrTestTarget tt;
507 context->getTestTarget(&tt); 507 context->getTestTarget(&tt);
508 SkASSERT(NULL != tt.target()); 508 SkASSERT(NULL != tt.target());
509 GrDrawState* drawState = tt.target()->drawState(); 509 GrDrawState* drawState = tt.target()->drawState();
510 drawState->setVertexAttribs<kAttribs>(2); 510 drawState->setVertexAttribs<kAttribs>(2);
511 511
512 drawState->addCoverageEffect(effect, 1); 512 drawState->addCoverageEffect(effect, 1);
513 drawState->setRenderTarget(rt); 513 drawState->setRenderTarget(rt);
514 drawState->setColor(0xff000000); 514 drawState->setColor(0xff000000);
(...skipping 15 matching lines...) Expand all
530 typedef GM INHERITED; 530 typedef GM INHERITED;
531 }; 531 };
532 532
533 DEF_GM( return SkNEW(BezierCubicEffects); ) 533 DEF_GM( return SkNEW(BezierCubicEffects); )
534 DEF_GM( return SkNEW(BezierConicEffects); ) 534 DEF_GM( return SkNEW(BezierConicEffects); )
535 DEF_GM( return SkNEW(BezierQuadEffects); ) 535 DEF_GM( return SkNEW(BezierQuadEffects); )
536 536
537 } 537 }
538 538
539 #endif 539 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrContext.h » ('j') | include/gpu/GrPoint.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698