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

Side by Side Diff: include/codec/SkCodec.h

Issue 1489163002: Add currScanline() getter to SkCodec API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Change comments in SkCodec.h 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 | « no previous file | src/codec/SkCodec_libgif.cpp » ('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 #ifndef SkCodec_DEFINED 8 #ifndef SkCodec_DEFINED
9 #define SkCodec_DEFINED 9 #define SkCodec_DEFINED
10 10
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 * decoder. 390 * decoder.
391 * 391 *
392 * This will equal fCurrScanline, except in the case of strangely 392 * This will equal fCurrScanline, except in the case of strangely
393 * encoded image types (bottom-up bmps, interlaced gifs). 393 * encoded image types (bottom-up bmps, interlaced gifs).
394 * 394 *
395 * Results are undefined when not in scanline decoding mode. 395 * Results are undefined when not in scanline decoding mode.
396 */ 396 */
397 int nextScanline() const { return this->outputScanline(fCurrScanline); } 397 int nextScanline() const { return this->outputScanline(fCurrScanline); }
398 398
399 /** 399 /**
400 * Returns the output y-coordinate of the row that corresponds to an input 400 * Returns the output y-coordinate of the row that corresponds to an input
401 * y-coordinate. The input y-coordinate represents where the scanline 401 * y-coordinate. The input y-coordinate represents where the scanline
402 * is located in the encoded data. 402 * is located in the encoded data.
403 * 403 *
404 * This will equal inputScanline, except in the case of strangely 404 * This will equal inputScanline, except in the case of strangely
405 * encoded image types (bottom-up bmps, interlaced gifs). 405 * encoded image types (bottom-up bmps, interlaced gifs).
406 */ 406 */
407 int outputScanline(int inputScanline) const; 407 int outputScanline(int inputScanline) const;
408 408
409 protected: 409 protected:
410 SkCodec(const SkImageInfo&, SkStream*); 410 SkCodec(const SkImageInfo&, SkStream*);
411 411
412 virtual SkISize onGetScaledDimensions(float /* desiredScale */) const { 412 virtual SkISize onGetScaledDimensions(float /* desiredScale */) const {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 /** 504 /**
505 * The remaining functions revolve around decoding scanlines. 505 * The remaining functions revolve around decoding scanlines.
506 */ 506 */
507 507
508 /** 508 /**
509 * Most images types will be kTopDown and will not need to override this fu nction. 509 * Most images types will be kTopDown and will not need to override this fu nction.
510 */ 510 */
511 virtual SkScanlineOrder onGetScanlineOrder() const { return kTopDown_SkScanl ineOrder; } 511 virtual SkScanlineOrder onGetScanlineOrder() const { return kTopDown_SkScanl ineOrder; }
512 512
513 /** 513 /**
514 * Update the next scanline. Used by interlaced png. 514 * Update the current scanline. Used by interlaced png.
515 */ 515 */
516 void updateNextScanline(int newY) { fCurrScanline = newY; } 516 void updateCurrScanline(int newY) { fCurrScanline = newY; }
517 517
518 const SkImageInfo& dstInfo() const { return fDstInfo; } 518 const SkImageInfo& dstInfo() const { return fDstInfo; }
519 519
520 const SkCodec::Options& options() const { return fOptions; } 520 const SkCodec::Options& options() const { return fOptions; }
521 521
522 /**
523 * Returns the number of scanlines that have been decoded so far.
524 * This is unaffected by the SkScanlineOrder.
525 *
526 * Returns -1 if we have not started a scanline decode.
527 */
528 int currScanline() const { return fCurrScanline; }
529
522 virtual int onOutputScanline(int inputScanline) const; 530 virtual int onOutputScanline(int inputScanline) const;
523 531
524 private: 532 private:
525 const SkImageInfo fSrcInfo; 533 const SkImageInfo fSrcInfo;
526 SkAutoTDelete<SkStream> fStream; 534 SkAutoTDelete<SkStream> fStream;
527 bool fNeedsRewind; 535 bool fNeedsRewind;
528 // These fields are only meaningful during scanline decodes. 536 // These fields are only meaningful during scanline decodes.
529 SkImageInfo fDstInfo; 537 SkImageInfo fDstInfo;
530 SkCodec::Options fOptions; 538 SkCodec::Options fOptions;
531 int fCurrScanline; 539 int fCurrScanline;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 * May create a sampler, if one is not currently being used. Otherwise, doe s 595 * May create a sampler, if one is not currently being used. Otherwise, doe s
588 * not affect ownership. 596 * not affect ownership.
589 * 597 *
590 * Only valid during scanline decoding. 598 * Only valid during scanline decoding.
591 */ 599 */
592 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr; } 600 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr; }
593 601
594 friend class SkSampledCodec; 602 friend class SkSampledCodec;
595 }; 603 };
596 #endif // SkCodec_DEFINED 604 #endif // SkCodec_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/codec/SkCodec_libgif.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698