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

Side by Side Diff: src/gpu/GrAtlas.cpp

Issue 23566022: move GrMalloc, GrFree, Gr_bzero to their sk equivalents (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrAllocator.h ('k') | src/gpu/GrGpu.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 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 9
10 10
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (!fRects->addRect(width + BORDER, height + BORDER, loc)) { 118 if (!fRects->addRect(width + BORDER, height + BORDER, loc)) {
119 return false; 119 return false;
120 } 120 }
121 121
122 SkAutoSMalloc<1024> storage; 122 SkAutoSMalloc<1024> storage;
123 int dstW = width + 2*BORDER; 123 int dstW = width + 2*BORDER;
124 int dstH = height + 2*BORDER; 124 int dstH = height + 2*BORDER;
125 if (BORDER) { 125 if (BORDER) {
126 const size_t dstRB = dstW * fBytesPerPixel; 126 const size_t dstRB = dstW * fBytesPerPixel;
127 uint8_t* dst = (uint8_t*)storage.reset(dstH * dstRB); 127 uint8_t* dst = (uint8_t*)storage.reset(dstH * dstRB);
128 Gr_bzero(dst, dstRB); // zero top row 128 sk_bzero(dst, dstRB); // zero top row
129 dst += dstRB; 129 dst += dstRB;
130 for (int y = 0; y < height; y++) { 130 for (int y = 0; y < height; y++) {
131 dst = zerofill(dst, fBytesPerPixel); // zero left edge 131 dst = zerofill(dst, fBytesPerPixel); // zero left edge
132 memcpy(dst, image, width * fBytesPerPixel); 132 memcpy(dst, image, width * fBytesPerPixel);
133 dst += width * fBytesPerPixel; 133 dst += width * fBytesPerPixel;
134 dst = zerofill(dst, fBytesPerPixel); // zero right edge 134 dst = zerofill(dst, fBytesPerPixel); // zero right edge
135 image = (const void*)((const char*)image + width * fBytesPerPixel); 135 image = (const void*)((const char*)image + width * fBytesPerPixel);
136 } 136 }
137 Gr_bzero(dst, dstRB); // zero bottom row 137 sk_bzero(dst, dstRB); // zero bottom row
138 image = storage.get(); 138 image = storage.get();
139 } 139 }
140 adjustForPlot(loc, fPlot); 140 adjustForPlot(loc, fPlot);
141 GrContext* context = fTexture->getContext(); 141 GrContext* context = fTexture->getContext();
142 // We pass the flag that does not force a flush. We assume our caller is 142 // We pass the flag that does not force a flush. We assume our caller is
143 // smart and hasn't referenced the part of the texture we're about to update 143 // smart and hasn't referenced the part of the texture we're about to update
144 // since the last flush. 144 // since the last flush.
145 context->writeTexturePixels(fTexture, 145 context->writeTexturePixels(fTexture,
146 loc->fX, loc->fY, dstW, dstH, 146 loc->fX, loc->fY, dstW, dstH,
147 fTexture->config(), image, 0, 147 fTexture->config(), image, 0,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 newAtlas->fNext = *atlas; 223 newAtlas->fNext = *atlas;
224 *atlas = newAtlas; 224 *atlas = newAtlas;
225 225
226 return newAtlas; 226 return newAtlas;
227 } 227 }
228 228
229 void GrAtlasMgr::freePlot(int x, int y) { 229 void GrAtlasMgr::freePlot(int x, int y) {
230 SkASSERT(fPlotMgr->isBusy(x, y)); 230 SkASSERT(fPlotMgr->isBusy(x, y));
231 fPlotMgr->freePlot(x, y); 231 fPlotMgr->freePlot(x, y);
232 } 232 }
OLDNEW
« no previous file with comments | « src/gpu/GrAllocator.h ('k') | src/gpu/GrGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698