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

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

Issue 1655823002: Fix S32_D32_constX_shaderproc assert (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 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 "SkBitmapController.h" 9 #include "SkBitmapController.h"
10 #include "SkBitmapProcState.h" 10 #include "SkBitmapProcState.h"
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 485
486 mproc(s, xy, 1, x, y); 486 mproc(s, xy, 1, x, y);
487 487
488 iY0 = xy[0] >> 18; 488 iY0 = xy[0] >> 18;
489 iY1 = xy[0] & 0x3FFF; 489 iY1 = xy[0] & 0x3FFF;
490 iSubY = (xy[0] >> 14) & 0xF; 490 iSubY = (xy[0] >> 14) & 0xF;
491 } else { 491 } else {
492 int yTemp; 492 int yTemp;
493 493
494 if (s.fInvType > SkMatrix::kTranslate_Mask) { 494 if (s.fInvType > SkMatrix::kTranslate_Mask) {
495 // TODO(fmalita): looks like another SkBitmapProcStateAutoMapper cus tomer
495 SkPoint pt; 496 SkPoint pt;
496 s.fInvProc(s.fInvMatrix, 497 s.fInvProc(s.fInvMatrix,
497 SkIntToScalar(x) + SK_ScalarHalf, 498 SkIntToScalar(x) + SK_ScalarHalf,
498 SkIntToScalar(y) + SK_ScalarHalf, 499 SkIntToScalar(y) + SK_ScalarHalf,
499 &pt); 500 &pt);
500 // When the matrix has a scale component the setup code in 501 // When the matrix has a scale component the setup code in
501 // chooseProcs multiples the inverse matrix by the inverse of the 502 // chooseProcs multiples the inverse matrix by the inverse of the
502 // bitmap's width and height. Since this method is going to do 503 // bitmap's width and height. Since this method is going to do
503 // its own tiling and sampling we need to undo that here. 504 // its own tiling and sampling we need to undo that here.
504 if (SkShader::kClamp_TileMode != s.fTileModeX || 505 if (SkShader::kClamp_TileMode != s.fTileModeX ||
(...skipping 13 matching lines...) Expand all
518 break; 519 break;
519 case SkShader::kRepeat_TileMode: 520 case SkShader::kRepeat_TileMode:
520 iY0 = sk_int_mod(yTemp, stopY); 521 iY0 = sk_int_mod(yTemp, stopY);
521 break; 522 break;
522 case SkShader::kMirror_TileMode: 523 case SkShader::kMirror_TileMode:
523 default: 524 default:
524 iY0 = sk_int_mirror(yTemp, stopY); 525 iY0 = sk_int_mirror(yTemp, stopY);
525 break; 526 break;
526 } 527 }
527 528
528 // http://code.google.com/p/skia/issues/detail?id=4874 529 #ifdef SK_DEBUG
529 #ifdef DISABLED_SK_DEBUG
530 { 530 {
531 SkPoint pt; 531 int iY2;
532 s.fInvProc(s.fInvMatrix, 532 if (s.fInvType > SkMatrix::kTranslate_Mask) {
533 SkIntToScalar(x) + SK_ScalarHalf, 533 SkPoint pt;
534 SkIntToScalar(y) + SK_ScalarHalf, 534 s.fInvProc(s.fInvMatrix,
535 &pt); 535 SkIntToScalar(x) + SK_ScalarHalf,
536 if (s.fInvType > SkMatrix::kTranslate_Mask && 536 SkIntToScalar(y) + SK_ScalarHalf,
537 (SkShader::kClamp_TileMode != s.fTileModeX || 537 &pt);
538 SkShader::kClamp_TileMode != s.fTileModeY)) { 538 if (SkShader::kClamp_TileMode != s.fTileModeX ||
539 pt.fY *= s.fPixmap.height(); 539 SkShader::kClamp_TileMode != s.fTileModeY) {
540 pt.fY *= s.fPixmap.height();
541 }
542 iY2 = SkScalarFloorToInt(pt.fY);
543 } else {
544 const SkBitmapProcStateAutoMapper mapper(s, x, y);
545 iY2 = SkFractionalIntToInt(mapper.y());
540 } 546 }
541 int iY2;
542 547
543 switch (s.fTileModeY) { 548 switch (s.fTileModeY) {
544 case SkShader::kClamp_TileMode: 549 case SkShader::kClamp_TileMode:
545 iY2 = SkClampMax(SkScalarFloorToInt(pt.fY), stopY-1); 550 iY2 = SkClampMax(iY2, stopY-1);
546 break; 551 break;
547 case SkShader::kRepeat_TileMode: 552 case SkShader::kRepeat_TileMode:
548 iY2 = sk_int_mod(SkScalarFloorToInt(pt.fY), stopY); 553 iY2 = sk_int_mod(iY2, stopY);
549 break; 554 break;
550 case SkShader::kMirror_TileMode: 555 case SkShader::kMirror_TileMode:
551 default: 556 default:
552 iY2 = sk_int_mirror(SkScalarFloorToInt(pt.fY), stopY); 557 iY2 = sk_int_mirror(iY2, stopY);
553 break; 558 break;
554 } 559 }
555 560
556 SkASSERT(iY0 == iY2); 561 SkASSERT(iY0 == iY2);
557 } 562 }
558 #endif 563 #endif
559 } 564 }
560 565
561 const SkPMColor* row0 = s.fPixmap.addr32(0, iY0); 566 const SkPMColor* row0 = s.fPixmap.addr32(0, iY0);
562 SkPMColor color; 567 SkPMColor color;
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 fx += dx; 832 fx += dx;
828 } 833 }
829 } else { 834 } else {
830 for (int i = 0; i < count; ++i) { 835 for (int i = 0; i < count; ++i) {
831 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)]; 836 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)];
832 fx += dx; 837 fx += dx;
833 } 838 }
834 } 839 }
835 } 840 }
836 841
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