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

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

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 years, 3 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/GrResourceCache.cpp ('k') | src/gpu/GrStencilAndCoverPathRenderer.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 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 #include "GrResourceProvider.h" 8 #include "GrResourceProvider.h"
9 9
10 #include "GrGpu.h" 10 #include "GrGpu.h"
(...skipping 19 matching lines...) Expand all
30 30
31 // This is typically used in GrBatchs, so we assume kNoPendingIO. 31 // This is typically used in GrBatchs, so we assume kNoPendingIO.
32 GrIndexBuffer* buffer = this->createIndexBuffer(bufferSize, kStatic_BufferUs age, 32 GrIndexBuffer* buffer = this->createIndexBuffer(bufferSize, kStatic_BufferUs age,
33 kNoPendingIO_Flag); 33 kNoPendingIO_Flag);
34 if (!buffer) { 34 if (!buffer) {
35 return NULL; 35 return NULL;
36 } 36 }
37 uint16_t* data = (uint16_t*) buffer->map(); 37 uint16_t* data = (uint16_t*) buffer->map();
38 bool useTempData = (NULL == data); 38 bool useTempData = (NULL == data);
39 if (useTempData) { 39 if (useTempData) {
40 data = SkNEW_ARRAY(uint16_t, reps * patternSize); 40 data = new uint16_t[reps * patternSize];
41 } 41 }
42 for (int i = 0; i < reps; ++i) { 42 for (int i = 0; i < reps; ++i) {
43 int baseIdx = i * patternSize; 43 int baseIdx = i * patternSize;
44 uint16_t baseVert = (uint16_t)(i * vertCount); 44 uint16_t baseVert = (uint16_t)(i * vertCount);
45 for (int j = 0; j < patternSize; ++j) { 45 for (int j = 0; j < patternSize; ++j) {
46 data[baseIdx+j] = baseVert + pattern[j]; 46 data[baseIdx+j] = baseVert + pattern[j];
47 } 47 }
48 } 48 }
49 if (useTempData) { 49 if (useTempData) {
50 if (!buffer->updateData(data, bufferSize)) { 50 if (!buffer->updateData(data, bufferSize)) {
51 buffer->unref(); 51 buffer->unref();
52 return NULL; 52 return NULL;
53 } 53 }
54 SkDELETE_ARRAY(data); 54 delete[] data;
55 } else { 55 } else {
56 buffer->unmap(); 56 buffer->unmap();
57 } 57 }
58 this->assignUniqueKeyToResource(key, buffer); 58 this->assignUniqueKeyToResource(key, buffer);
59 return buffer; 59 return buffer;
60 } 60 }
61 61
62 const GrIndexBuffer* GrResourceProvider::createQuadIndexBuffer() { 62 const GrIndexBuffer* GrResourceProvider::createQuadIndexBuffer() {
63 static const int kMaxQuads = 1 << 12; // max possible: (1 << 14) - 1; 63 static const int kMaxQuads = 1 << 12; // max possible: (1 << 14) - 1;
64 GR_STATIC_ASSERT(4 * kMaxQuads <= 65535); 64 GR_STATIC_ASSERT(4 * kMaxQuads <= 65535);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 desc.fConfig = config; 154 desc.fConfig = config;
155 155
156 // We don't want to flush the context so we claim we're in the middle of flu shing so as to 156 // We don't want to flush the context so we claim we're in the middle of flu shing so as to
157 // guarantee we do not recieve a texture with pending IO 157 // guarantee we do not recieve a texture with pending IO
158 // TODO: Determine how to avoid having to do this. (http://skbug.com/4156) 158 // TODO: Determine how to avoid having to do this. (http://skbug.com/4156)
159 static const uint32_t kFlags = GrResourceProvider::kNoPendingIO_Flag; 159 static const uint32_t kFlags = GrResourceProvider::kNoPendingIO_Flag;
160 GrTexture* texture = this->createApproxTexture(desc, kFlags); 160 GrTexture* texture = this->createApproxTexture(desc, kFlags);
161 if (!texture) { 161 if (!texture) {
162 return NULL; 162 return NULL;
163 } 163 }
164 return SkNEW_ARGS(GrBatchAtlas, (texture, numPlotsX, numPlotsY)); 164 return new GrBatchAtlas(texture, numPlotsX, numPlotsY);
165 } 165 }
OLDNEW
« no previous file with comments | « src/gpu/GrResourceCache.cpp ('k') | src/gpu/GrStencilAndCoverPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698