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

Side by Side Diff: samplecode/SampleAtlas.cpp

Issue 1216433002: implement drawAtlas natively on gpu-device (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use SkRect::toQuad Created 5 years, 6 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 | src/core/SkMatrix.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkAnimTimer.h" 9 #include "SkAnimTimer.h"
10 #include "SkView.h" 10 #include "SkView.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 void advance(const SkRect& bounds) { 61 void advance(const SkRect& bounds) {
62 fCenter += fVelocity; 62 fCenter += fVelocity;
63 if (fCenter.fX > bounds.right()) { 63 if (fCenter.fX > bounds.right()) {
64 SkASSERT(fVelocity.fX > 0); 64 SkASSERT(fVelocity.fX > 0);
65 fVelocity.fX = -fVelocity.fX; 65 fVelocity.fX = -fVelocity.fX;
66 } else if (fCenter.fX < bounds.left()) { 66 } else if (fCenter.fX < bounds.left()) {
67 SkASSERT(fVelocity.fX < 0); 67 SkASSERT(fVelocity.fX < 0);
68 fVelocity.fX = -fVelocity.fX; 68 fVelocity.fX = -fVelocity.fX;
69 } 69 }
70 if (fCenter.fY > bounds.bottom()) { 70 if (fCenter.fY > bounds.bottom()) {
71 SkASSERT(fVelocity.fY > 0); 71 if (fVelocity.fY > 0) {
72 fVelocity.fY = -fVelocity.fY; 72 fVelocity.fY = -fVelocity.fY;
73 }
73 } else if (fCenter.fY < bounds.top()) { 74 } else if (fCenter.fY < bounds.top()) {
74 SkASSERT(fVelocity.fY < 0); 75 if (fVelocity.fY < 0) {
75 fVelocity.fY = -fVelocity.fY; 76 fVelocity.fY = -fVelocity.fY;
77 }
76 } 78 }
77 79
78 fScale += fDScale; 80 fScale += fDScale;
79 if (fScale > 2 || fScale < SK_Scalar1/2) { 81 if (fScale > 2 || fScale < SK_Scalar1/2) {
80 fDScale = -fDScale; 82 fDScale = -fDScale;
81 } 83 }
82 84
83 fRadian += fDRadian; 85 fRadian += fDRadian;
84 fRadian = SkScalarMod(fRadian, 2 * SK_ScalarPI); 86 fRadian = SkScalarMod(fRadian, 2 * SK_ScalarPI);
85 87
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 #endif 227 #endif
226 228
227 private: 229 private:
228 typedef SampleView INHERITED; 230 typedef SampleView INHERITED;
229 }; 231 };
230 232
231 ////////////////////////////////////////////////////////////////////////////// 233 //////////////////////////////////////////////////////////////////////////////
232 234
233 static SkView* MyFactory() { return new DrawAtlasView; } 235 static SkView* MyFactory() { return new DrawAtlasView; }
234 static SkViewRegister reg(MyFactory); 236 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « no previous file | src/core/SkMatrix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698