OLD | NEW |
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 GrVertexBuffer* GrGpu::createVertexBuffer(uint32_t size, bool dynamic) { | 190 GrVertexBuffer* GrGpu::createVertexBuffer(uint32_t size, bool dynamic) { |
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, const SkStrokeRec& stroke) { |
201 SkASSERT(this->caps()->pathRenderingSupport()); | 201 SkASSERT(this->caps()->pathRenderingSupport()); |
202 this->handleDirtyContext(); | 202 this->handleDirtyContext(); |
203 return this->onCreatePath(path); | 203 return this->onCreatePath(path, stroke); |
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); |
212 } | 212 } |
213 if (NULL == this->getDrawState().getRenderTarget()) { | 213 if (NULL == this->getDrawState().getRenderTarget()) { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 this->drawState()->setPathStencilFillType(fill); | 355 this->drawState()->setPathStencilFillType(fill); |
356 | 356 |
357 GrDrawState::AutoRestoreEffects are; | 357 GrDrawState::AutoRestoreEffects are; |
358 if (!this->setupClipAndFlushState(kStencilPath_DrawType, NULL, &are)) { | 358 if (!this->setupClipAndFlushState(kStencilPath_DrawType, NULL, &are)) { |
359 return; | 359 return; |
360 } | 360 } |
361 | 361 |
362 this->onGpuStencilPath(path, fill); | 362 this->onGpuStencilPath(path, fill); |
363 } | 363 } |
364 | 364 |
365 void GrGpu::onFillPath(const GrPath* path, const SkStrokeRec& stroke, SkPath::Fi
llType fill) { | 365 void GrGpu::onDrawPath(const GrPath* path, const SkStrokeRec& stroke, SkPath::Fi
llType fill) { |
366 this->handleDirtyContext(); | 366 this->handleDirtyContext(); |
367 | 367 |
368 this->drawState()->setPathStencilFillType(fill); | 368 this->drawState()->setPathStencilFillType(fill); |
369 | 369 |
370 GrDrawState::AutoRestoreEffects are; | 370 GrDrawState::AutoRestoreEffects are; |
371 // TODO: Some blending effects require destination texture, see onDraw | 371 // TODO: Some blending effects require destination texture, see onDraw |
372 if (!this->setupClipAndFlushState(kFillPath_DrawType, NULL, &are)) { | 372 if (!this->setupClipAndFlushState(kDrawPath_DrawType, NULL, &are)) { |
373 return; | 373 return; |
374 } | 374 } |
375 | 375 |
376 this->onGpuFillPath(path, fill); | 376 this->onGpuDrawPath(path, stroke, fill); |
377 } | 377 } |
378 | 378 |
379 void GrGpu::finalizeReservedVertices() { | 379 void GrGpu::finalizeReservedVertices() { |
380 SkASSERT(NULL != fVertexPool); | 380 SkASSERT(NULL != fVertexPool); |
381 fVertexPool->unlock(); | 381 fVertexPool->unlock(); |
382 } | 382 } |
383 | 383 |
384 void GrGpu::finalizeReservedIndices() { | 384 void GrGpu::finalizeReservedIndices() { |
385 SkASSERT(NULL != fIndexPool); | 385 SkASSERT(NULL != fIndexPool); |
386 fIndexPool->unlock(); | 386 fIndexPool->unlock(); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 } | 506 } |
507 | 507 |
508 void GrGpu::releaseIndexArray() { | 508 void GrGpu::releaseIndexArray() { |
509 // if index source was array, we stowed data in the pool | 509 // if index source was array, we stowed data in the pool |
510 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 510 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
511 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); | 511 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); |
512 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); | 512 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); |
513 fIndexPool->putBack(bytes); | 513 fIndexPool->putBack(bytes); |
514 --fIndexPoolUseCnt; | 514 --fIndexPoolUseCnt; |
515 } | 515 } |
OLD | NEW |