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 19 matching lines...) Expand all Loading... | |
30 protected: | 30 protected: |
31 virtual SkString onShortName() SK_OVERRIDE { | 31 virtual SkString onShortName() SK_OVERRIDE { |
32 return SkString("patch_primitive"); | 32 return SkString("patch_primitive"); |
33 } | 33 } |
34 | 34 |
35 virtual SkISize onISize() SK_OVERRIDE { | 35 virtual SkISize onISize() SK_OVERRIDE { |
36 return SkISize::Make(800, 800); | 36 return SkISize::Make(800, 800); |
37 } | 37 } |
38 | 38 |
39 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 39 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
40 return kGPUOnly_Flag; | 40 return kSkipTiled_Flag | kSkipPipe_Flag | kSkipPicture_Flag; |
41 } | 41 } |
42 | 42 |
43 | |
44 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 43 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
45 | 44 |
46 SkPaint paint; | 45 SkPaint paint; |
46 | |
47 SkColor colors[4] = { | 47 SkColor colors[4] = { |
48 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorCYAN | 48 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorCYAN |
49 }; | 49 }; |
50 SkPoint points[] = { | 50 SkPoint points[12] = { |
51 {100,100},{130,50},{500,70}, {650,60}, | 51 {100,100},{130,50},{500,70}, {650,60}, |
52 {350,125},{490,555},{600,700}, | 52 {350,125},{490,555},{600,700}, |
53 {515,595},{140,550},{110,590}, | 53 {515,595},{140,550},{110,590}, |
54 {125,400},{70,150} | 54 {125,400},{70,150} |
55 | |
56 }; | 55 }; |
57 | 56 |
58 SkPatch coons(points, colors); | 57 SkPatch coons(points, colors); |
59 | 58 canvas->scale(1.3f, 1.f); |
bsalomon
2014/07/31 17:39:06
Might need some more test cases here with differen
| |
60 SkPatch::VertexData data; | 59 canvas->drawPatch(coons, paint); |
61 coons.getVertexData(&data, 10); | |
62 | |
63 canvas->drawVertices(SkCanvas::kTriangles_VertexMode,data.fVertexCount, | |
64 data.fPoints, data.fTexCoords, data.fColors, NULL, data.fIndices, | |
65 data.fIndexCount, paint); | |
66 | 60 |
67 //draw control points | 61 //draw control points |
68 SkPoint bottom[4]; | 62 SkPoint bottom[4]; |
69 coons.getBottomPoints(bottom); | 63 coons.getBottomPoints(bottom); |
70 SkPoint top[4]; | 64 SkPoint top[4]; |
71 coons.getTopPoints(top); | 65 coons.getTopPoints(top); |
72 SkPoint left[4]; | 66 SkPoint left[4]; |
73 coons.getLeftPoints(left); | 67 coons.getLeftPoints(left); |
74 SkPoint right[4]; | 68 SkPoint right[4]; |
75 coons.getRightPoints(right); | 69 coons.getRightPoints(right); |
(...skipping 29 matching lines...) Expand all Loading... | |
105 | 99 |
106 private: | 100 private: |
107 typedef GM INHERITED; | 101 typedef GM INHERITED; |
108 }; | 102 }; |
109 | 103 |
110 DEF_GM( return SkNEW(SkPatchGM); ) | 104 DEF_GM( return SkNEW(SkPatchGM); ) |
111 | 105 |
112 } | 106 } |
113 | 107 |
114 #endif | 108 #endif |
OLD | NEW |