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

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

Issue 1231163002: remove some unused stuff (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 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 | « gyp/gpu.gypi ('k') | src/gpu/GrTBSearch.h » ('j') | 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 2010 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 GrPlotMgr_DEFINED
9 #define GrPlotMgr_DEFINED
10
11 #include "GrTypes.h"
12 #include "SkTypes.h"
13
14 class GrPlotMgr : SkNoncopyable {
15 public:
16 GrPlotMgr(int width, int height) {
17 fDim.set(width, height);
18 size_t needed = width * height;
19 if (needed <= sizeof(fStorage)) {
20 fBusy = fStorage;
21 } else {
22 fBusy = SkNEW_ARRAY(char, needed);
23 }
24 this->reset();
25 }
26
27 ~GrPlotMgr() {
28 if (fBusy != fStorage) {
29 delete[] fBusy;
30 }
31 }
32
33 void reset() {
34 sk_bzero(fBusy, fDim.fX * fDim.fY);
35 }
36
37 bool newPlot(SkIPoint16* loc) {
38 char* busy = fBusy;
39 for (int y = 0; y < fDim.fY; y++) {
40 for (int x = 0; x < fDim.fX; x++) {
41 if (!*busy) {
42 *busy = true;
43 loc->set(x, y);
44 return true;
45 }
46 busy++;
47 }
48 }
49 return false;
50 }
51
52 bool isBusy(int x, int y) const {
53 SkASSERT((unsigned)x < (unsigned)fDim.fX);
54 SkASSERT((unsigned)y < (unsigned)fDim.fY);
55 return fBusy[y * fDim.fX + x] != 0;
56 }
57
58 void freePlot(int x, int y) {
59 SkASSERT((unsigned)x < (unsigned)fDim.fX);
60 SkASSERT((unsigned)y < (unsigned)fDim.fY);
61 fBusy[y * fDim.fX + x] = false;
62 }
63
64 private:
65 enum {
66 STORAGE = 64
67 };
68 char fStorage[STORAGE];
69 char* fBusy;
70 SkIPoint16 fDim;
71 };
72
73 #endif
OLDNEW
« no previous file with comments | « gyp/gpu.gypi ('k') | src/gpu/GrTBSearch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698