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

Side by Side Diff: src/core/SkCanvas.cpp

Issue 22947003: Make ClipStack honor save flags (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 4 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 | « include/core/SkDeque.h ('k') | 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 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
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 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 713
714 int SkCanvas::internalSave(SaveFlags flags) { 714 int SkCanvas::internalSave(SaveFlags flags) {
715 int saveCount = this->getSaveCount(); // record this before the actual save 715 int saveCount = this->getSaveCount(); // record this before the actual save
716 716
717 MCRec* newTop = (MCRec*)fMCStack.push_back(); 717 MCRec* newTop = (MCRec*)fMCStack.push_back();
718 new (newTop) MCRec(fMCRec, flags); // balanced in restore() 718 new (newTop) MCRec(fMCRec, flags); // balanced in restore()
719 719
720 newTop->fNext = fMCRec; 720 newTop->fNext = fMCRec;
721 fMCRec = newTop; 721 fMCRec = newTop;
722 722
723 fClipStack.save(); 723 if (SkCanvas::kClip_SaveFlag & flags) {
724 SkASSERT(fClipStack.getSaveCount() == this->getSaveCount() - 1); 724 fClipStack.save();
725 }
725 726
726 return saveCount; 727 return saveCount;
727 } 728 }
728 729
729 int SkCanvas::save(SaveFlags flags) { 730 int SkCanvas::save(SaveFlags flags) {
730 // call shared impl 731 // call shared impl
731 return this->internalSave(flags); 732 return this->internalSave(flags);
732 } 733 }
733 734
734 #define C32MASK (1 << SkBitmap::kARGB_8888_Config) 735 #define C32MASK (1 << SkBitmap::kARGB_8888_Config)
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 this->internalRestore(); 890 this->internalRestore();
890 } 891 }
891 } 892 }
892 893
893 void SkCanvas::internalRestore() { 894 void SkCanvas::internalRestore() {
894 SkASSERT(fMCStack.count() != 0); 895 SkASSERT(fMCStack.count() != 0);
895 896
896 fDeviceCMDirty = true; 897 fDeviceCMDirty = true;
897 fLocalBoundsCompareTypeDirty = true; 898 fLocalBoundsCompareTypeDirty = true;
898 899
899 fClipStack.restore(); 900 SkRasterClip* oldRasterClip = fMCRec->fRasterClip;
901
900 // reserve our layer (if any) 902 // reserve our layer (if any)
901 DeviceCM* layer = fMCRec->fLayer; // may be null 903 DeviceCM* layer = fMCRec->fLayer; // may be null
902 // now detach it from fMCRec so we can pop(). Gets freed after its drawn 904 // now detach it from fMCRec so we can pop(). Gets freed after its drawn
903 fMCRec->fLayer = NULL; 905 fMCRec->fLayer = NULL;
904 906
905 // now do the normal restore() 907 // now do the normal restore()
906 fMCRec->~MCRec(); // balanced in save() 908 fMCRec->~MCRec(); // balanced in save()
907 fMCStack.pop_back(); 909 fMCStack.pop_back();
908 fMCRec = (MCRec*)fMCStack.back(); 910 fMCRec = (MCRec*)fMCStack.back();
909 911
912 if (NULL == fMCRec || fMCRec->fRasterClip != oldRasterClip) {
bsalomon 2013/08/14 15:49:13 eek.. don't we want to stop computing raster clip
robertphillips 2013/08/14 16:16:58 That is the problem.
reed1 2013/08/14 16:51:31 If we pass the flags (or a subset of them) to clip
robertphillips 2013/08/14 17:00:16 So a ClipStack frame would store the number of res
bsalomon 2013/08/14 18:23:28 yeah I don't see why clip stack should see saves t
913 fClipStack.restore();
914 }
915
910 /* Time to draw the layer's offscreen. We can't call the public drawSprite, 916 /* Time to draw the layer's offscreen. We can't call the public drawSprite,
911 since if we're being recorded, we don't want to record this (the 917 since if we're being recorded, we don't want to record this (the
912 recorder will have already recorded the restore). 918 recorder will have already recorded the restore).
913 */ 919 */
914 if (NULL != layer) { 920 if (NULL != layer) {
915 if (layer->fNext) { 921 if (layer->fNext) {
916 const SkIPoint& origin = layer->fDevice->getOrigin(); 922 const SkIPoint& origin = layer->fDevice->getOrigin();
917 this->internalDrawDevice(layer->fDevice, origin.x(), origin.y(), 923 this->internalDrawDevice(layer->fDevice, origin.x(), origin.y(),
918 layer->fPaint); 924 layer->fPaint);
919 // reset this, since internalDrawDevice will have set it to true 925 // reset this, since internalDrawDevice will have set it to true
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after
2213 return *paint; 2219 return *paint;
2214 } 2220 }
2215 2221
2216 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); } 2222 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); }
2217 int SkCanvas::LayerIter::x() const { return fImpl->getX(); } 2223 int SkCanvas::LayerIter::x() const { return fImpl->getX(); }
2218 int SkCanvas::LayerIter::y() const { return fImpl->getY(); } 2224 int SkCanvas::LayerIter::y() const { return fImpl->getY(); }
2219 2225
2220 /////////////////////////////////////////////////////////////////////////////// 2226 ///////////////////////////////////////////////////////////////////////////////
2221 2227
2222 SkCanvas::ClipVisitor::~ClipVisitor() { } 2228 SkCanvas::ClipVisitor::~ClipVisitor() { }
OLDNEW
« no previous file with comments | « include/core/SkDeque.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698