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

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

Issue 1463373002: scaling API on SkPixmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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 | « include/core/SkPixmap.h ('k') | src/core/SkBitmapProvider.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 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBitmapController.h" 9 #include "SkBitmapController.h"
10 #include "SkBitmapProvider.h" 10 #include "SkBitmapProvider.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 if (!orig.requestLock(&src)) { 114 if (!orig.requestLock(&src)) {
115 return false; 115 return false;
116 } 116 }
117 if (!SkBitmapScaler::Resize(&fResultBitmap, src.pixmap(), kHQ_RESIZE_MET HOD, 117 if (!SkBitmapScaler::Resize(&fResultBitmap, src.pixmap(), kHQ_RESIZE_MET HOD,
118 dstW, dstH, SkResourceCache::GetAllocator()) ) { 118 dstW, dstH, SkResourceCache::GetAllocator()) ) {
119 return false; // we failed to create fScaledBitmap 119 return false; // we failed to create fScaledBitmap
120 } 120 }
121 121
122 SkASSERT(fResultBitmap.getPixels()); 122 SkASSERT(fResultBitmap.getPixels());
123 fResultBitmap.setImmutable(); 123 fResultBitmap.setImmutable();
124 if (SkBitmapCache::AddWH(desc, fResultBitmap)) { 124 if (!provider.isVolatile()) {
125 provider.notifyAddedToCache(); 125 if (SkBitmapCache::AddWH(desc, fResultBitmap)) {
126 provider.notifyAddedToCache();
127 }
126 } 128 }
127 } 129 }
128 130
129 SkASSERT(fResultBitmap.getPixels()); 131 SkASSERT(fResultBitmap.getPixels());
130 132
131 fInvMatrix.postScale(SkIntToScalar(dstW) / provider.width(), 133 fInvMatrix.postScale(SkIntToScalar(dstW) / provider.width(),
132 SkIntToScalar(dstH) / provider.height()); 134 SkIntToScalar(dstH) / provider.height());
133 fQuality = kLow_SkFilterQuality; 135 fQuality = kLow_SkFilterQuality;
134 return true; 136 return true;
135 } 137 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 fResultBitmap.getColorTable()); 212 fResultBitmap.getColorTable());
211 } 213 }
212 214
213 SkBitmapController::State* SkDefaultBitmapController::onRequestBitmap(const SkBi tmapProvider& bm, 215 SkBitmapController::State* SkDefaultBitmapController::onRequestBitmap(const SkBi tmapProvider& bm,
214 const SkMa trix& inverse, 216 const SkMa trix& inverse,
215 SkFilterQu ality quality, 217 SkFilterQu ality quality,
216 void* stor age, size_t size) { 218 void* stor age, size_t size) {
217 return SkInPlaceNewCheck<SkDefaultBitmapControllerState>(storage, size, bm, inverse, quality); 219 return SkInPlaceNewCheck<SkDefaultBitmapControllerState>(storage, size, bm, inverse, quality);
218 } 220 }
219 221
OLDNEW
« no previous file with comments | « include/core/SkPixmap.h ('k') | src/core/SkBitmapProvider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698