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

Side by Side Diff: include/core/SkWriter32.h

Issue 1932223003: Remove SkWriter32::contiguousArray(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 7 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 | « no previous file | src/core/SkPicture.cpp » ('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 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
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 9
10 #ifndef SkWriter32_DEFINED 10 #ifndef SkWriter32_DEFINED
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 void reset(void* external = NULL, size_t externalBytes = 0) { 44 void reset(void* external = NULL, size_t externalBytes = 0) {
45 SkASSERT(SkIsAlign4((uintptr_t)external)); 45 SkASSERT(SkIsAlign4((uintptr_t)external));
46 SkASSERT(SkIsAlign4(externalBytes)); 46 SkASSERT(SkIsAlign4(externalBytes));
47 47
48 fData = (uint8_t*)external; 48 fData = (uint8_t*)external;
49 fCapacity = externalBytes; 49 fCapacity = externalBytes;
50 fUsed = 0; 50 fUsed = 0;
51 fExternal = external; 51 fExternal = external;
52 } 52 }
53 53
54 // Returns the current buffer.
55 // The pointer may be invalidated by any future write calls.
56 const uint32_t* contiguousArray() const {
57 return (uint32_t*)fData;
58 }
59
60 // size MUST be multiple of 4 54 // size MUST be multiple of 4
61 uint32_t* reserve(size_t size) { 55 uint32_t* reserve(size_t size) {
62 SkASSERT(SkAlign4(size) == size); 56 SkASSERT(SkAlign4(size) == size);
63 size_t offset = fUsed; 57 size_t offset = fUsed;
64 size_t totalRequired = fUsed + size; 58 size_t totalRequired = fUsed + size;
65 if (totalRequired > fCapacity) { 59 if (totalRequired > fCapacity) {
66 this->growToAtLeast(totalRequired); 60 this->growToAtLeast(totalRequired);
67 } 61 }
68 fUsed = totalRequired; 62 fUsed = totalRequired;
69 return (uint32_t*)(fData + offset); 63 return (uint32_t*)(fData + offset);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 union { 267 union {
274 void* fPtrAlignment; 268 void* fPtrAlignment;
275 double fDoubleAlignment; 269 double fDoubleAlignment;
276 char fStorage[SIZE]; 270 char fStorage[SIZE];
277 } fData; 271 } fData;
278 272
279 typedef SkWriter32 INHERITED; 273 typedef SkWriter32 INHERITED;
280 }; 274 };
281 275
282 #endif 276 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPicture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698