summaryrefslogtreecommitdiffstats
path: root/o3d/core/cross/cairo/renderer_cairo.cc
diff options
context:
space:
mode:
Diffstat (limited to 'o3d/core/cross/cairo/renderer_cairo.cc')
-rw-r--r--o3d/core/cross/cairo/renderer_cairo.cc33
1 files changed, 11 insertions, 22 deletions
diff --git a/o3d/core/cross/cairo/renderer_cairo.cc b/o3d/core/cross/cairo/renderer_cairo.cc
index 018b79e2..8bd698a 100644
--- a/o3d/core/cross/cairo/renderer_cairo.cc
+++ b/o3d/core/cross/cairo/renderer_cairo.cc
@@ -73,7 +73,6 @@ void RendererCairo::Destroy() {
}
void RendererCairo::Paint() {
- DLOG(INFO) << "To paint";
cairo_t* current_drawing = cairo_create(main_surface_);
// Paint the background.
@@ -87,10 +86,9 @@ void RendererCairo::Paint() {
// Preparing and updating the Layer.
Layer* cur = *i;
- TextureCairo* cur_texture = cur->GetTexture();
-
- if (!cur_texture) {
- // Skip layers with no texture assigned.
+ Pattern* pattern = cur->pattern();
+ if (!pattern) {
+ // Skip layers with no pattern assigned.
continue;
}
@@ -99,23 +97,14 @@ void RendererCairo::Paint() {
start_mask_it++;
MaskArea(current_drawing, start_mask_it);
- // Preparing the image to render.
- cairo_surface_t* image = cur_texture->image_surface();
-
- // Scale the image.
- double width_scaling =
- (static_cast<double>(cur->GetScaleX())) / cur_texture->width();
- double height_scaling =
- (static_cast<double>(cur->GetScaleY())) / cur_texture->height();
+ cairo_translate(current_drawing, cur->x(), cur->y());
- cairo_scale(current_drawing, width_scaling, height_scaling);
+ cairo_scale(current_drawing, cur->scale_x(), cur->scale_y());
// Painting the image to the surface.
- cairo_set_source_surface(current_drawing, image,
- cur->GetTranslateX() / width_scaling,
- cur->GetTranslateY() / height_scaling);
+ cairo_set_source(current_drawing, pattern->pattern());
- cairo_paint_with_alpha(current_drawing, cur->GetAlpha());
+ cairo_paint_with_alpha(current_drawing, cur->alpha());
// Restore to the state with no mask.
cairo_restore(current_drawing);
@@ -142,10 +131,10 @@ void RendererCairo::MaskArea(cairo_t* cr, LayerRefList::iterator it) {
cairo_rectangle(cr, 0, 0, display_width(), display_height());
cairo_rectangle(cr,
- cur_mask->GetTranslateX(),
- cur_mask->GetTranslateY(),
- static_cast<double>(cur_mask->GetScaleX()),
- static_cast<double>(cur_mask->GetScaleY()));
+ cur_mask->x(),
+ cur_mask->y(),
+ cur_mask->width(),
+ cur_mask->height());
cairo_clip(cr);
}
}