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

Side by Side Diff: src/codec/SkSwizzler.cpp

Issue 1395183003: Add scaled subset API to SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@split0
Patch Set: Created 5 years, 2 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
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 "SkCodecPriv.h" 8 #include "SkCodecPriv.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkScaledCodec.h" 10 #include "SkScaledCodec.h"
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 , fBPP(bpp) 703 , fBPP(bpp)
704 , fSampleX(1) 704 , fSampleX(1)
705 {} 705 {}
706 706
707 int SkSwizzler::onSetSampleX(int sampleX) { 707 int SkSwizzler::onSetSampleX(int sampleX) {
708 SkASSERT(sampleX > 0); // Surely there is an upper limit? Should there be 708 SkASSERT(sampleX > 0); // Surely there is an upper limit? Should there be
709 // way to report failure? 709 // way to report failure?
710 fSampleX = sampleX; 710 fSampleX = sampleX;
711 fX0 = get_start_coord(sampleX) + fSrcOffset; 711 fX0 = get_start_coord(sampleX) + fSrcOffset;
712 fDstWidth = get_scaled_dimension(fSrcWidth, sampleX); 712 fDstWidth = get_scaled_dimension(fSrcWidth, sampleX);
713
msarett 2015/10/12 18:33:29 I missed this in an earlier CL, but this check is
scroggo 2015/10/12 20:47:07 Wait, does this belong in crrev.com/1390213002? I
714 // check that fX0 is less than original width
715 SkASSERT(fX0 >= 0 && fX0 < fSrcWidth);
716 return fDstWidth; 713 return fDstWidth;
717 } 714 }
718 715
719 SkSwizzler::ResultAlpha SkSwizzler::swizzle(void* dst, const uint8_t* SK_RESTRIC T src) { 716 SkSwizzler::ResultAlpha SkSwizzler::swizzle(void* dst, const uint8_t* SK_RESTRIC T src) {
720 SkASSERT(nullptr != dst && nullptr != src); 717 SkASSERT(nullptr != dst && nullptr != src);
721 return fRowProc(dst, src, fDstWidth, fBPP, fSampleX * fBPP, fX0 * fBPP, fCol orTable); 718 return fRowProc(dst, src, fDstWidth, fBPP, fSampleX * fBPP, fX0 * fBPP, fCol orTable);
722 } 719 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698