| OLD | NEW |
| 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 SkPictureUtils_DEFINED | 8 #ifndef SkPictureUtils_DEFINED |
| 9 #define SkPictureUtils_DEFINED | 9 #define SkPictureUtils_DEFINED |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 virtual void query(const SkRect& queryRect, SkTDArray<SkPixelRef*> *resu
lt) = 0; | 40 virtual void query(const SkRect& queryRect, SkTDArray<SkPixelRef*> *resu
lt) = 0; |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 typedef SkRefCnt INHERITED; | 43 typedef SkRefCnt INHERITED; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 // Simple query structure that just stores a linked list of pixel refs | 46 // Simple query structure that just stores a linked list of pixel refs |
| 47 // and rects. | 47 // and rects. |
| 48 class SkPixelRefsAndRectsList : public SkPixelRefContainer { | 48 class SkPixelRefsAndRectsList : public SkPixelRefContainer { |
| 49 public: | 49 public: |
| 50 virtual void add(SkPixelRef* pr, const SkRect& rect) SK_OVERRIDE { | 50 void add(SkPixelRef* pr, const SkRect& rect) SK_OVERRIDE { |
| 51 PixelRefAndRect *dst = fArray.append(); | 51 PixelRefAndRect *dst = fArray.append(); |
| 52 | 52 |
| 53 dst->fPixelRef = pr; | 53 dst->fPixelRef = pr; |
| 54 dst->fRect = rect; | 54 dst->fRect = rect; |
| 55 } | 55 } |
| 56 | 56 |
| 57 virtual void query(const SkRect& queryRect, SkTDArray<SkPixelRef*> *resu
lt) SK_OVERRIDE { | 57 void query(const SkRect& queryRect, SkTDArray<SkPixelRef*> *result) SK_O
VERRIDE { |
| 58 for (int i = 0; i < fArray.count(); ++i) { | 58 for (int i = 0; i < fArray.count(); ++i) { |
| 59 if (SkRect::Intersects(fArray[i].fRect, queryRect)) { | 59 if (SkRect::Intersects(fArray[i].fRect, queryRect)) { |
| 60 *result->append() = fArray[i].fPixelRef; | 60 *result->append() = fArray[i].fPixelRef; |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 struct PixelRefAndRect { | 66 struct PixelRefAndRect { |
| 67 SkPixelRef* fPixelRef; | 67 SkPixelRef* fPixelRef; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 82 /** | 82 /** |
| 83 * How many bytes are allocated to hold the SkPicture. | 83 * How many bytes are allocated to hold the SkPicture. |
| 84 * Includes operations, parameters, bounding data, deletion listeners; | 84 * Includes operations, parameters, bounding data, deletion listeners; |
| 85 * includes nested SkPictures, but does not include large objects that | 85 * includes nested SkPictures, but does not include large objects that |
| 86 * SkRecord holds a reference to (e.g. paths, or pixels backing bitmaps). | 86 * SkRecord holds a reference to (e.g. paths, or pixels backing bitmaps). |
| 87 */ | 87 */ |
| 88 static size_t ApproximateBytesUsed(const SkPicture* pict); | 88 static size_t ApproximateBytesUsed(const SkPicture* pict); |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 #endif | 91 #endif |
| OLD | NEW |