Line data Source code
1 : /*
2 : * Copyright 2015 Google Inc.
3 : *
4 : * Use of this source code is governed by a BSD-style license that can be
5 : * found in the LICENSE file.
6 : */
7 :
8 : #include "GrRectOpFactory.h"
9 :
10 : #include "GrAAStrokeRectOp.h"
11 : #include "GrMeshDrawOp.h"
12 : #include "SkStrokeRec.h"
13 :
14 : namespace GrRectOpFactory {
15 :
16 0 : std::unique_ptr<GrLegacyMeshDrawOp> MakeAAFillNestedRects(GrColor color,
17 : const SkMatrix& viewMatrix,
18 : const SkRect rects[2]) {
19 0 : SkASSERT(viewMatrix.rectStaysRect());
20 0 : SkASSERT(!rects[0].isEmpty() && !rects[1].isEmpty());
21 :
22 : SkRect devOutside, devInside;
23 0 : viewMatrix.mapRect(&devOutside, rects[0]);
24 0 : viewMatrix.mapRect(&devInside, rects[1]);
25 0 : if (devInside.isEmpty()) {
26 0 : if (devOutside.isEmpty()) {
27 0 : return nullptr;
28 : }
29 0 : return GrAAFillRectOp::Make(color, viewMatrix, devOutside, devOutside);
30 : }
31 :
32 0 : return GrAAStrokeRectOp::MakeFillBetweenRects(color, viewMatrix, devOutside, devInside);
33 : }
34 : };
|