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

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

Issue 445233006: 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: add comment 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 SkASSERT(0 == yoff->fOffset);
701
702 const uint8_t* row = head->data();
703 int width = fBounds.width();
704 do {
705 if (row[1] != 0xFF) {
706 return false;
707 }
708 int n = row[0];
709 SkASSERT(n <= width);
710 width -= n;
711 row += 2;
712 } while (width > 0);
713 return true;
714 }
715
687 bool SkAAClip::setRect(const SkRect& r, bool doAA) { 716 bool SkAAClip::setRect(const SkRect& r, bool doAA) {
688 if (r.isEmpty()) { 717 if (r.isEmpty()) {
689 return this->setEmpty(); 718 return this->setEmpty();
690 } 719 }
691 720
692 AUTO_AACLIP_VALIDATE(*this); 721 AUTO_AACLIP_VALIDATE(*this);
693 722
694 // TODO: special case this 723 // TODO: special case this
695 724
696 SkPath path; 725 SkPath path;
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
2160 rowMask.fBounds.fBottom = y + 1; 2189 rowMask.fBounds.fBottom = y + 1;
2161 fBlitter->blitMask(rowMask, rowMask.fBounds); 2190 fBlitter->blitMask(rowMask, rowMask.fBounds);
2162 src = (const void*)((const char*)src + srcRB); 2191 src = (const void*)((const char*)src + srcRB);
2163 } while (++y < localStopY); 2192 } while (++y < localStopY);
2164 } while (y < stopY); 2193 } while (y < stopY);
2165 } 2194 }
2166 2195
2167 const SkBitmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) { 2196 const SkBitmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) {
2168 return NULL; 2197 return NULL;
2169 } 2198 }
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