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

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

Issue 169763002: Fix another clipstack element !rect doesn't mean path bug. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: another spot in same function Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrClipMaskManager.h" 9 #include "GrClipMaskManager.h"
10 #include "GrAAConvexPathRenderer.h" 10 #include "GrAAConvexPathRenderer.h"
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 // Intersect and reverse difference require modifying pixels outside of the geometry 1014 // Intersect and reverse difference require modifying pixels outside of the geometry
1015 // that is being "drawn". In both cases we erase all the pixels outs ide of the geometry 1015 // that is being "drawn". In both cases we erase all the pixels outs ide of the geometry
1016 // but leave the pixels inside the geometry alone. For reverse diffe rence we invert all 1016 // but leave the pixels inside the geometry alone. For reverse diffe rence we invert all
1017 // the pixels before clearing the ones outside the geometry. 1017 // the pixels before clearing the ones outside the geometry.
1018 if (SkRegion::kReverseDifference_Op == op) { 1018 if (SkRegion::kReverseDifference_Op == op) {
1019 SkRect temp = SkRect::Make(clipSpaceIBounds); 1019 SkRect temp = SkRect::Make(clipSpaceIBounds);
1020 // invert the entire scene 1020 // invert the entire scene
1021 helper.draw(temp, SkRegion::kXOR_Op, false, 0xFF); 1021 helper.draw(temp, SkRegion::kXOR_Op, false, 0xFF);
1022 } 1022 }
1023 1023
1024 if (Element::kRect_Type == element->getType()) { 1024 SkPath clipPath;
1025 // convert the rect to a path so we can invert the fill 1025 element->asPath(&clipPath);
1026 SkPath temp; 1026 clipPath.toggleInverseFillType();
1027 temp.addRect(element->getRect()); 1027 helper.draw(clipPath, stroke, SkRegion::kReplace_Op, element->isAA() , 0x00);
1028 temp.setFillType(SkPath::kInverseEvenOdd_FillType);
1029
1030 helper.draw(temp, stroke, SkRegion::kReplace_Op,
1031 element->isAA(),
1032 0x00);
1033 } else {
1034 SkASSERT(Element::kPath_Type == element->getType());
1035 SkPath clipPath = element->getPath();
1036 clipPath.toggleInverseFillType();
1037 helper.draw(clipPath, stroke,
1038 SkRegion::kReplace_Op,
1039 element->isAA(),
1040 0x00);
1041 }
1042 1028
1043 continue; 1029 continue;
1044 } 1030 }
1045 1031
1046 // The other ops (union, xor, diff) only affect pixels inside 1032 // The other ops (union, xor, diff) only affect pixels inside
1047 // the geometry so they can just be drawn normally 1033 // the geometry so they can just be drawn normally
1048 if (Element::kRect_Type == element->getType()) { 1034 if (Element::kRect_Type == element->getType()) {
1049 helper.draw(element->getRect(), op, element->isAA(), 0xFF); 1035 helper.draw(element->getRect(), op, element->isAA(), 0xFF);
1050 } else { 1036 } else {
1051 SkASSERT(Element::kPath_Type == element->getType()); 1037 SkPath path;
1052 helper.draw(element->getPath(), stroke, op, element->isAA(), 0xFF); 1038 element->asPath(&path);
1039 helper.draw(path, stroke, op, element->isAA(), 0xFF);
1053 } 1040 }
1054 } 1041 }
1055 1042
1056 helper.toTexture(result); 1043 helper.toTexture(result);
1057 1044
1058 fCurrClipMaskType = kAlpha_ClipMaskType; 1045 fCurrClipMaskType = kAlpha_ClipMaskType;
1059 return result; 1046 return result;
1060 } 1047 }
1061 1048
1062 //////////////////////////////////////////////////////////////////////////////// 1049 ////////////////////////////////////////////////////////////////////////////////
(...skipping 23 matching lines...) Expand all
1086 1073
1087 // TODO: dynamically attach a stencil buffer 1074 // TODO: dynamically attach a stencil buffer
1088 int stencilBits = 0; 1075 int stencilBits = 0;
1089 GrStencilBuffer* stencilBuffer = 1076 GrStencilBuffer* stencilBuffer =
1090 drawState.getRenderTarget()->getStencilBuffer(); 1077 drawState.getRenderTarget()->getStencilBuffer();
1091 if (NULL != stencilBuffer) { 1078 if (NULL != stencilBuffer) {
1092 stencilBits = stencilBuffer->bits(); 1079 stencilBits = stencilBuffer->bits();
1093 this->adjustStencilParams(settings, clipMode, stencilBits); 1080 this->adjustStencilParams(settings, clipMode, stencilBits);
1094 } 1081 }
1095 } 1082 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698