OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "GrClipStackClip.h" | 8 #include "GrClipStackClip.h" |
9 | 9 |
10 #include "GrAppliedClip.h" | 10 #include "GrAppliedClip.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 | 35 |
36 bool GrClipStackClip::quickContains(const SkRRect& rrect) const { | 36 bool GrClipStackClip::quickContains(const SkRRect& rrect) const { |
37 if (!fStack || fStack->isWideOpen()) { | 37 if (!fStack || fStack->isWideOpen()) { |
38 return true; | 38 return true; |
39 } | 39 } |
40 return fStack->quickContains(rrect.makeOffset(SkIntToScalar(fOrigin.fX), | 40 return fStack->quickContains(rrect.makeOffset(SkIntToScalar(fOrigin.fX), |
41 SkIntToScalar(fOrigin.fY))); | 41 SkIntToScalar(fOrigin.fY))); |
42 } | 42 } |
43 | 43 |
| 44 bool GrClipStackClip::isRRect(const SkRect& origRTBounds, SkRRect* rr, bool* aa)
const { |
| 45 if (!fStack) { |
| 46 return false; |
| 47 } |
| 48 const SkRect* rtBounds = &origRTBounds; |
| 49 SkRect tempRTBounds; |
| 50 bool origin = fOrigin.fX || fOrigin.fY; |
| 51 if (origin) { |
| 52 tempRTBounds = origRTBounds; |
| 53 tempRTBounds.offset(SkIntToScalar(fOrigin.fX), SkIntToScalar(fOrigin.fY)
); |
| 54 rtBounds = &tempRTBounds; |
| 55 } |
| 56 if (fStack->isRRect(*rtBounds, rr, aa)) { |
| 57 if (origin) { |
| 58 rr->offset(-SkIntToScalar(fOrigin.fX), -SkIntToScalar(fOrigin.fY)); |
| 59 } |
| 60 return true; |
| 61 } |
| 62 return false; |
| 63 } |
| 64 |
44 void GrClipStackClip::getConservativeBounds(int width, int height, SkIRect* devR
esult, | 65 void GrClipStackClip::getConservativeBounds(int width, int height, SkIRect* devR
esult, |
45 bool* isIntersectionOfRects) const { | 66 bool* isIntersectionOfRects) const { |
46 if (!fStack) { | 67 if (!fStack) { |
47 devResult->setXYWH(0, 0, width, height); | 68 devResult->setXYWH(0, 0, width, height); |
48 if (isIntersectionOfRects) { | 69 if (isIntersectionOfRects) { |
49 *isIntersectionOfRects = true; | 70 *isIntersectionOfRects = true; |
50 } | 71 } |
51 return; | 72 return; |
52 } | 73 } |
53 SkRect devBounds; | 74 SkRect devBounds; |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 sk_sp<GrTexture> result(texProvider->createApproxTexture(desc)); | 804 sk_sp<GrTexture> result(texProvider->createApproxTexture(desc)); |
784 if (!result) { | 805 if (!result) { |
785 return nullptr; | 806 return nullptr; |
786 } | 807 } |
787 result->resourcePriv().setUniqueKey(key); | 808 result->resourcePriv().setUniqueKey(key); |
788 | 809 |
789 helper.toTexture(result.get()); | 810 helper.toTexture(result.get()); |
790 | 811 |
791 return result; | 812 return result; |
792 } | 813 } |
OLD | NEW |