Numworks Epsilon  1.4.1
Graphing Calculator Operating System
image_view.cpp
Go to the documentation of this file.
1 #include <escher/image_view.h>
2 extern "C" {
3 #include <assert.h>
4 }
5 
7  View(),
8  m_image(nullptr)
9 {
10 }
11 
12 void ImageView::drawRect(KDContext * ctx, KDRect rect) const {
13  if (m_image == nullptr) {
14  return;
15  }
16  assert(bounds().width() == m_image->width());
17  assert(bounds().height() == m_image->height());
18  ctx->fillRectWithPixels(bounds(), m_image->pixels(), nullptr);
19 }
20 
21 void ImageView::setImage(const Image * image) {
22  if (image != m_image) {
23  m_image = image;
25  }
26 }
#define assert(e)
Definition: assert.h:9
void markRectAsDirty(KDRect rect)
Definition: view.cpp:39
Definition: image.h:6
void fillRectWithPixels(KDRect rect, const KDColor *pixels, KDColor *workingBuffer)
void setImage(const Image *image)
Definition: image_view.cpp:21
KDCoordinate width() const
Definition: image.h:10
Definition: rect.h:26
Definition: view.h:23
const KDColor * pixels() const
Definition: image.h:12
KDCoordinate height() const
Definition: image.h:11
KDRect bounds() const
Definition: view.cpp:157
void drawRect(KDContext *ctx, KDRect rect) const override
Definition: image_view.cpp:12