OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrAAHairLinePathRenderer.h" | 8 #include "GrAAHairLinePathRenderer.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 geometry.fCoverage = newCoverage; | 968 geometry.fCoverage = newCoverage; |
969 geometry.fViewMatrix = viewMatrix; | 969 geometry.fViewMatrix = viewMatrix; |
970 geometry.fPath = path; | 970 geometry.fPath = path; |
971 geometry.fDevClipBounds = devClipBounds; | 971 geometry.fDevClipBounds = devClipBounds; |
972 | 972 |
973 return AAHairlineBatch::Create(geometry); | 973 return AAHairlineBatch::Create(geometry); |
974 } | 974 } |
975 | 975 |
976 bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) { | 976 bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) { |
977 SkIRect devClipBounds; | 977 SkIRect devClipBounds; |
978 args.fPipelineBuilder->clip().getConservativeBounds(args.fPipelineBuilder->g
etRenderTarget(), | 978 GrRenderTarget* rt = args.fPipelineBuilder->getRenderTarget(); |
979 &devClipBounds); | 979 args.fPipelineBuilder->clip().getConservativeBounds(rt->width(), rt->height(
), &devClipBounds); |
980 | 980 |
981 SkAutoTUnref<GrDrawBatch> batch(create_hairline_batch(args.fColor, *args.fVi
ewMatrix, *args.fPath, | 981 SkAutoTUnref<GrDrawBatch> batch(create_hairline_batch(args.fColor, *args.fVi
ewMatrix, *args.fPath, |
982 *args.fStroke, devClip
Bounds)); | 982 *args.fStroke, devClip
Bounds)); |
983 args.fTarget->drawBatch(*args.fPipelineBuilder, batch); | 983 args.fTarget->drawBatch(*args.fPipelineBuilder, batch); |
984 | 984 |
985 return true; | 985 return true; |
986 } | 986 } |
987 | 987 |
988 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 988 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
989 | 989 |
990 #ifdef GR_TEST_UTILS | 990 #ifdef GR_TEST_UTILS |
991 | 991 |
992 DRAW_BATCH_TEST_DEFINE(AAHairlineBatch) { | 992 DRAW_BATCH_TEST_DEFINE(AAHairlineBatch) { |
993 GrColor color = GrRandomColor(random); | 993 GrColor color = GrRandomColor(random); |
994 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 994 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
995 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); | 995 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); |
996 SkPath path = GrTest::TestPath(random); | 996 SkPath path = GrTest::TestPath(random); |
997 SkIRect devClipBounds; | 997 SkIRect devClipBounds; |
998 devClipBounds.setEmpty(); | 998 devClipBounds.setEmpty(); |
999 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; | 999 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds)
; |
1000 } | 1000 } |
1001 | 1001 |
1002 #endif | 1002 #endif |
OLD | NEW |