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

Side by Side Diff: src/gpu/GrQuad.h

Issue 1294713009: Create GrQuad (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef GrQuad_DEFINED
9 #define GrQuad_DEFINED
10
11 #include "SkPoint.h"
12 #include "SkMatrix.h"
13
14 /**
15 * GrQuad is a collection of 4 points which can be used to represent an arbitrar y quadrilateral
16 */
17 class GrQuad {
18 public:
bsalomon 2015/08/19 14:20:04 Constructor from rect?
19 GrQuad(const GrQuad& that) {
bsalomon 2015/08/19 14:20:04 op =?
20 memcpy(fPoints, that.fPoints, sizeof(SkPoint) * kNumPoints);
21 }
22
23 void set(const SkRect& rect) {
24 fPoints->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
25 }
26
27 void map(const SkMatrix& viewMatrix) {
bsalomon 2015/08/19 14:20:04 This isn't necessarily a "view" matrix, just a mat
28 viewMatrix.mapPoints(fPoints, kNumPoints);
29 }
30
31 void map(const SkRect& rect, const SkMatrix& viewMatrix) {
32 this->set(rect);
33 viewMatrix.mapPoints(fPoints, kNumPoints);
34 }
35
36 operator SkPoint*() {
bsalomon 2015/08/19 14:20:04 Hm... not sure I love the auto-conversion to SkPoi
37 return fPoints;
38 }
39
40 private:
41 static const int kNumPoints = 4;
42 SkPoint fPoints[kNumPoints];
43 };
44
45 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698