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

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

Issue 22686002: Implement path cover with nv_path_rendering (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Omission with non-inverted path bounds fixed Created 7 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 | Annotate | Revision Log
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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 this->handleDirtyContext(); 191 this->handleDirtyContext();
192 return this->onCreateVertexBuffer(size, dynamic); 192 return this->onCreateVertexBuffer(size, dynamic);
193 } 193 }
194 194
195 GrIndexBuffer* GrGpu::createIndexBuffer(uint32_t size, bool dynamic) { 195 GrIndexBuffer* GrGpu::createIndexBuffer(uint32_t size, bool dynamic) {
196 this->handleDirtyContext(); 196 this->handleDirtyContext();
197 return this->onCreateIndexBuffer(size, dynamic); 197 return this->onCreateIndexBuffer(size, dynamic);
198 } 198 }
199 199
200 GrPath* GrGpu::createPath(const SkPath& path) { 200 GrPath* GrGpu::createPath(const SkPath& path) {
201 SkASSERT(this->caps()->pathStencilingSupport()); 201 SkASSERT(this->caps()->pathRenderingSupport());
202 this->handleDirtyContext(); 202 this->handleDirtyContext();
203 return this->onCreatePath(path); 203 return this->onCreatePath(path);
204 } 204 }
205 205
206 void GrGpu::clear(const SkIRect* rect, 206 void GrGpu::clear(const SkIRect* rect,
207 GrColor color, 207 GrColor color,
208 GrRenderTarget* renderTarget) { 208 GrRenderTarget* renderTarget) {
209 GrDrawState::AutoRenderTargetRestore art; 209 GrDrawState::AutoRenderTargetRestore art;
210 if (NULL != renderTarget) { 210 if (NULL != renderTarget) {
211 art.set(this->drawState(), renderTarget); 211 art.set(this->drawState(), renderTarget);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 info.getDstCopy(), 342 info.getDstCopy(),
343 &are)) { 343 &are)) {
344 return; 344 return;
345 } 345 }
346 this->onGpuDraw(info); 346 this->onGpuDraw(info);
347 } 347 }
348 348
349 void GrGpu::onStencilPath(const GrPath* path, const SkStrokeRec&, SkPath::FillTy pe fill) { 349 void GrGpu::onStencilPath(const GrPath* path, const SkStrokeRec&, SkPath::FillTy pe fill) {
350 this->handleDirtyContext(); 350 this->handleDirtyContext();
351 351
352 // TODO: make this more efficient (don't copy and copy back) 352 // This function might be called during clip flush of path fill. We need to restore the fill
353 GrAutoTRestore<GrStencilSettings> asr(this->drawState()->stencil()); 353 // type afterwards.
354 GrAutoTRestore<SkPath::FillType> apsr(this->drawState()->pathStencilFillType ());
bsalomon 2013/09/18 14:24:22 Now I see why you added the ptr getter. :/ Maybe
Kimmo Kinnunen 2013/09/20 12:20:58 I try to see if I can figure out a way. I was stru
355 this->drawState()->setPathStencilFillType(fill);
354 356
355 this->setStencilPathSettings(*path, fill, this->drawState()->stencil());
356 GrDrawState::AutoRestoreEffects are; 357 GrDrawState::AutoRestoreEffects are;
357 if (!this->setupClipAndFlushState(kStencilPath_DrawType, NULL, &are)) { 358 if (!this->setupClipAndFlushState(kStencilPath_DrawType, NULL, &are)) {
358 return; 359 return;
359 } 360 }
360 361
361 this->onGpuStencilPath(path, fill); 362 this->onGpuStencilPath(path, fill);
362 } 363 }
363 364
365 void GrGpu::onFillPath(const GrPath* path, const SkStrokeRec& stroke, SkPath::Fi llType fill) {
366 this->handleDirtyContext();
367
368 this->drawState()->setPathStencilFillType(fill);
369
370 GrDrawState::AutoRestoreEffects are;
371 // TODO: Some blending effects require destination texture, see onDraw
372 if (!this->setupClipAndFlushState(kFillPath_DrawType, NULL, &are)) {
373 return;
374 }
375
376 this->onGpuFillPath(path, fill);
377 }
378
364 void GrGpu::finalizeReservedVertices() { 379 void GrGpu::finalizeReservedVertices() {
365 SkASSERT(NULL != fVertexPool); 380 SkASSERT(NULL != fVertexPool);
366 fVertexPool->unlock(); 381 fVertexPool->unlock();
367 } 382 }
368 383
369 void GrGpu::finalizeReservedIndices() { 384 void GrGpu::finalizeReservedIndices() {
370 SkASSERT(NULL != fIndexPool); 385 SkASSERT(NULL != fIndexPool);
371 fIndexPool->unlock(); 386 fIndexPool->unlock();
372 } 387 }
373 388
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 } 506 }
492 507
493 void GrGpu::releaseIndexArray() { 508 void GrGpu::releaseIndexArray() {
494 // if index source was array, we stowed data in the pool 509 // if index source was array, we stowed data in the pool
495 const GeometrySrcState& geoSrc = this->getGeomSrc(); 510 const GeometrySrcState& geoSrc = this->getGeomSrc();
496 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); 511 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc);
497 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); 512 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t);
498 fIndexPool->putBack(bytes); 513 fIndexPool->putBack(bytes);
499 --fIndexPoolUseCnt; 514 --fIndexPoolUseCnt;
500 } 515 }
OLDNEW
« src/gpu/GrGpu.h ('K') | « src/gpu/GrGpu.h ('k') | src/gpu/GrInOrderDrawBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698