Chromium Code Reviews| 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" |
| 11 #include "GrDrawingManager.h" | 11 #include "GrDrawingManager.h" |
| 12 #include "GrDrawContextPriv.h" | 12 #include "GrDrawContextPriv.h" |
| 13 #include "GrFixedClip.h" | 13 #include "GrFixedClip.h" |
| 14 #include "GrGpuResourcePriv.h" | 14 #include "GrGpuResourcePriv.h" |
| 15 #include "GrRenderTargetPriv.h" | 15 #include "GrRenderTargetPriv.h" |
| 16 #include "GrStencilAttachment.h" | 16 #include "GrStencilAttachment.h" |
| 17 #include "GrSWMaskHelper.h" | 17 #include "GrSWMaskHelper.h" |
| 18 #include "effects/GrConvexPolyEffect.h" | 18 #include "effects/GrConvexPolyEffect.h" |
| 19 #include "effects/GrRRectEffect.h" | 19 #include "effects/GrRRectEffect.h" |
| 20 #include "effects/GrTextureDomain.h" | 20 #include "effects/GrTextureDomain.h" |
| 21 | 21 |
| 22 typedef SkClipStack::Element Element; | 22 typedef SkClipStack::Element Element; |
| 23 typedef GrReducedClip::InitialState InitialState; | 23 typedef GrReducedClip::InitialState InitialState; |
| 24 typedef GrReducedClip::ElementList ElementList; | 24 typedef GrReducedClip::ElementList ElementList; |
| 25 | 25 |
| 26 static const int kMaxAnalyticElements = 4; | 26 static const int kMaxAnalyticElements = 4; |
| 27 | 27 |
| 28 bool GrClipStackClip::quickContains(const SkRect& rect) const { | 28 bool GrClipStackClip::quickContains(const SkRect& rect) const { |
| 29 if (!fStack) { | 29 if (!fStack || fStack->isWideOpen()) { |
|
bsalomon
2016/08/22 19:47:56
We don't need this call to isWideOpen() anymore, r
reed1
2016/08/22 19:49:49
Well, this is why my first version didn't put the
| |
| 30 return true; | 30 return true; |
| 31 } | 31 } |
| 32 return fStack->quickContains(rect.makeOffset(SkIntToScalar(fOrigin.x()), | 32 return fStack->quickContains(rect.makeOffset(SkIntToScalar(fOrigin.x()), |
| 33 SkIntToScalar(fOrigin.y()))); | 33 SkIntToScalar(fOrigin.y()))); |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool GrClipStackClip::quickContains(const SkRRect& rrect) const { | 36 bool GrClipStackClip::quickContains(const SkRRect& rrect) const { |
| 37 if (!fStack) { | 37 if (!fStack || fStack->isWideOpen()) { |
|
bsalomon
2016/08/22 19:47:56
or this one.
| |
| 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 void GrClipStackClip::getConservativeBounds(int width, int height, SkIRect* devR esult, | 44 void GrClipStackClip::getConservativeBounds(int width, int height, SkIRect* devR esult, |
| 45 bool* isIntersectionOfRects) const { | 45 bool* isIntersectionOfRects) const { |
| 46 if (!fStack) { | 46 if (!fStack) { |
| 47 devResult->setXYWH(0, 0, width, height); | 47 devResult->setXYWH(0, 0, width, height); |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 783 sk_sp<GrTexture> result(texProvider->createApproxTexture(desc)); | 783 sk_sp<GrTexture> result(texProvider->createApproxTexture(desc)); |
| 784 if (!result) { | 784 if (!result) { |
| 785 return nullptr; | 785 return nullptr; |
| 786 } | 786 } |
| 787 result->resourcePriv().setUniqueKey(key); | 787 result->resourcePriv().setUniqueKey(key); |
| 788 | 788 |
| 789 helper.toTexture(result.get()); | 789 helper.toTexture(result.get()); |
| 790 | 790 |
| 791 return result; | 791 return result; |
| 792 } | 792 } |
| OLD | NEW |