Blame view

Giac_maj/epsilon-giac/escher/src/image_view.cpp 531 Bytes
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  #include <escher/image_view.h>
  extern "C" {
  #include <assert.h>
  }
  
  ImageView::ImageView() :
    View(),
    m_image(nullptr)
  {
  }
  
  void ImageView::drawRect(KDContext * ctx, KDRect rect) const {
    if (m_image == nullptr) {
      return;
    }
    assert(bounds().width() == m_image->width());
    assert(bounds().height() == m_image->height());
    ctx->fillRectWithPixels(bounds(), m_image->pixels(), nullptr);
  }
  
  void ImageView::setImage(const Image * image) {
    if (image != m_image) {
      m_image = image;
      markRectAsDirty(bounds());
    }
  }