openMSX
Scanline.hh
Go to the documentation of this file.
1 #ifndef SCANLINE_HH
2 #define SCANLINE_HH
3 
4 #include "PixelOperations.hh"
5 #include <cstdint>
6 
7 namespace openmsx {
8 
12 template<typename Pixel> class Multiply;
13 
14 template<> class Multiply<uint16_t>
15 {
16 public:
17  explicit Multiply(const PixelOperations<uint16_t>& pixelOps);
18  void setFactor(unsigned f);
19  inline uint16_t multiply(uint16_t p, unsigned factor) const;
20  inline uint16_t multiply(uint16_t p) const;
21  inline const uint16_t* getTable() const;
22 private:
23  const PixelOperations<uint16_t>& pixelOps;
24  unsigned factor;
25  uint16_t tab[0x10000];
26 };
27 
28 template<> class Multiply<uint32_t>
29 {
30 public:
31  explicit Multiply(const PixelOperations<uint32_t>& pixelOps);
32  void setFactor(unsigned f);
33  inline uint32_t multiply(uint32_t p, unsigned factor) const;
34  inline uint32_t multiply(uint32_t p) const;
35  const uint32_t* getTable() const;
36 private:
37  unsigned factor;
38 };
39 
43 template <class Pixel> class Scanline
44 {
45 public:
46  explicit Scanline(const PixelOperations<Pixel>& pixelOps);
47 
57  void draw(const Pixel* src1, const Pixel* src2, Pixel* dst,
58  unsigned factor, size_t width);
59 
62  Pixel darken(Pixel p, unsigned factor);
63 
66  Pixel darken(Pixel p1, Pixel p2, unsigned factor);
67 
68 private:
69  Multiply<Pixel> darkener;
70  PixelOperations<Pixel> pixelOps;
71 };
72 
73 } // namespace openmsx
74 
75 #endif
openmsx::Scanline
Helper class to draw scalines.
Definition: Scanline.hh:44
openmsx::PixelOperations< uint16_t >
openmsx::Multiply
Helper class to perform 'pixel x scalar' calculations.
Definition: Scanline.hh:12
openmsx::Scanline::darken
Pixel darken(Pixel p, unsigned factor)
Darken one pixel.
Definition: Scanline.cc:217
openmsx::Pixel
uint32_t Pixel
Definition: GLHQLiteScaler.cc:98
PixelOperations.hh
openmsx::Scanline::draw
void draw(const Pixel *src1, const Pixel *src2, Pixel *dst, unsigned factor, size_t width)
Draws a scanline.
Definition: Scanline.cc:200
openmsx::Scanline::Scanline
Scanline(const PixelOperations< Pixel > &pixelOps)
Definition: Scanline.cc:193
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5