Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: src/gpu/GrClipMaskManager.cpp

Issue 2145573002: Revert of Pre-crop filled rects to avoid scissor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrClip.cpp ('k') | src/gpu/GrDrawContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 "GrClipMaskManager.h" 8 #include "GrClipMaskManager.h"
9 #include "GrCaps.h" 9 #include "GrCaps.h"
10 #include "GrDrawingManager.h" 10 #include "GrDrawingManager.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 &genID, 261 &genID,
262 &initialState, 262 &initialState,
263 &clipSpaceIBounds, 263 &clipSpaceIBounds,
264 &requiresAA); 264 &requiresAA);
265 if (elements.isEmpty()) { 265 if (elements.isEmpty()) {
266 if (GrReducedClip::kAllOut_InitialState == initialState) { 266 if (GrReducedClip::kAllOut_InitialState == initialState) {
267 return false; 267 return false;
268 } else { 268 } else {
269 SkIRect scissorSpaceIBounds(clipSpaceIBounds); 269 SkIRect scissorSpaceIBounds(clipSpaceIBounds);
270 scissorSpaceIBounds.offset(-clip.origin()); 270 scissorSpaceIBounds.offset(-clip.origin());
271 if (!GrClip::CanIgnoreScissor(scissorSpaceIBounds, devBounds)) { 271 if (!SkRect::Make(scissorSpaceIBounds).contains(devBounds)) {
272 out->makeScissored(scissorSpaceIBounds); 272 out->makeScissored(scissorSpaceIBounds);
273 } 273 }
274 return true; 274 return true;
275 } 275 }
276 } 276 }
277 277
278 // An element count of 4 was chosen because of the common pattern in Blink o f: 278 // An element count of 4 was chosen because of the common pattern in Blink o f:
279 // isect RR 279 // isect RR
280 // diff RR 280 // diff RR
281 // isect convex_poly 281 // isect convex_poly
(...skipping 13 matching lines...) Expand all
295 // is multisampled. 295 // is multisampled.
296 disallowAnalyticAA = pipelineBuilder.isHWAntialias() || 296 disallowAnalyticAA = pipelineBuilder.isHWAntialias() ||
297 pipelineBuilder.hasUserStencilSettings(); 297 pipelineBuilder.hasUserStencilSettings();
298 } 298 }
299 sk_sp<GrFragmentProcessor> clipFP; 299 sk_sp<GrFragmentProcessor> clipFP;
300 if (requiresAA && 300 if (requiresAA &&
301 get_analytic_clip_processor(elements, disallowAnalyticAA, clipToRTOf fset, devBounds, 301 get_analytic_clip_processor(elements, disallowAnalyticAA, clipToRTOf fset, devBounds,
302 &clipFP)) { 302 &clipFP)) {
303 SkIRect scissorSpaceIBounds(clipSpaceIBounds); 303 SkIRect scissorSpaceIBounds(clipSpaceIBounds);
304 scissorSpaceIBounds.offset(-clip.origin()); 304 scissorSpaceIBounds.offset(-clip.origin());
305 if (GrClip::CanIgnoreScissor(scissorSpaceIBounds, devBounds)) { 305 if (!SkRect::Make(scissorSpaceIBounds).contains(devBounds)) {
306 out->makeFPBased(std::move(clipFP), SkRect::Make(scissorSpaceIBo unds));
307 } else {
308 out->makeScissoredFPBased(std::move(clipFP), scissorSpaceIBounds ); 306 out->makeScissoredFPBased(std::move(clipFP), scissorSpaceIBounds );
307 return true;
309 } 308 }
309 out->makeFPBased(std::move(clipFP), SkRect::Make(scissorSpaceIBounds ));
310 return true; 310 return true;
311 } 311 }
312 } 312 }
313 313
314 // If the stencil buffer is multisampled we can use it to do everything. 314 // If the stencil buffer is multisampled we can use it to do everything.
315 if (!drawContext->isStencilBufferMultisampled() && requiresAA) { 315 if (!drawContext->isStencilBufferMultisampled() && requiresAA) {
316 sk_sp<GrTexture> result; 316 sk_sp<GrTexture> result;
317 317
318 // The top-left of the mask corresponds to the top-left corner of the bo unds. 318 // The top-left of the mask corresponds to the top-left corner of the bo unds.
319 SkVector clipToMaskOffset = { 319 SkVector clipToMaskOffset = {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 initialState, 362 initialState,
363 elements, 363 elements,
364 clipSpaceIBounds, 364 clipSpaceIBounds,
365 clipSpaceToStencilSpaceOffset); 365 clipSpaceToStencilSpaceOffset);
366 366
367 // This must occur after createStencilClipMask. That function may change the scissor. Also, it 367 // This must occur after createStencilClipMask. That function may change the scissor. Also, it
368 // only guarantees that the stencil mask is correct within the bounds it was passed, so we must 368 // only guarantees that the stencil mask is correct within the bounds it was passed, so we must
369 // use both stencil and scissor test to the bounds for the final draw. 369 // use both stencil and scissor test to the bounds for the final draw.
370 SkIRect scissorSpaceIBounds(clipSpaceIBounds); 370 SkIRect scissorSpaceIBounds(clipSpaceIBounds);
371 scissorSpaceIBounds.offset(clipSpaceToStencilSpaceOffset); 371 scissorSpaceIBounds.offset(clipSpaceToStencilSpaceOffset);
372 if (GrClip::CanIgnoreScissor(scissorSpaceIBounds, devBounds)) { 372 out->makeScissoredStencil(scissorSpaceIBounds);
373 out->makeStencil(true, devBounds);
374 } else {
375 out->makeScissoredStencil(scissorSpaceIBounds);
376 }
377 return true; 373 return true;
378 } 374 }
379 375
380 static bool stencil_element(GrDrawContext* dc, 376 static bool stencil_element(GrDrawContext* dc,
381 const GrFixedClip& clip, 377 const GrFixedClip& clip,
382 const GrUserStencilSettings* ss, 378 const GrUserStencilSettings* ss,
383 const SkMatrix& viewMatrix, 379 const SkMatrix& viewMatrix,
384 const SkClipStack::Element* element) { 380 const SkClipStack::Element* element) {
385 381
386 // TODO: Draw rrects directly here. 382 // TODO: Draw rrects directly here.
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 sk_sp<GrTexture> result(texProvider->createApproxTexture(desc)); 805 sk_sp<GrTexture> result(texProvider->createApproxTexture(desc));
810 if (!result) { 806 if (!result) {
811 return nullptr; 807 return nullptr;
812 } 808 }
813 result->resourcePriv().setUniqueKey(key); 809 result->resourcePriv().setUniqueKey(key);
814 810
815 helper.toTexture(result.get()); 811 helper.toTexture(result.get());
816 812
817 return result; 813 return result;
818 } 814 }
OLDNEW
« no previous file with comments | « src/gpu/GrClip.cpp ('k') | src/gpu/GrDrawContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698