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

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

Issue 471473002: Optimize CSS box-shadow performance (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: store SkMask and SkCachedData in cache Created 6 years, 2 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 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 "SkScalerContext.h" 10 #include "SkScalerContext.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 203 }
204 204
205 if (fMaskFilter) { 205 if (fMaskFilter) {
206 SkMask src, dst; 206 SkMask src, dst;
207 SkMatrix matrix; 207 SkMatrix matrix;
208 208
209 glyph->toMask(&src); 209 glyph->toMask(&src);
210 fRec.getMatrixFrom2x2(&matrix); 210 fRec.getMatrixFrom2x2(&matrix);
211 211
212 src.fImage = NULL; // only want the bounds from the filter 212 src.fImage = NULL; // only want the bounds from the filter
213 if (fMaskFilter->filterMask(&dst, src, matrix, NULL)) { 213 if (fMaskFilter->filterMask(&dst, src, matrix, NULL, NULL)) {
214 if (dst.fBounds.isEmpty() || !dst.fBounds.is16Bit()) { 214 if (dst.fBounds.isEmpty() || !dst.fBounds.is16Bit()) {
215 goto SK_ERROR; 215 goto SK_ERROR;
216 } 216 }
217 SkASSERT(dst.fImage == NULL); 217 SkASSERT(dst.fImage == NULL);
218 glyph->fLeft = dst.fBounds.fLeft; 218 glyph->fLeft = dst.fBounds.fLeft;
219 glyph->fTop = dst.fBounds.fTop; 219 glyph->fTop = dst.fBounds.fTop;
220 glyph->fWidth = SkToU16(dst.fBounds.width()); 220 glyph->fWidth = SkToU16(dst.fBounds.width());
221 glyph->fHeight = SkToU16(dst.fBounds.height()); 221 glyph->fHeight = SkToU16(dst.fBounds.height());
222 glyph->fMaskFormat = dst.fFormat; 222 glyph->fMaskFormat = dst.fFormat;
223 } 223 }
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 srcM.fRowBytes = SkAlign4(srcM.fBounds.width()); 582 srcM.fRowBytes = SkAlign4(srcM.fBounds.width());
583 size_t size = srcM.computeImageSize(); 583 size_t size = srcM.computeImageSize();
584 a8storage.reset(size); 584 a8storage.reset(size);
585 srcM.fImage = (uint8_t*)a8storage.get(); 585 srcM.fImage = (uint8_t*)a8storage.get();
586 extract_alpha(srcM, 586 extract_alpha(srcM,
587 (const SkPMColor*)glyph->fImage, glyph->rowBytes()); 587 (const SkPMColor*)glyph->fImage, glyph->rowBytes());
588 } 588 }
589 589
590 fRec.getMatrixFrom2x2(&matrix); 590 fRec.getMatrixFrom2x2(&matrix);
591 591
592 if (fMaskFilter->filterMask(&dstM, srcM, matrix, NULL)) { 592 if (fMaskFilter->filterMask(&dstM, srcM, matrix, NULL, NULL)) {
593 int width = SkFastMin32(origGlyph.fWidth, dstM.fBounds.width()); 593 int width = SkFastMin32(origGlyph.fWidth, dstM.fBounds.width());
594 int height = SkFastMin32(origGlyph.fHeight, dstM.fBounds.height()); 594 int height = SkFastMin32(origGlyph.fHeight, dstM.fBounds.height());
595 int dstRB = origGlyph.rowBytes(); 595 int dstRB = origGlyph.rowBytes();
596 int srcRB = dstM.fRowBytes; 596 int srcRB = dstM.fRowBytes;
597 597
598 const uint8_t* src = (const uint8_t*)dstM.fImage; 598 const uint8_t* src = (const uint8_t*)dstM.fImage;
599 uint8_t* dst = (uint8_t*)origGlyph.fImage; 599 uint8_t* dst = (uint8_t*)origGlyph.fImage;
600 600
601 if (SkMask::k3D_Format == dstM.fFormat) { 601 if (SkMask::k3D_Format == dstM.fFormat) {
602 // we have to copy 3 times as much 602 // we have to copy 3 times as much
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, 792 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc,
793 bool allowFailure) const { 793 bool allowFailure) const {
794 SkScalerContext* c = this->onCreateScalerContext(desc); 794 SkScalerContext* c = this->onCreateScalerContext(desc);
795 795
796 if (!c && !allowFailure) { 796 if (!c && !allowFailure) {
797 c = SkNEW_ARGS(SkScalerContext_Empty, 797 c = SkNEW_ARGS(SkScalerContext_Empty,
798 (const_cast<SkTypeface*>(this), desc)); 798 (const_cast<SkTypeface*>(this), desc));
799 } 799 }
800 return c; 800 return c;
801 } 801 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698