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

Side by Side Diff: src/core/SkTileGrid.h

Issue 634543004: Start to vectorize SkTileGrid. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 6 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 SkTileGrid_DEFINED 8 #ifndef SkTileGrid_DEFINED
9 #define SkTileGrid_DEFINED 9 #define SkTileGrid_DEFINED
10 10
11 #include "Sk4x.h"
11 #include "SkBBHFactory.h" 12 #include "SkBBHFactory.h"
12 #include "SkBBoxHierarchy.h" 13 #include "SkBBoxHierarchy.h"
13 14
14 /** 15 /**
15 * Subclass of SkBBoxHierarchy that stores elements in buckets that correspond 16 * Subclass of SkBBoxHierarchy that stores elements in buckets that correspond
16 * to tile regions, disposed in a regular grid. This is useful when the tile 17 * to tile regions, disposed in a regular grid. This is useful when the tile
17 * structure that will be use in search() calls is known prior to insertion. 18 * structure that will be use in search() calls is known prior to insertion.
18 */ 19 */
19 class SkTileGrid : public SkBBoxHierarchy { 20 class SkTileGrid : public SkBBoxHierarchy {
20 public: 21 public:
(...skipping 15 matching lines...) Expand all
36 */ 37 */
37 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const SK_OVERRIDE; 38 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const SK_OVERRIDE;
38 39
39 // For testing. 40 // For testing.
40 int tileCount(int x, int y) { return fTiles[y * fXTiles + x].count(); } 41 int tileCount(int x, int y) { return fTiles[y * fXTiles + x].count(); }
41 42
42 virtual void reserve(unsigned opCount) SK_OVERRIDE; 43 virtual void reserve(unsigned opCount) SK_OVERRIDE;
43 virtual void flushDeferredInserts() SK_OVERRIDE; 44 virtual void flushDeferredInserts() SK_OVERRIDE;
44 45
45 private: 46 private:
46 void commonAdjust(SkRect*) const; 47 void userToGrid(const Sk4f&, SkIRect*) const;
47 void userToGrid(const SkRect&, SkIRect* grid) const;
48 48
49 const int fXTiles, fYTiles; 49 const int fXTiles, fNumTiles;
50 const SkScalar fInvWidth, fInvHeight;
51 const SkScalar fMarginWidth, fMarginHeight;
52 const SkPoint fOffset;
53 const SkRect fGridBounds;
54 50
55 // (fXTiles * fYTiles) SkTDArrays, each listing ops overlapping that tile in order. 51 const Sk4f fGridBounds, fMargin, fOffset, fScale, fHigh;
52
53 // fNumTiles SkTDArrays, each listing ops overlapping that tile in order.
56 SkTDArray<unsigned>* fTiles; 54 SkTDArray<unsigned>* fTiles;
57 55
58 typedef SkBBoxHierarchy INHERITED; 56 typedef SkBBoxHierarchy INHERITED;
59 }; 57 };
60 58
61 #endif 59 #endif
OLDNEW
« src/core/Sk4x.h ('K') | « src/core/Sk4x.h ('k') | src/core/SkTileGrid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698