| 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 "GrAAFillRectBatch.h" | 8 #include "GrAAFillRectBatch.h" |
| 9 | 9 |
| 10 #include "GrColor.h" | 10 #include "GrColor.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 public: | 210 public: |
| 211 struct Geometry { | 211 struct Geometry { |
| 212 SkMatrix fViewMatrix; | 212 SkMatrix fViewMatrix; |
| 213 SkRect fRect; | 213 SkRect fRect; |
| 214 SkRect fDevRect; | 214 SkRect fDevRect; |
| 215 GrColor fColor; | 215 GrColor fColor; |
| 216 }; | 216 }; |
| 217 | 217 |
| 218 static const char* Name() { return "AAFillRectBatchNoLocalMatrix"; } | 218 static const char* Name() { return "AAFillRectBatchNoLocalMatrix"; } |
| 219 | 219 |
| 220 static SkString DumpInfo(const Geometry& geo) { | 220 static SkString DumpInfo(const Geometry& geo, int index) { |
| 221 SkString str; | 221 SkString str; |
| 222 str.appendf("Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n"
, | 222 str.appendf("%d: Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f
]\n", |
| 223 index, |
| 223 geo.fColor, | 224 geo.fColor, |
| 224 geo.fRect.fLeft, geo.fRect.fTop, geo.fRect.fRight, geo.fRect
.fBottom); | 225 geo.fRect.fLeft, geo.fRect.fTop, geo.fRect.fRight, geo.fRect
.fBottom); |
| 225 return str; | 226 return str; |
| 226 } | 227 } |
| 227 | 228 |
| 228 static bool CanCombine(const Geometry& mine, const Geometry& theirs, | 229 static bool CanCombine(const Geometry& mine, const Geometry& theirs, |
| 229 const GrPipelineOptimizations& opts) { | 230 const GrPipelineOptimizations& opts) { |
| 230 // We apply the viewmatrix to the rect points on the cpu. However, if t
he pipeline uses | 231 // We apply the viewmatrix to the rect points on the cpu. However, if t
he pipeline uses |
| 231 // local coords then we won't be able to batch. We could actually uploa
d the viewmatrix | 232 // local coords then we won't be able to batch. We could actually uploa
d the viewmatrix |
| 232 // using vertex attributes in these cases, but haven't investigated that | 233 // using vertex attributes in these cases, but haven't investigated that |
| (...skipping 26 matching lines...) Expand all Loading... |
| 259 struct Geometry { | 260 struct Geometry { |
| 260 SkMatrix fViewMatrix; | 261 SkMatrix fViewMatrix; |
| 261 SkMatrix fLocalMatrix; | 262 SkMatrix fLocalMatrix; |
| 262 SkRect fRect; | 263 SkRect fRect; |
| 263 SkRect fDevRect; | 264 SkRect fDevRect; |
| 264 GrColor fColor; | 265 GrColor fColor; |
| 265 }; | 266 }; |
| 266 | 267 |
| 267 static const char* Name() { return "AAFillRectBatchLocalMatrix"; } | 268 static const char* Name() { return "AAFillRectBatchLocalMatrix"; } |
| 268 | 269 |
| 269 static SkString DumpInfo(const Geometry& geo) { | 270 static SkString DumpInfo(const Geometry& geo, int index) { |
| 270 SkString str; | 271 SkString str; |
| 271 str.appendf("Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n"
, | 272 str.appendf("%d: Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f
]\n", |
| 273 index, |
| 272 geo.fColor, | 274 geo.fColor, |
| 273 geo.fRect.fLeft, geo.fRect.fTop, geo.fRect.fRight, geo.fRect
.fBottom); | 275 geo.fRect.fLeft, geo.fRect.fTop, geo.fRect.fRight, geo.fRect
.fBottom); |
| 274 return str; | 276 return str; |
| 275 } | 277 } |
| 276 | 278 |
| 277 static bool CanCombine(const Geometry& mine, const Geometry& theirs, | 279 static bool CanCombine(const Geometry& mine, const Geometry& theirs, |
| 278 const GrPipelineOptimizations&) { | 280 const GrPipelineOptimizations&) { |
| 279 return true; | 281 return true; |
| 280 } | 282 } |
| 281 | 283 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 DRAW_BATCH_TEST_DEFINE(AAFillRectBatchLocalMatrix) { | 412 DRAW_BATCH_TEST_DEFINE(AAFillRectBatchLocalMatrix) { |
| 411 GrColor color = GrRandomColor(random); | 413 GrColor color = GrRandomColor(random); |
| 412 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); | 414 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); |
| 413 SkMatrix localMatrix = GrTest::TestMatrix(random); | 415 SkMatrix localMatrix = GrTest::TestMatrix(random); |
| 414 SkRect rect = GrTest::TestRect(random); | 416 SkRect rect = GrTest::TestRect(random); |
| 415 SkRect devRect = GrTest::TestRect(random); | 417 SkRect devRect = GrTest::TestRect(random); |
| 416 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRe
ct); | 418 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRe
ct); |
| 417 } | 419 } |
| 418 | 420 |
| 419 #endif | 421 #endif |
| OLD | NEW |