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

Side by Side Diff: gm/patch.cpp

Issue 424663006: SkCanvas interface for drawing a patch. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added array constructor for FwDCubicEvaluator Created 6 years, 4 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
« no previous file with comments | « no previous file | include/core/SkCanvas.h » ('j') | src/core/SkDevice.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | include/core/SkCanvas.h » ('j') | src/core/SkDevice.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698