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

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

Issue 309683002: Move GrIPoint16 to SkIPoint16 (and remove GrPoint.h) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT Created 6 years, 6 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 | « src/gpu/GrAtlas.h ('k') | src/gpu/GrDrawState.h » ('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 #include "GrAtlas.h" 9 #include "GrAtlas.h"
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 30 matching lines...) Expand all
41 fRects = GrRectanizer::Factory(width, height); 41 fRects = GrRectanizer::Factory(width, height);
42 fAtlasMgr = mgr; 42 fAtlasMgr = mgr;
43 fOffset.set(offX * width, offY * height); 43 fOffset.set(offX * width, offY * height);
44 fBytesPerPixel = bpp; 44 fBytesPerPixel = bpp;
45 fPlotData = NULL; 45 fPlotData = NULL;
46 fDirtyRect.setEmpty(); 46 fDirtyRect.setEmpty();
47 fDirty = false; 47 fDirty = false;
48 fBatchUploads = batchUploads; 48 fBatchUploads = batchUploads;
49 } 49 }
50 50
51 static inline void adjust_for_offset(GrIPoint16* loc, const GrIPoint16& offset) { 51 static inline void adjust_for_offset(SkIPoint16* loc, const SkIPoint16& offset) {
52 loc->fX += offset.fX; 52 loc->fX += offset.fX;
53 loc->fY += offset.fY; 53 loc->fY += offset.fY;
54 } 54 }
55 55
56 bool GrPlot::addSubImage(int width, int height, const void* image, 56 bool GrPlot::addSubImage(int width, int height, const void* image,
57 GrIPoint16* loc) { 57 SkIPoint16* loc) {
58 float percentFull = fRects->percentFull(); 58 float percentFull = fRects->percentFull();
59 if (!fRects->addRect(width, height, loc)) { 59 if (!fRects->addRect(width, height, loc)) {
60 return false; 60 return false;
61 } 61 }
62 62
63 // if batching uploads, create backing memory on first use 63 // if batching uploads, create backing memory on first use
64 // once the plot is nearly full we will revert to uploading each subimage in dividually 64 // once the plot is nearly full we will revert to uploading each subimage in dividually
65 int plotWidth = fRects->width(); 65 int plotWidth = fRects->width();
66 int plotHeight = fRects->height(); 66 int plotHeight = fRects->height();
67 if (fBatchUploads && NULL == fPlotData && 0.0f == percentFull) { 67 if (fBatchUploads && NULL == fPlotData && 0.0f == percentFull) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 if (fPlotList.head() == plot) { 196 if (fPlotList.head() == plot) {
197 return; 197 return;
198 } 198 }
199 199
200 fPlotList.remove(plot); 200 fPlotList.remove(plot);
201 fPlotList.addToHead(plot); 201 fPlotList.addToHead(plot);
202 }; 202 };
203 203
204 GrPlot* GrAtlasMgr::addToAtlas(GrAtlas* atlas, 204 GrPlot* GrAtlasMgr::addToAtlas(GrAtlas* atlas,
205 int width, int height, const void* image, 205 int width, int height, const void* image,
206 GrIPoint16* loc) { 206 SkIPoint16* loc) {
207 // iterate through entire plot list for this atlas, see if we can find a hol e 207 // iterate through entire plot list for this atlas, see if we can find a hol e
208 // last one was most recently added and probably most empty 208 // last one was most recently added and probably most empty
209 for (int i = atlas->fPlots.count()-1; i >= 0; --i) { 209 for (int i = atlas->fPlots.count()-1; i >= 0; --i) {
210 GrPlot* plot = atlas->fPlots[i]; 210 GrPlot* plot = atlas->fPlots[i];
211 if (plot->addSubImage(width, height, image, loc)) { 211 if (plot->addSubImage(width, height, image, loc)) {
212 this->moveToHead(plot); 212 this->moveToHead(plot);
213 return plot; 213 return plot;
214 } 214 }
215 } 215 }
216 216
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 if (fBatchUploads) { 281 if (fBatchUploads) {
282 GrPlotList::Iter plotIter; 282 GrPlotList::Iter plotIter;
283 plotIter.init(fPlotList, GrPlotList::Iter::kHead_IterStart); 283 plotIter.init(fPlotList, GrPlotList::Iter::kHead_IterStart);
284 GrPlot* plot; 284 GrPlot* plot;
285 while (NULL != (plot = plotIter.get())) { 285 while (NULL != (plot = plotIter.get())) {
286 plot->uploadToTexture(); 286 plot->uploadToTexture();
287 plotIter.next(); 287 plotIter.next();
288 } 288 }
289 } 289 }
290 } 290 }
OLDNEW
« no previous file with comments | « src/gpu/GrAtlas.h ('k') | src/gpu/GrDrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698