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

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

Issue 354193002: Refactor bitmap scaler to make it easier to migrate rest of chrome to use it (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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/SkBitmapProcState.h ('k') | src/core/SkBitmapScaler.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 #include "SkBitmapProcState.h" 8 #include "SkBitmapProcState.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkFilterProc.h" 10 #include "SkFilterProc.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // fall through to rebuild 165 // fall through to rebuild
166 } 166 }
167 } 167 }
168 168
169 if (NULL == fScaledCacheID) { 169 if (NULL == fScaledCacheID) {
170 float dest_width = fOrigBitmap.width() / invScaleX; 170 float dest_width = fOrigBitmap.width() / invScaleX;
171 float dest_height = fOrigBitmap.height() / invScaleY; 171 float dest_height = fOrigBitmap.height() / invScaleY;
172 172
173 // All the criteria are met; let's make a new bitmap. 173 // All the criteria are met; let's make a new bitmap.
174 174
175 SkConvolutionProcs simd;
176 sk_bzero(&simd, sizeof(simd));
177 this->platformConvolutionProcs(&simd);
178
179 if (!SkBitmapScaler::Resize(&fScaledBitmap, 175 if (!SkBitmapScaler::Resize(&fScaledBitmap,
180 fOrigBitmap, 176 fOrigBitmap,
181 SkBitmapScaler::RESIZE_BEST, 177 SkBitmapScaler::RESIZE_BEST,
182 dest_width, 178 dest_width,
183 dest_height, 179 dest_height,
184 simd,
185 SkScaledImageCache::GetAllocator())) { 180 SkScaledImageCache::GetAllocator())) {
186 // we failed to create fScaledBitmap, so just return and let 181 // we failed to create fScaledBitmap, so just return and let
187 // the scanline proc handle it. 182 // the scanline proc handle it.
188 return false; 183 return false;
189 184
190 } 185 }
191 186
192 SkASSERT(NULL != fScaledBitmap.getPixels()); 187 SkASSERT(NULL != fScaledBitmap.getPixels());
193 fScaledCacheID = SkScaledImageCache::AddAndLock(fOrigBitmap, 188 fScaledCacheID = SkScaledImageCache::AddAndLock(fOrigBitmap,
194 invScaleX, 189 invScaleX,
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 } else { 1029 } else {
1035 size >>= 2; 1030 size >>= 2;
1036 } 1031 }
1037 1032
1038 if (fFilterLevel != SkPaint::kNone_FilterLevel) { 1033 if (fFilterLevel != SkPaint::kNone_FilterLevel) {
1039 size >>= 1; 1034 size >>= 1;
1040 } 1035 }
1041 1036
1042 return size; 1037 return size;
1043 } 1038 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcState.h ('k') | src/core/SkBitmapScaler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698