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

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

Issue 664193002: Oval and stroke AA rect now batch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 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
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 #include "GrGpu.h" 10 #include "GrGpu.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 GrVertexBuffer* GrGpu::createVertexBuffer(size_t size, bool dynamic) { 157 GrVertexBuffer* GrGpu::createVertexBuffer(size_t size, bool dynamic) {
158 this->handleDirtyContext(); 158 this->handleDirtyContext();
159 return this->onCreateVertexBuffer(size, dynamic); 159 return this->onCreateVertexBuffer(size, dynamic);
160 } 160 }
161 161
162 GrIndexBuffer* GrGpu::createIndexBuffer(size_t size, bool dynamic) { 162 GrIndexBuffer* GrGpu::createIndexBuffer(size_t size, bool dynamic) {
163 this->handleDirtyContext(); 163 this->handleDirtyContext();
164 return this->onCreateIndexBuffer(size, dynamic); 164 return this->onCreateIndexBuffer(size, dynamic);
165 } 165 }
166 166
167 GrIndexBuffer* GrGpu::createIndexBufferPattern(const uint16_t* pattern,
168 int patternSize,
169 int reps,
170 int vertCount,
171 bool isDynamic) {
172 size_t bufferSize = patternSize * reps * sizeof(uint16_t);
173 GrIndexBuffer* buffer = this->createIndexBuffer(bufferSize, isDynamic);
174 if (buffer) {
175 uint16_t* data = (uint16_t*) buffer->map();
176 bool useTempData = (NULL == data);
177 if (useTempData) {
178 data = SkNEW_ARRAY(uint16_t, reps * patternSize);
179 }
180 for (int i = 0; i < reps; ++i) {
robertphillips 2014/10/21 19:12:37 Fix comment ?
181 // Each AA filled rect is drawn with 8 vertices and 10 triangles (8 around
182 // the inner rect (for AA) and 2 for the inner rect.
183 int baseIdx = i * patternSize;
184 uint16_t baseVert = (uint16_t)(i * vertCount);
185 for (int j = 0; j < patternSize; ++j) {
186 data[baseIdx+j] = baseVert + pattern[j];
187 }
188 }
189 if (useTempData) {
190 if (!buffer->updateData(data, bufferSize)) {
191 SkFAIL("Can't get indices into buffer!");
192 }
193 SkDELETE_ARRAY(data);
194 } else {
195 buffer->unmap();
196 }
197 }
198 return buffer;
199 }
200
167 void GrGpu::clear(const SkIRect* rect, 201 void GrGpu::clear(const SkIRect* rect,
168 GrColor color, 202 GrColor color,
169 bool canIgnoreRect, 203 bool canIgnoreRect,
170 GrRenderTarget* renderTarget) { 204 GrRenderTarget* renderTarget) {
171 if (NULL == renderTarget) { 205 if (NULL == renderTarget) {
172 renderTarget = this->getDrawState().getRenderTarget(); 206 renderTarget = this->getDrawState().getRenderTarget();
173 } 207 }
174 if (NULL == renderTarget) { 208 if (NULL == renderTarget) {
175 SkASSERT(0); 209 SkASSERT(0);
176 return; 210 return;
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 } 546 }
513 547
514 void GrGpu::releaseIndexArray() { 548 void GrGpu::releaseIndexArray() {
515 // if index source was array, we stowed data in the pool 549 // if index source was array, we stowed data in the pool
516 const GeometrySrcState& geoSrc = this->getGeomSrc(); 550 const GeometrySrcState& geoSrc = this->getGeomSrc();
517 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); 551 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc);
518 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); 552 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t);
519 fIndexPool->putBack(bytes); 553 fIndexPool->putBack(bytes);
520 --fIndexPoolUseCnt; 554 --fIndexPoolUseCnt;
521 } 555 }
OLDNEW
« src/gpu/GrGpu.h ('K') | « src/gpu/GrGpu.h ('k') | src/gpu/GrOvalRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698