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

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

Issue 443353004: add isRect() check to AAClip, to detect if a soft-clip is really just an irect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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
« no previous file with comments | « src/core/SkAAClip.h ('k') | src/core/SkRasterClip.h » ('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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 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 "SkAAClip.h" 9 #include "SkAAClip.h"
10 #include "SkBlitter.h" 10 #include "SkBlitter.h"
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 return this->setPath(path); 677 return this->setPath(path);
678 #else 678 #else
679 this->freeRuns(); 679 this->freeRuns();
680 fBounds = bounds; 680 fBounds = bounds;
681 fRunHead = RunHead::AllocRect(bounds); 681 fRunHead = RunHead::AllocRect(bounds);
682 SkASSERT(!this->isEmpty()); 682 SkASSERT(!this->isEmpty());
683 return true; 683 return true;
684 #endif 684 #endif
685 } 685 }
686 686
687 bool SkAAClip::isRect() const {
688 if (this->isEmpty()) {
689 return false;
690 }
691
692 const RunHead* head = fRunHead;
693 if (head->fRowCount != 1) {
694 return false;
695 }
696 const YOffset* yoff = head->yoffsets();
697 if (yoff->fY != fBounds.fBottom - 1) {
698 return false;
699 }
700
701 const uint8_t* row = head->data() + yoff->fOffset;
702 int width = fBounds.width();
703 do {
704 if (row[1] != 0xFF) {
705 return false;
706 }
707 int n = row[0];
708 SkASSERT(n <= width);
709 width -= n;
710 row += 2;
711 } while (width > 0);
712 return true;
713 }
714
687 bool SkAAClip::setRect(const SkRect& r, bool doAA) { 715 bool SkAAClip::setRect(const SkRect& r, bool doAA) {
688 if (r.isEmpty()) { 716 if (r.isEmpty()) {
689 return this->setEmpty(); 717 return this->setEmpty();
690 } 718 }
691 719
692 AUTO_AACLIP_VALIDATE(*this); 720 AUTO_AACLIP_VALIDATE(*this);
693 721
694 // TODO: special case this 722 // TODO: special case this
695 723
696 SkPath path; 724 SkPath path;
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
2160 rowMask.fBounds.fBottom = y + 1; 2188 rowMask.fBounds.fBottom = y + 1;
2161 fBlitter->blitMask(rowMask, rowMask.fBounds); 2189 fBlitter->blitMask(rowMask, rowMask.fBounds);
2162 src = (const void*)((const char*)src + srcRB); 2190 src = (const void*)((const char*)src + srcRB);
2163 } while (++y < localStopY); 2191 } while (++y < localStopY);
2164 } while (y < stopY); 2192 } while (y < stopY);
2165 } 2193 }
2166 2194
2167 const SkBitmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) { 2195 const SkBitmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) {
2168 return NULL; 2196 return NULL;
2169 } 2197 }
OLDNEW
« no previous file with comments | « src/core/SkAAClip.h ('k') | src/core/SkRasterClip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698