OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrAtlas.h" | 9 #include "GrAtlas.h" |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 GrPlot::~GrPlot() { | 54 GrPlot::~GrPlot() { |
55 delete fRects; | 55 delete fRects; |
56 } | 56 } |
57 | 57 |
58 static inline void adjust_for_offset(GrIPoint16* loc, const GrIPoint16& offset)
{ | 58 static inline void adjust_for_offset(GrIPoint16* loc, const GrIPoint16& offset)
{ |
59 loc->fX += offset.fX * GR_ATLAS_WIDTH; | 59 loc->fX += offset.fX * GR_ATLAS_WIDTH; |
60 loc->fY += offset.fY * GR_ATLAS_HEIGHT; | 60 loc->fY += offset.fY * GR_ATLAS_HEIGHT; |
61 } | 61 } |
62 | 62 |
63 static inline uint8_t* zero_fill(uint8_t* ptr, size_t count) { | |
64 sk_bzero(ptr, count); | |
65 return ptr + count; | |
66 } | |
67 | |
68 bool GrPlot::addSubImage(int width, int height, const void* image, | 63 bool GrPlot::addSubImage(int width, int height, const void* image, |
69 GrIPoint16* loc) { | 64 GrIPoint16* loc) { |
70 if (!fRects->addRect(width, height, loc)) { | 65 if (!fRects->addRect(width, height, loc)) { |
71 return false; | 66 return false; |
72 } | 67 } |
73 | 68 |
74 SkAutoSMalloc<1024> storage; | 69 SkAutoSMalloc<1024> storage; |
75 adjust_for_offset(loc, fOffset); | 70 adjust_for_offset(loc, fOffset); |
76 GrContext* context = fTexture->getContext(); | 71 GrContext* context = fTexture->getContext(); |
77 // We pass the flag that does not force a flush. We assume our caller is | 72 // We pass the flag that does not force a flush. We assume our caller is |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 206 } |
212 plotIter.prev(); | 207 plotIter.prev(); |
213 } | 208 } |
214 | 209 |
215 return NULL; | 210 return NULL; |
216 } | 211 } |
217 | 212 |
218 SkISize GrAtlas::getSize() const { | 213 SkISize GrAtlas::getSize() const { |
219 return SkISize::Make(GR_ATLAS_TEXTURE_WIDTH, GR_ATLAS_TEXTURE_HEIGHT); | 214 return SkISize::Make(GR_ATLAS_TEXTURE_WIDTH, GR_ATLAS_TEXTURE_HEIGHT); |
220 } | 215 } |
OLD | NEW |