Numworks Epsilon
1.4.1
Graphing Calculator Operating System
tiled_view.cpp
Go to the documentation of this file.
1
#include <
escher/tiled_view.h
>
2
#include <
assert.h
>
3
4
void
TiledView::drawRect
(
KDContext
* ctx,
KDRect
rect)
const
{
5
KDColor
* pixels =
tile
();
6
KDSize
size =
tileSize
();
7
KDFrameBuffer
tileBuffer(pixels, size);
8
KDFrameBufferContext
tileContext =
KDFrameBufferContext
(&tileBuffer);
9
10
for
(
int
i=0; i<(rect.
width
()/size.
width
()+1); i++) {
11
for
(
int
j=0; j<(rect.
height
()/size.
height
()+1); j++) {
12
KDRect
tileRect(
13
rect.
x
() + i*size.
width
(),
14
rect.
y
() + j*size.
height
(),
15
size.
width
(), size.
height
()
16
);
17
//tileRect = KDRectIntersection(tileRect, rect); // Optional
18
KDPoint
origin = tileRect.origin().
opposite
();
19
tileContext.
setOrigin
(origin);
20
21
drawTile
(&tileContext, tileRect);
22
23
ctx->
fillRectWithPixels
(tileRect, pixels, pixels);
24
}
25
}
26
}
KDRect::x
KDCoordinate x() const
Definition:
rect.h:36
KDSize::width
constexpr KDCoordinate width() const
Definition:
size.h:10
tiled_view.h
TiledView::drawTile
virtual void drawTile(KDContext *ctx, KDRect rect) const =0
KDContext::setOrigin
void setOrigin(KDPoint origin)
Definition:
context.cpp:10
KDFrameBufferContext
Definition:
framebuffer_context.h:7
KDPoint
Definition:
point.h:6
KDSize
Definition:
size.h:6
assert.h
KDContext
Definition:
context.h:8
TiledView::drawRect
void drawRect(KDContext *ctx, KDRect rect) const override
Definition:
tiled_view.cpp:4
TiledView::tileSize
virtual KDSize tileSize() const =0
TiledView::tile
virtual KDColor * tile() const =0
KDContext::fillRectWithPixels
void fillRectWithPixels(KDRect rect, const KDColor *pixels, KDColor *workingBuffer)
Definition:
context_rect.cpp:17
KDRect::y
KDCoordinate y() const
Definition:
rect.h:37
KDRect
Definition:
rect.h:26
KDFrameBuffer
Definition:
framebuffer.h:7
KDColor
Definition:
color.h:6
KDPoint::opposite
KDPoint opposite() const
Definition:
point.cpp:7
KDRect::width
KDCoordinate width() const
Definition:
rect.h:39
KDRect::height
KDCoordinate height() const
Definition:
rect.h:40
KDSize::height
constexpr KDCoordinate height() const
Definition:
size.h:11
epsilon
escher
src
tiled_view.cpp
Generated by
1.8.14