comparison Framework/Scene2D/Internals/CairoColorTextureRenderer.cpp @ 768:55411e7da2f7

LookupTableTextureSceneLayer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 23 May 2019 20:04:33 +0200
parents 9e51fb773bbd
children 2d8ab34c8c91
comparison
equal deleted inserted replaced
767:dce5b067d040 768:55411e7da2f7
42 texture_.Copy(l.GetTexture(), true); 42 texture_.Copy(l.GetTexture(), true);
43 textureTransform_ = l.GetTransform(); 43 textureTransform_ = l.GetTransform();
44 isLinearInterpolation_ = l.IsLinearInterpolation(); 44 isLinearInterpolation_ = l.IsLinearInterpolation();
45 } 45 }
46 46
47 47
48 void CairoColorTextureRenderer::Render(const AffineTransform2D& transform) 48 void CairoColorTextureRenderer::RenderColorTexture(ICairoContextProvider& target,
49 const AffineTransform2D& transform,
50 CairoSurface& texture,
51 const AffineTransform2D& textureTransform,
52 bool isLinearInterpolation)
49 { 53 {
50 cairo_t* cr = target_.GetCairoContext(); 54 cairo_t* cr = target.GetCairoContext();
51 55
52 AffineTransform2D t = 56 AffineTransform2D t =
53 AffineTransform2D::Combine(transform, textureTransform_); 57 AffineTransform2D::Combine(transform, textureTransform);
54 Matrix h = t.GetHomogeneousMatrix(); 58 Matrix h = t.GetHomogeneousMatrix();
55 59
56 cairo_save(cr); 60 cairo_save(cr);
57 61
58 cairo_matrix_t m; 62 cairo_matrix_t m;
59 cairo_matrix_init(&m, h(0, 0), h(1, 0), h(0, 1), h(1, 1), h(0, 2), h(1, 2)); 63 cairo_matrix_init(&m, h(0, 0), h(1, 0), h(0, 1), h(1, 1), h(0, 2), h(1, 2));
60 cairo_transform(cr, &m); 64 cairo_transform(cr, &m);
61 65
62 cairo_set_operator(cr, CAIRO_OPERATOR_OVER); 66 cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
63 cairo_set_source_surface(cr, texture_.GetObject(), 0, 0); 67 cairo_set_source_surface(cr, texture.GetObject(), 0, 0);
64 68
65 if (isLinearInterpolation_) 69 if (isLinearInterpolation)
66 { 70 {
67 cairo_pattern_set_filter(cairo_get_source(cr), CAIRO_FILTER_BILINEAR); 71 cairo_pattern_set_filter(cairo_get_source(cr), CAIRO_FILTER_BILINEAR);
68 } 72 }
69 else 73 else
70 { 74 {