| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 | 8 |
| 9 #include "GrGpu.h" | 9 #include "GrGpu.h" |
| 10 | 10 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 GrBuffer* GrGpu::createBuffer(size_t size, GrBufferType intendedType, | 236 GrBuffer* GrGpu::createBuffer(size_t size, GrBufferType intendedType, |
| 237 GrAccessPattern accessPattern, const void* data) { | 237 GrAccessPattern accessPattern, const void* data) { |
| 238 this->handleDirtyContext(); | 238 this->handleDirtyContext(); |
| 239 GrBuffer* buffer = this->onCreateBuffer(size, intendedType, accessPattern, d
ata); | 239 GrBuffer* buffer = this->onCreateBuffer(size, intendedType, accessPattern, d
ata); |
| 240 if (!this->caps()->reuseScratchBuffers()) { | 240 if (!this->caps()->reuseScratchBuffers()) { |
| 241 buffer->resourcePriv().removeScratchKey(); | 241 buffer->resourcePriv().removeScratchKey(); |
| 242 } | 242 } |
| 243 return buffer; | 243 return buffer; |
| 244 } | 244 } |
| 245 | 245 |
| 246 void GrGpu::clear(const SkIRect& rect, | |
| 247 GrColor color, | |
| 248 GrRenderTarget* renderTarget) { | |
| 249 SkASSERT(renderTarget); | |
| 250 SkASSERT(SkIRect::MakeWH(renderTarget->width(), renderTarget->height()).cont
ains(rect)); | |
| 251 this->handleDirtyContext(); | |
| 252 this->onClear(renderTarget, rect, color); | |
| 253 } | |
| 254 | |
| 255 void GrGpu::clearStencilClip(const SkIRect& rect, | |
| 256 bool insideClip, | |
| 257 GrRenderTarget* renderTarget) { | |
| 258 SkASSERT(renderTarget); | |
| 259 this->handleDirtyContext(); | |
| 260 this->onClearStencilClip(renderTarget, rect, insideClip); | |
| 261 } | |
| 262 | |
| 263 bool GrGpu::copySurface(GrSurface* dst, | 246 bool GrGpu::copySurface(GrSurface* dst, |
| 264 GrSurface* src, | 247 GrSurface* src, |
| 265 const SkIRect& srcRect, | 248 const SkIRect& srcRect, |
| 266 const SkIPoint& dstPoint) { | 249 const SkIPoint& dstPoint) { |
| 267 SkASSERT(dst && src); | 250 SkASSERT(dst && src); |
| 268 this->handleDirtyContext(); | 251 this->handleDirtyContext(); |
| 269 return this->onCopySurface(dst, src, srcRect, dstPoint); | 252 return this->onCopySurface(dst, src, srcRect, dstPoint); |
| 270 } | 253 } |
| 271 | 254 |
| 272 bool GrGpu::getReadPixelsInfo(GrSurface* srcSurface, int width, int height, size
_t rowBytes, | 255 bool GrGpu::getReadPixelsInfo(GrSurface* srcSurface, int width, int height, size
_t rowBytes, |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 fMultisampleSpecsMap.push_back_n(n, (const MultisampleSpecs*) nullptr); | 465 fMultisampleSpecsMap.push_back_n(n, (const MultisampleSpecs*) nullptr); |
| 483 } | 466 } |
| 484 fMultisampleSpecsMap[effectiveKey] = &specs; | 467 fMultisampleSpecsMap[effectiveKey] = &specs; |
| 485 if (effectiveSampleCnt != desc.fSampleCnt) { | 468 if (effectiveSampleCnt != desc.fSampleCnt) { |
| 486 SkASSERT(surfDescKey < effectiveKey); | 469 SkASSERT(surfDescKey < effectiveKey); |
| 487 fMultisampleSpecsMap[surfDescKey] = &specs; | 470 fMultisampleSpecsMap[surfDescKey] = &specs; |
| 488 } | 471 } |
| 489 return specs; | 472 return specs; |
| 490 } | 473 } |
| 491 | 474 |
| 492 //////////////////////////////////////////////////////////////////////////////// | |
| 493 | |
| 494 bool GrGpu::draw(const GrPipeline& pipeline, | |
| 495 const GrPrimitiveProcessor& primProc, | |
| 496 const GrMesh* meshes, | |
| 497 int meshCount) { | |
| 498 if (primProc.numAttribs() > this->caps()->maxVertexAttributes()) { | |
| 499 fStats.incNumFailedDraws(); | |
| 500 return false; | |
| 501 } | |
| 502 this->handleDirtyContext(); | |
| 503 | |
| 504 this->onDraw(pipeline, primProc, meshes, meshCount); | |
| 505 return true; | |
| 506 } | |
| OLD | NEW |