Bug 1313135 - Make an early return if the clip rect can be ignored. r=mchang a=jcristau
authorKevin Chen <kechen@mozilla.com>
Mon, 21 Nov 2016 18:55:00 -0500
changeset 353353 a88789dae8ee5ea97ccffa773f1c39fc91d5be93
parent 353352 41dfabec7e72f58119aac0054ac192de66bcde42
child 353354 c827f0883eef1c6c37c54aaf2a425e8a165de988
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmchang, jcristau
bugs1313135
milestone52.0a2
Bug 1313135 - Make an early return if the clip rect can be ignored. r=mchang a=jcristau
gfx/skia/skia/src/gpu/GrClipStackClip.cpp
gfx/skia/skia/src/utils/SkLua.cpp
--- a/gfx/skia/skia/src/gpu/GrClipStackClip.cpp
+++ b/gfx/skia/skia/src/gpu/GrClipStackClip.cpp
@@ -264,17 +264,18 @@ static bool get_analytic_clip_processor(
 // scissor, or entirely software
 bool GrClipStackClip::apply(GrContext* context, GrDrawContext* drawContext, bool useHWAA,
                             bool hasUserStencilSettings, GrAppliedClip* out) const {
     if (!fStack || fStack->isWideOpen()) {
         return true;
     }
 
     SkRect devBounds = SkRect::MakeIWH(drawContext->width(), drawContext->height());
-    if (!devBounds.intersect(out->clippedDrawBounds())) {
+    if (!devBounds.intersect(out->clippedDrawBounds()) ||
+        GrClip::GetPixelIBounds(devBounds).isEmpty()) {
         return false;
     }
 
     GrRenderTarget* rt = drawContext->accessRenderTarget();
 
     const SkScalar clipX = SkIntToScalar(fOrigin.x()),
                    clipY = SkIntToScalar(fOrigin.y());
 
--- a/gfx/skia/skia/src/utils/SkLua.cpp
+++ b/gfx/skia/skia/src/utils/SkLua.cpp
@@ -3,16 +3,17 @@
  *
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
 #include "SkLua.h"
 
 #if SK_SUPPORT_GPU
+#include "GrClip.h"
 #include "GrReducedClip.h"
 #endif
 
 #include "SkBlurImageFilter.h"
 #include "SkCanvas.h"
 #include "SkColorFilter.h"
 #include "SkData.h"
 #include "SkDocument.h"
@@ -637,16 +638,18 @@ static int lcanvas_getClipStack(lua_Stat
     SkLua(L).pushClipStack(*get_ref<SkCanvas>(L, 1)->getClipStack());
     return 1;
 }
 
 int SkLua::lcanvas_getReducedClipStack(lua_State* L) {
 #if SK_SUPPORT_GPU
     const SkCanvas* canvas = get_ref<SkCanvas>(L, 1);
     SkRect queryBounds = SkRect::Make(canvas->getTopLayerBounds());
+    SkASSERT(!GrClip::GetPixelIBounds(queryBounds).isEmpty());
+
     const GrReducedClip reducedClip(*canvas->getClipStack(), queryBounds);
 
     GrReducedClip::ElementList::Iter iter(reducedClip.elements());
     int i = 0;
     lua_newtable(L);
     while(iter.get()) {
         SkLua(L).pushClipStackElement(*iter.get());
         iter.next();