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

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

Issue 309683002: Move GrIPoint16 to SkIPoint16 (and remove GrPoint.h) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT Created 6 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 | « src/gpu/GrPathUtils.cpp ('k') | src/gpu/GrRectanizer.h » ('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 2010 Google Inc. 2 * Copyright 2010 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 #ifndef GrPlotMgr_DEFINED 8 #ifndef GrPlotMgr_DEFINED
9 #define GrPlotMgr_DEFINED 9 #define GrPlotMgr_DEFINED
10 10
11 #include "GrTypes.h" 11 #include "GrTypes.h"
12 #include "GrPoint.h"
13 #include "SkTypes.h" 12 #include "SkTypes.h"
14 13
15 class GrPlotMgr : SkNoncopyable { 14 class GrPlotMgr : SkNoncopyable {
16 public: 15 public:
17 GrPlotMgr(int width, int height) { 16 GrPlotMgr(int width, int height) {
18 fDim.set(width, height); 17 fDim.set(width, height);
19 size_t needed = width * height; 18 size_t needed = width * height;
20 if (needed <= sizeof(fStorage)) { 19 if (needed <= sizeof(fStorage)) {
21 fBusy = fStorage; 20 fBusy = fStorage;
22 } else { 21 } else {
23 fBusy = SkNEW_ARRAY(char, needed); 22 fBusy = SkNEW_ARRAY(char, needed);
24 } 23 }
25 this->reset(); 24 this->reset();
26 } 25 }
27 26
28 ~GrPlotMgr() { 27 ~GrPlotMgr() {
29 if (fBusy != fStorage) { 28 if (fBusy != fStorage) {
30 delete[] fBusy; 29 delete[] fBusy;
31 } 30 }
32 } 31 }
33 32
34 void reset() { 33 void reset() {
35 sk_bzero(fBusy, fDim.fX * fDim.fY); 34 sk_bzero(fBusy, fDim.fX * fDim.fY);
36 } 35 }
37 36
38 bool newPlot(GrIPoint16* loc) { 37 bool newPlot(SkIPoint16* loc) {
39 char* busy = fBusy; 38 char* busy = fBusy;
40 for (int y = 0; y < fDim.fY; y++) { 39 for (int y = 0; y < fDim.fY; y++) {
41 for (int x = 0; x < fDim.fX; x++) { 40 for (int x = 0; x < fDim.fX; x++) {
42 if (!*busy) { 41 if (!*busy) {
43 *busy = true; 42 *busy = true;
44 loc->set(x, y); 43 loc->set(x, y);
45 return true; 44 return true;
46 } 45 }
47 busy++; 46 busy++;
48 } 47 }
(...skipping 12 matching lines...) Expand all
61 SkASSERT((unsigned)y < (unsigned)fDim.fY); 60 SkASSERT((unsigned)y < (unsigned)fDim.fY);
62 fBusy[y * fDim.fX + x] = false; 61 fBusy[y * fDim.fX + x] = false;
63 } 62 }
64 63
65 private: 64 private:
66 enum { 65 enum {
67 STORAGE = 64 66 STORAGE = 64
68 }; 67 };
69 char fStorage[STORAGE]; 68 char fStorage[STORAGE];
70 char* fBusy; 69 char* fBusy;
71 GrIPoint16 fDim; 70 SkIPoint16 fDim;
72 }; 71 };
73 72
74 #endif 73 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrPathUtils.cpp ('k') | src/gpu/GrRectanizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698