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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 SkASSERT(effectiveSampleCnt == specs.fEffectiveSampleCnt); | 470 SkASSERT(effectiveSampleCnt == specs.fEffectiveSampleCnt); |
471 SkASSERT(!this->caps()->sampleLocationsSupport() || | 471 SkASSERT(!this->caps()->sampleLocationsSupport() || |
472 !memcmp(locations.get(), specs.fSampleLocations.get(), | 472 !memcmp(locations.get(), specs.fSampleLocations.get(), |
473 effectiveSampleCnt * sizeof(SkPoint))); | 473 effectiveSampleCnt * sizeof(SkPoint))); |
474 SkASSERT(surfDescKey <= effectiveKey); | 474 SkASSERT(surfDescKey <= effectiveKey); |
475 SkASSERT(!fMultisampleSpecsMap[surfDescKey] || fMultisampleSpecsMap[surf
DescKey] == &specs); | 475 SkASSERT(!fMultisampleSpecsMap[surfDescKey] || fMultisampleSpecsMap[surf
DescKey] == &specs); |
476 fMultisampleSpecsMap[surfDescKey] = &specs; | 476 fMultisampleSpecsMap[surfDescKey] = &specs; |
477 return specs; | 477 return specs; |
478 } | 478 } |
479 const MultisampleSpecs& specs = *new (&fMultisampleSpecsAllocator) | 479 const MultisampleSpecs& specs = *new (&fMultisampleSpecsAllocator) |
480 MultisampleSpecs{effectiveKey, effectiveSampleCnt, locations.detach()}; | 480 MultisampleSpecs{effectiveKey, effectiveSampleCnt, locations.release()}; |
481 if (fMultisampleSpecsMap.count() <= effectiveKey) { | 481 if (fMultisampleSpecsMap.count() <= effectiveKey) { |
482 int n = 1 + effectiveKey - fMultisampleSpecsMap.count(); | 482 int n = 1 + effectiveKey - fMultisampleSpecsMap.count(); |
483 fMultisampleSpecsMap.push_back_n(n, (const MultisampleSpecs*) nullptr); | 483 fMultisampleSpecsMap.push_back_n(n, (const MultisampleSpecs*) nullptr); |
484 } | 484 } |
485 fMultisampleSpecsMap[effectiveKey] = &specs; | 485 fMultisampleSpecsMap[effectiveKey] = &specs; |
486 if (effectiveSampleCnt != desc.fSampleCnt) { | 486 if (effectiveSampleCnt != desc.fSampleCnt) { |
487 SkASSERT(surfDescKey < effectiveKey); | 487 SkASSERT(surfDescKey < effectiveKey); |
488 fMultisampleSpecsMap[surfDescKey] = &specs; | 488 fMultisampleSpecsMap[surfDescKey] = &specs; |
489 } | 489 } |
490 return specs; | 490 return specs; |
491 } | 491 } |
492 | 492 |
493 //////////////////////////////////////////////////////////////////////////////// | 493 //////////////////////////////////////////////////////////////////////////////// |
494 | 494 |
495 void GrGpu::draw(const DrawArgs& args, const GrVertices& vertices) { | 495 void GrGpu::draw(const DrawArgs& args, const GrVertices& vertices) { |
496 this->handleDirtyContext(); | 496 this->handleDirtyContext(); |
497 if (GrXferBarrierType barrierType = args.fPipeline->xferBarrierType(*this->c
aps())) { | 497 if (GrXferBarrierType barrierType = args.fPipeline->xferBarrierType(*this->c
aps())) { |
498 this->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); | 498 this->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); |
499 } | 499 } |
500 | 500 |
501 GrVertices::Iterator iter; | 501 GrVertices::Iterator iter; |
502 const GrNonInstancedVertices* verts = iter.init(vertices); | 502 const GrNonInstancedVertices* verts = iter.init(vertices); |
503 do { | 503 do { |
504 this->onDraw(args, *verts); | 504 this->onDraw(args, *verts); |
505 fStats.incNumDraws(); | 505 fStats.incNumDraws(); |
506 } while ((verts = iter.next())); | 506 } while ((verts = iter.next())); |
507 } | 507 } |
508 | 508 |
OLD | NEW |