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

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

Issue 1301823005: Reland of Implement canComputeFastBounds() for image filters. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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/SkImageFilter.cpp ('k') | src/effects/SkColorFilterImageFilter.cpp » ('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 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkPaint.h" 8 #include "SkPaint.h"
9 #include "SkAnnotation.h" 9 #include "SkAnnotation.h"
10 #include "SkAutoKern.h" 10 #include "SkAutoKern.h"
(...skipping 2045 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 // since we know we're just going to delete tmpPath when we return, 2056 // since we know we're just going to delete tmpPath when we return,
2057 // so the swap saves that copy. 2057 // so the swap saves that copy.
2058 dst->swap(tmpPath); 2058 dst->swap(tmpPath);
2059 } else { 2059 } else {
2060 *dst = *srcPtr; 2060 *dst = *srcPtr;
2061 } 2061 }
2062 } 2062 }
2063 return !rec.isHairlineStyle(); 2063 return !rec.isHairlineStyle();
2064 } 2064 }
2065 2065
2066 bool SkPaint::canComputeFastBounds() const {
2067 if (this->getLooper()) {
2068 return this->getLooper()->canComputeFastBounds(*this);
2069 }
2070 if (this->getImageFilter() && !this->getImageFilter()->canComputeFastBounds( )) {
2071 return false;
2072 }
2073 return !this->getRasterizer();
2074 }
2075
2066 const SkRect& SkPaint::doComputeFastBounds(const SkRect& origSrc, 2076 const SkRect& SkPaint::doComputeFastBounds(const SkRect& origSrc,
2067 SkRect* storage, 2077 SkRect* storage,
2068 Style style) const { 2078 Style style) const {
2069 SkASSERT(storage); 2079 SkASSERT(storage);
2070 2080
2071 const SkRect* src = &origSrc; 2081 const SkRect* src = &origSrc;
2072 2082
2073 if (this->getLooper()) { 2083 if (this->getLooper()) {
2074 SkASSERT(this->getLooper()->canComputeFastBounds(*this)); 2084 SkASSERT(this->getLooper()->canComputeFastBounds(*this));
2075 this->getLooper()->computeFastBounds(*this, *src, storage); 2085 this->getLooper()->computeFastBounds(*this, *src, storage);
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
2417 } 2427 }
2418 2428
2419 uint32_t SkPaint::getHash() const { 2429 uint32_t SkPaint::getHash() const {
2420 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB itfields, 2430 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB itfields,
2421 // so fBitfields should be 10 pointers and 6 32-bit values from the start. 2431 // so fBitfields should be 10 pointers and 6 32-bit values from the start.
2422 SK_COMPILE_ASSERT(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 * sizeof(uint32_t), 2432 SK_COMPILE_ASSERT(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 * sizeof(uint32_t),
2423 SkPaint_notPackedTightly); 2433 SkPaint_notPackedTightly);
2424 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), 2434 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this),
2425 offsetof(SkPaint, fBitfields) + sizeof(fBitfields )); 2435 offsetof(SkPaint, fBitfields) + sizeof(fBitfields ));
2426 } 2436 }
OLDNEW
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | src/effects/SkColorFilterImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698