| OLD | NEW |
| 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 | 359 |
| 360 SkMatrix sampleM; | 360 SkMatrix sampleM; |
| 361 sampleM.setIDiv(srcMask->width(), srcMask->height()); | 361 sampleM.setIDiv(srcMask->width(), srcMask->height()); |
| 362 | 362 |
| 363 drawState->addColorEffect( | 363 drawState->addColorEffect( |
| 364 GrTextureDomainEffect::Create(srcMask, | 364 GrTextureDomainEffect::Create(srcMask, |
| 365 sampleM, | 365 sampleM, |
| 366 GrTextureDomainEffect::MakeTexelDomain(src
Mask, srcBound), | 366 GrTextureDomainEffect::MakeTexelDomain(src
Mask, srcBound), |
| 367 GrTextureDomainEffect::kDecal_WrapMode, | 367 GrTextureDomainEffect::kDecal_WrapMode, |
| 368 GrTextureParams::kNone_FilterMode))->unref
(); | 368 GrTextureParams::kNone_FilterMode))->unref
(); |
| 369 fGpu->drawSimpleRect(SkRect::MakeFromIRect(dstBound), NULL); | 369 fGpu->drawSimpleRect(SkRect::Make(dstBound), NULL); |
| 370 } | 370 } |
| 371 | 371 |
| 372 // get a texture to act as a temporary buffer for AA clip boolean operations | 372 // get a texture to act as a temporary buffer for AA clip boolean operations |
| 373 // TODO: given the expense of createTexture we may want to just cache this too | 373 // TODO: given the expense of createTexture we may want to just cache this too |
| 374 void GrClipMaskManager::getTemp(int width, int height, GrAutoScratchTexture* tem
p) { | 374 void GrClipMaskManager::getTemp(int width, int height, GrAutoScratchTexture* tem
p) { |
| 375 if (NULL != temp->texture()) { | 375 if (NULL != temp->texture()) { |
| 376 // we've already allocated the temp texture | 376 // we've already allocated the temp texture |
| 377 return; | 377 return; |
| 378 } | 378 } |
| 379 | 379 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 fGpu->drawSimpleRect(element->getRect(), NULL); | 715 fGpu->drawSimpleRect(element->getRect(), NULL); |
| 716 } else { | 716 } else { |
| 717 SkASSERT(Element::kPath_Type == element->getType()); | 717 SkASSERT(Element::kPath_Type == element->getType()); |
| 718 SET_RANDOM_COLOR | 718 SET_RANDOM_COLOR |
| 719 pr->drawPath(*clipPath, stroke, fGpu, false); | 719 pr->drawPath(*clipPath, stroke, fGpu, false); |
| 720 } | 720 } |
| 721 } else { | 721 } else { |
| 722 SET_RANDOM_COLOR | 722 SET_RANDOM_COLOR |
| 723 // The view matrix is setup to do clip space -> stencil spac
e translation, so | 723 // The view matrix is setup to do clip space -> stencil spac
e translation, so |
| 724 // draw rect in clip space. | 724 // draw rect in clip space. |
| 725 fGpu->drawSimpleRect(SkRect::MakeFromIRect(clipSpaceIBounds)
, NULL); | 725 fGpu->drawSimpleRect(SkRect::Make(clipSpaceIBounds), NULL); |
| 726 } | 726 } |
| 727 } | 727 } |
| 728 } | 728 } |
| 729 } | 729 } |
| 730 // set this last because recursive draws may overwrite it back to kNone. | 730 // set this last because recursive draws may overwrite it back to kNone. |
| 731 SkASSERT(kNone_ClipMaskType == fCurrClipMaskType); | 731 SkASSERT(kNone_ClipMaskType == fCurrClipMaskType); |
| 732 fCurrClipMaskType = kStencil_ClipMaskType; | 732 fCurrClipMaskType = kStencil_ClipMaskType; |
| 733 return true; | 733 return true; |
| 734 } | 734 } |
| 735 | 735 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 | 954 |
| 955 const Element* element = iter.get(); | 955 const Element* element = iter.get(); |
| 956 SkRegion::Op op = element->getOp(); | 956 SkRegion::Op op = element->getOp(); |
| 957 | 957 |
| 958 if (SkRegion::kIntersect_Op == op || SkRegion::kReverseDifference_Op ==
op) { | 958 if (SkRegion::kIntersect_Op == op || SkRegion::kReverseDifference_Op ==
op) { |
| 959 // Intersect and reverse difference require modifying pixels outside
of the geometry | 959 // Intersect and reverse difference require modifying pixels outside
of the geometry |
| 960 // that is being "drawn". In both cases we erase all the pixels outs
ide of the geometry | 960 // that is being "drawn". In both cases we erase all the pixels outs
ide of the geometry |
| 961 // but leave the pixels inside the geometry alone. For reverse diffe
rence we invert all | 961 // but leave the pixels inside the geometry alone. For reverse diffe
rence we invert all |
| 962 // the pixels before clearing the ones outside the geometry. | 962 // the pixels before clearing the ones outside the geometry. |
| 963 if (SkRegion::kReverseDifference_Op == op) { | 963 if (SkRegion::kReverseDifference_Op == op) { |
| 964 SkRect temp = SkRect::MakeFromIRect(clipSpaceIBounds); | 964 SkRect temp = SkRect::Make(clipSpaceIBounds); |
| 965 // invert the entire scene | 965 // invert the entire scene |
| 966 helper.draw(temp, SkRegion::kXOR_Op, false, 0xFF); | 966 helper.draw(temp, SkRegion::kXOR_Op, false, 0xFF); |
| 967 } | 967 } |
| 968 | 968 |
| 969 if (Element::kRect_Type == element->getType()) { | 969 if (Element::kRect_Type == element->getType()) { |
| 970 // convert the rect to a path so we can invert the fill | 970 // convert the rect to a path so we can invert the fill |
| 971 SkPath temp; | 971 SkPath temp; |
| 972 temp.addRect(element->getRect()); | 972 temp.addRect(element->getRect()); |
| 973 temp.setFillType(SkPath::kInverseEvenOdd_FillType); | 973 temp.setFillType(SkPath::kInverseEvenOdd_FillType); |
| 974 | 974 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 | 1031 |
| 1032 // TODO: dynamically attach a stencil buffer | 1032 // TODO: dynamically attach a stencil buffer |
| 1033 int stencilBits = 0; | 1033 int stencilBits = 0; |
| 1034 GrStencilBuffer* stencilBuffer = | 1034 GrStencilBuffer* stencilBuffer = |
| 1035 drawState.getRenderTarget()->getStencilBuffer(); | 1035 drawState.getRenderTarget()->getStencilBuffer(); |
| 1036 if (NULL != stencilBuffer) { | 1036 if (NULL != stencilBuffer) { |
| 1037 stencilBits = stencilBuffer->bits(); | 1037 stencilBits = stencilBuffer->bits(); |
| 1038 this->adjustStencilParams(settings, clipMode, stencilBits); | 1038 this->adjustStencilParams(settings, clipMode, stencilBits); |
| 1039 } | 1039 } |
| 1040 } | 1040 } |
| OLD | NEW |