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

Side by Side Diff: src/effects/SkTableMaskFilter.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 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 9
10 #include "SkTableMaskFilter.h" 10 #include "SkTableMaskFilter.h"
11 #include "SkReadBuffer.h" 11 #include "SkReadBuffer.h"
12 #include "SkWriteBuffer.h" 12 #include "SkWriteBuffer.h"
13 #include "SkString.h" 13 #include "SkString.h"
14 14
15 SkTableMaskFilter::SkTableMaskFilter() { 15 SkTableMaskFilter::SkTableMaskFilter() {
16 for (int i = 0; i < 256; i++) { 16 for (int i = 0; i < 256; i++) {
17 fTable[i] = i; 17 fTable[i] = i;
18 } 18 }
19 } 19 }
20 20
21 SkTableMaskFilter::SkTableMaskFilter(const uint8_t table[256]) { 21 SkTableMaskFilter::SkTableMaskFilter(const uint8_t table[256]) {
22 memcpy(fTable, table, sizeof(fTable)); 22 memcpy(fTable, table, sizeof(fTable));
23 } 23 }
24 24
25 SkTableMaskFilter::~SkTableMaskFilter() {} 25 SkTableMaskFilter::~SkTableMaskFilter() {}
26 26
27 bool SkTableMaskFilter::filterMask(SkMask* dst, const SkMask& src, 27 bool SkTableMaskFilter::filterMask(SkMask* dst, const SkMask& src,
28 const SkMatrix&, SkIPoint* margin) const { 28 const SkMatrix&, SkIPoint* margin, SkCachedData ** data) const {
29 if (src.fFormat != SkMask::kA8_Format) { 29 if (src.fFormat != SkMask::kA8_Format) {
30 return false; 30 return false;
31 } 31 }
32 32
33 dst->fBounds = src.fBounds; 33 dst->fBounds = src.fBounds;
34 dst->fRowBytes = SkAlign4(dst->fBounds.width()); 34 dst->fRowBytes = SkAlign4(dst->fBounds.width());
35 dst->fFormat = SkMask::kA8_Format; 35 dst->fFormat = SkMask::kA8_Format;
36 dst->fImage = NULL; 36 dst->fImage = NULL;
37 37
38 if (src.fImage) { 38 if (src.fImage) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 str->append("table: "); 144 str->append("table: ");
145 for (int i = 0; i < 255; ++i) { 145 for (int i = 0; i < 255; ++i) {
146 str->appendf("%d, ", fTable[i]); 146 str->appendf("%d, ", fTable[i]);
147 } 147 }
148 str->appendf("%d", fTable[255]); 148 str->appendf("%d", fTable[255]);
149 149
150 str->append(")"); 150 str->append(")");
151 } 151 }
152 #endif 152 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698