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

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

Issue 2089583002: fix size check for drawBitmap fast-path in SkBitmapDevice::drawBitmapRect (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: make !SK_DRAWBITMAPRECT_FAST_OFFSET case use original code Created 3 years, 8 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 | « no previous file | no next file » | 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 2013 Google Inc. 2 * Copyright 2013 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 "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkConfig8888.h" 9 #include "SkConfig8888.h"
10 #include "SkDraw.h" 10 #include "SkDraw.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 if (srcIR.fLeft > 0) { 295 if (srcIR.fLeft > 0) {
296 dx = SkIntToScalar(srcIR.fLeft); 296 dx = SkIntToScalar(srcIR.fLeft);
297 } 297 }
298 if (srcIR.fTop > 0) { 298 if (srcIR.fTop > 0) {
299 dy = SkIntToScalar(srcIR.fTop); 299 dy = SkIntToScalar(srcIR.fTop);
300 } 300 }
301 if (dx || dy) { 301 if (dx || dy) {
302 matrix.preTranslate(dx, dy); 302 matrix.preTranslate(dx, dy);
303 } 303 }
304 304
305 #ifdef SK_DRAWBITMAPRECT_FAST_OFFSET
306 SkRect extractedBitmapBounds = SkRect::MakeXYWH(dx, dy,
307 SkIntToScalar(bitmapPtr- >width()),
308 SkIntToScalar(bitmapPtr- >height()));
309 #else
305 SkRect extractedBitmapBounds; 310 SkRect extractedBitmapBounds;
306 extractedBitmapBounds.isetWH(bitmapPtr->width(), bitmapPtr->height()); 311 extractedBitmapBounds.isetWH(bitmapPtr->width(), bitmapPtr->height());
312 #endif
307 if (extractedBitmapBounds == tmpSrc) { 313 if (extractedBitmapBounds == tmpSrc) {
308 // no fractional part in src, we can just call drawBitmap 314 // no fractional part in src, we can just call drawBitmap
309 goto USE_DRAWBITMAP; 315 goto USE_DRAWBITMAP;
310 } 316 }
311 } else { 317 } else {
312 USE_DRAWBITMAP: 318 USE_DRAWBITMAP:
313 // We can go faster by just calling drawBitmap, which will concat the 319 // We can go faster by just calling drawBitmap, which will concat the
314 // matrix with the CTM, and try to call drawSprite if it can. If not, 320 // matrix with the CTM, and try to call drawSprite if it can. If not,
315 // it will make a shader and call drawRect, as we do below. 321 // it will make a shader and call drawRect, as we do below.
316 draw.drawBitmap(*bitmapPtr, matrix, dstPtr, paint); 322 draw.drawBitmap(*bitmapPtr, matrix, dstPtr, paint);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 paint.getRasterizer() || 387 paint.getRasterizer() ||
382 paint.getPathEffect() || 388 paint.getPathEffect() ||
383 paint.isFakeBoldText() || 389 paint.isFakeBoldText() ||
384 paint.getStyle() != SkPaint::kFill_Style || 390 paint.getStyle() != SkPaint::kFill_Style ||
385 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) 391 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode))
386 { 392 {
387 return true; 393 return true;
388 } 394 }
389 return false; 395 return false;
390 } 396 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698