| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #include "GrDrawAtlasBatch.h" | 8 #include "GrDrawAtlasBatch.h" |
| 9 #include "GrBatchTest.h" | 9 #include "GrBatchTest.h" |
| 10 #include "SkGr.h" | 10 #include "SkGr.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 bounds.growToInclude(quad[3].fX, quad[3].fY); | 149 bounds.growToInclude(quad[3].fX, quad[3].fY); |
| 150 currVertex += vertexStride; | 150 currVertex += vertexStride; |
| 151 } | 151 } |
| 152 | 152 |
| 153 viewMatrix.mapRect(&bounds); | 153 viewMatrix.mapRect(&bounds); |
| 154 // Outset for a half pixel in each direction to account for snapping in non-
AA case | 154 // Outset for a half pixel in each direction to account for snapping in non-
AA case |
| 155 bounds.outset(0.5f, 0.5f); | 155 bounds.outset(0.5f, 0.5f); |
| 156 this->setBounds(bounds); | 156 this->setBounds(bounds); |
| 157 } | 157 } |
| 158 | 158 |
| 159 bool GrDrawAtlasBatch::onCombineIfPossible(GrBatch* t) { | 159 bool GrDrawAtlasBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) { |
| 160 if (!this->pipeline()->isEqual(*t->pipeline())) { | 160 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(
), t->bounds(), |
| 161 caps)) { |
| 161 return false; | 162 return false; |
| 162 } | 163 } |
| 163 | 164 |
| 164 GrDrawAtlasBatch* that = t->cast<GrDrawAtlasBatch>(); | 165 GrDrawAtlasBatch* that = t->cast<GrDrawAtlasBatch>(); |
| 165 | 166 |
| 166 // We currently use a uniform viewmatrix for this batch | 167 // We currently use a uniform viewmatrix for this batch |
| 167 if (!this->viewMatrix().cheapEqualTo(that->viewMatrix())) { | 168 if (!this->viewMatrix().cheapEqualTo(that->viewMatrix())) { |
| 168 return false; | 169 return false; |
| 169 } | 170 } |
| 170 | 171 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 248 |
| 248 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 249 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
| 249 | 250 |
| 250 GrDrawAtlasBatch::Geometry geometry; | 251 GrDrawAtlasBatch::Geometry geometry; |
| 251 geometry.fColor = GrRandomColor(random); | 252 geometry.fColor = GrRandomColor(random); |
| 252 return GrDrawAtlasBatch::Create(geometry, viewMatrix, spriteCount, xforms.be
gin(), | 253 return GrDrawAtlasBatch::Create(geometry, viewMatrix, spriteCount, xforms.be
gin(), |
| 253 texRects.begin(), colors.begin()); | 254 texRects.begin(), colors.begin()); |
| 254 } | 255 } |
| 255 | 256 |
| 256 #endif | 257 #endif |
| OLD | NEW |