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

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

Issue 1143173011: use pixmaps for dst in sprites -- NO BITMAPS (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add dox Created 5 years, 6 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/SkBlitter_Sprite.cpp ('k') | src/core/SkSpriteBlitter.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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 #define __STDC_LIMIT_MACROS 7 #define __STDC_LIMIT_MACROS
8 8
9 #include "SkDraw.h" 9 #include "SkDraw.h"
10 #include "SkBlitter.h" 10 #include "SkBlitter.h"
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 // (more or less) identity. 1273 // (more or less) identity.
1274 // 1274 //
1275 SkAutoPixmapUnlock unlocker; 1275 SkAutoPixmapUnlock unlocker;
1276 if (!bitmap.requestLock(&unlocker)) { 1276 if (!bitmap.requestLock(&unlocker)) {
1277 return; 1277 return;
1278 } 1278 }
1279 const SkPixmap& pmap = unlocker.pixmap(); 1279 const SkPixmap& pmap = unlocker.pixmap();
1280 int ix = SkScalarRoundToInt(matrix.getTranslateX()); 1280 int ix = SkScalarRoundToInt(matrix.getTranslateX());
1281 int iy = SkScalarRoundToInt(matrix.getTranslateY()); 1281 int iy = SkScalarRoundToInt(matrix.getTranslateY());
1282 if (clipHandlesSprite(*fRC, ix, iy, pmap)) { 1282 if (clipHandlesSprite(*fRC, ix, iy, pmap)) {
1283 SkPixmap dstPM;
1284 if (!fBitmap->peekPixels(&dstPM)) {
1285 return;
1286 }
1283 SkTBlitterAllocator allocator; 1287 SkTBlitterAllocator allocator;
1284 // blitter will be owned by the allocator. 1288 // blitter will be owned by the allocator.
1285 SkBlitter* blitter = SkBlitter::ChooseSprite(*fBitmap, paint, pmap, ix, iy, &allocator); 1289 SkBlitter* blitter = SkBlitter::ChooseSprite(dstPM, paint, pmap, ix, iy, &allocator);
1286 if (blitter) { 1290 if (blitter) {
1287 SkScan::FillIRect(SkIRect::MakeXYWH(ix, iy, pmap.width(), pmap.h eight()), 1291 SkScan::FillIRect(SkIRect::MakeXYWH(ix, iy, pmap.width(), pmap.h eight()),
1288 *fRC, blitter); 1292 *fRC, blitter);
1289 return; 1293 return;
1290 } 1294 }
1291 // if !blitter, then we fall-through to the slower case 1295 // if !blitter, then we fall-through to the slower case
1292 } 1296 }
1293 } 1297 }
1294 1298
1295 // now make a temp draw on the stack, and use it 1299 // now make a temp draw on the stack, and use it
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 SkPaint paint(origPaint); 1334 SkPaint paint(origPaint);
1331 paint.setStyle(SkPaint::kFill_Style); 1335 paint.setStyle(SkPaint::kFill_Style);
1332 1336
1333 SkAutoPixmapUnlock unlocker; 1337 SkAutoPixmapUnlock unlocker;
1334 if (!bitmap.requestLock(&unlocker)) { 1338 if (!bitmap.requestLock(&unlocker)) {
1335 return; 1339 return;
1336 } 1340 }
1337 const SkPixmap& pmap = unlocker.pixmap(); 1341 const SkPixmap& pmap = unlocker.pixmap();
1338 1342
1339 if (NULL == paint.getColorFilter() && clipHandlesSprite(*fRC, x, y, pmap)) { 1343 if (NULL == paint.getColorFilter() && clipHandlesSprite(*fRC, x, y, pmap)) {
1344 SkPixmap dstPM;
1345 if (!fBitmap->peekPixels(&dstPM)) {
1346 return;
1347 }
1340 SkTBlitterAllocator allocator; 1348 SkTBlitterAllocator allocator;
1341 // blitter will be owned by the allocator. 1349 // blitter will be owned by the allocator.
1342 SkBlitter* blitter = SkBlitter::ChooseSprite(*fBitmap, paint, pmap, x, y , &allocator); 1350 SkBlitter* blitter = SkBlitter::ChooseSprite(dstPM, paint, pmap, x, y, & allocator);
1343 if (blitter) { 1351 if (blitter) {
1344 SkScan::FillIRect(bounds, *fRC, blitter); 1352 SkScan::FillIRect(bounds, *fRC, blitter);
1345 return; 1353 return;
1346 } 1354 }
1347 } 1355 }
1348 1356
1349 SkMatrix matrix; 1357 SkMatrix matrix;
1350 SkRect r; 1358 SkRect r;
1351 1359
1352 // get a scalar version of our rect 1360 // get a scalar version of our rect
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
2267 mask->fImage = SkMask::AllocImage(size); 2275 mask->fImage = SkMask::AllocImage(size);
2268 memset(mask->fImage, 0, mask->computeImageSize()); 2276 memset(mask->fImage, 0, mask->computeImageSize());
2269 } 2277 }
2270 2278
2271 if (SkMask::kJustComputeBounds_CreateMode != mode) { 2279 if (SkMask::kJustComputeBounds_CreateMode != mode) {
2272 draw_into_mask(*mask, devPath, style); 2280 draw_into_mask(*mask, devPath, style);
2273 } 2281 }
2274 2282
2275 return true; 2283 return true;
2276 } 2284 }
OLDNEW
« no previous file with comments | « src/core/SkBlitter_Sprite.cpp ('k') | src/core/SkSpriteBlitter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698