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

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

Issue 521433002: harden requirements on SkBitmapCache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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/SkBitmapCache.cpp ('k') | src/lazy/SkCachingPixelRef.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 2011 Google Inc. 2 * Copyright 2011 Google Inc.
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 "SkBitmapCache.h" 8 #include "SkBitmapCache.h"
9 #include "SkBitmapProcState.h" 9 #include "SkBitmapProcState.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 roundedDestWidth, 182 roundedDestWidth,
183 roundedDestHeight, 183 roundedDestHeight,
184 SkResourceCache::GetAllocator())) { 184 SkResourceCache::GetAllocator())) {
185 // we failed to create fScaledBitmap, so just return and let 185 // we failed to create fScaledBitmap, so just return and let
186 // the scanline proc handle it. 186 // the scanline proc handle it.
187 return false; 187 return false;
188 188
189 } 189 }
190 190
191 SkASSERT(NULL != fScaledBitmap.getPixels()); 191 SkASSERT(NULL != fScaledBitmap.getPixels());
192 fScaledBitmap.setImmutable();
192 SkBitmapCache::Add(fOrigBitmap, roundedDestWidth, roundedDestHeight, fScaledBitmap); 193 SkBitmapCache::Add(fOrigBitmap, roundedDestWidth, roundedDestHeight, fScaledBitmap);
193 } 194 }
194 195
195 SkASSERT(NULL != fScaledBitmap.getPixels()); 196 SkASSERT(NULL != fScaledBitmap.getPixels());
196 fBitmap = &fScaledBitmap; 197 fBitmap = &fScaledBitmap;
197 198
198 // set the inv matrix type to translate-only; 199 // set the inv matrix type to translate-only;
199 fInvMatrix.setTranslate(fInvMatrix.getTranslateX() / fInvMatrix.getScale X(), 200 fInvMatrix.setTranslate(fInvMatrix.getTranslateX() / fInvMatrix.getScale X(),
200 fInvMatrix.getTranslateY() / fInvMatrix.getScale Y()); 201 fInvMatrix.getTranslateY() / fInvMatrix.getScale Y());
201 202
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 } else { 1008 } else {
1008 size >>= 2; 1009 size >>= 2;
1009 } 1010 }
1010 1011
1011 if (fFilterLevel != SkPaint::kNone_FilterLevel) { 1012 if (fFilterLevel != SkPaint::kNone_FilterLevel) {
1012 size >>= 1; 1013 size >>= 1;
1013 } 1014 }
1014 1015
1015 return size; 1016 return size;
1016 } 1017 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapCache.cpp ('k') | src/lazy/SkCachingPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698