PageRenderTime 26ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/src/core/ScanlineHelper.h

http://github.com/imageworks/OpenColorIO
C Header | 78 lines | 26 code | 19 blank | 33 comment | 0 complexity | 2e2d67b1336de3657639137138de8abf MD5 | raw file
Possible License(s): BSD-3-Clause
  1. /*
  2. Copyright (c) 2003-2010 Sony Pictures Imageworks Inc., et al.
  3. All Rights Reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are
  6. met:
  7. * Redistributions of source code must retain the above copyright
  8. notice, this list of conditions and the following disclaimer.
  9. * Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in the
  11. documentation and/or other materials provided with the distribution.
  12. * Neither the name of Sony Pictures Imageworks nor the names of its
  13. contributors may be used to endorse or promote products derived from
  14. this software without specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  16. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  17. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  18. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  19. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  20. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  21. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  22. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  23. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  25. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. #ifndef INCLUDED_OCIO_SCANLINEHELPER_H
  28. #define INCLUDED_OCIO_SCANLINEHELPER_H
  29. #include <OpenColorIO/OpenColorIO.h>
  30. #include "ImagePacking.h"
  31. OCIO_NAMESPACE_ENTER
  32. {
  33. class ScanlineHelper
  34. {
  35. public:
  36. ScanlineHelper(ImageDesc& img);
  37. ~ScanlineHelper();
  38. // Copy from the src image to our scanline, in our preferred
  39. // pixel layout. Return the number of pixels to process;
  40. void prepRGBAScanline(float** buffer, long* numPixels);
  41. // Write back the result of our work, from the scanline to our
  42. // destination image.
  43. void finishRGBAScanline();
  44. private:
  45. GenericImageDesc m_img;
  46. // Copy mode
  47. float* m_buffer;
  48. long m_imagePixelIndex;
  49. int m_numPixelsCopied;
  50. // In place mode
  51. int m_yIndex;
  52. bool m_inPlaceMode;
  53. ScanlineHelper(const ScanlineHelper &);
  54. ScanlineHelper& operator= (const ScanlineHelper &);
  55. };
  56. }
  57. OCIO_NAMESPACE_EXIT
  58. #endif