~ubuntu-branches/ubuntu/vivid/gimp/vivid

« back to all changes in this revision

Viewing changes to libgimpcolor/gimpadaptivesupersample.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach
  • Date: 2012-05-08 18:50:03 UTC
  • mto: (1.1.26) (0.5.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 71.
  • Revision ID: package-import@ubuntu.com-20120508185003-tltkvbaysf8d2426
ImportĀ upstreamĀ versionĀ 2.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* LIBGIMP - The GIMP Library
2
2
 * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
3
3
 *
4
 
 * This library is free software; you can redistribute it and/or
 
4
 * This library is free software: you can redistribute it and/or
5
5
 * modify it under the terms of the GNU Lesser General Public
6
6
 * License as published by the Free Software Foundation; either
7
 
 * version 2 of the License, or (at your option) any later version.
 
7
 * version 3 of the License, or (at your option) any later version.
8
8
 *
9
9
 * This library is distributed in the hope that it will be useful,
10
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
12
 * Library General Public License for more details.
13
13
 *
14
14
 * You should have received a copy of the GNU Lesser General Public
15
 
 * License along with this library; if not, write to the
16
 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
 
 * Boston, MA 02111-1307, USA.
 
15
 * License along with this library.  If not, see
 
16
 * <http://www.gnu.org/licenses/>.
18
17
 */
19
18
 
20
19
#include "config.h"
29
28
#include "gimprgb.h"
30
29
 
31
30
 
 
31
/**
 
32
 * SECTION: gimpadaptivesupersample
 
33
 * @title: GimpAdaptiveSupersample
 
34
 * @short_description: Functions to perform adaptive supersampling on
 
35
 *                     an area.
 
36
 *
 
37
 * Functions to perform adaptive supersampling on an area.
 
38
 **/
 
39
 
 
40
 
32
41
/*********************************************************************/
33
42
/* Sumpersampling code (Quartic)                                     */
34
43
/* This code is *largely* based on the sources for POV-Ray 3.0. I am */
71
80
  gulong   num_samples = 0;
72
81
  gint     cnt;
73
82
 
 
83
  g_return_val_if_fail (render_func != NULL, 0);
 
84
 
74
85
  /* Get offsets for corners */
75
86
 
76
87
  dx1 = (gdouble) (x1 - sub_pixel_size / 2) / sub_pixel_size;
85
96
    {
86
97
      num_samples++;
87
98
 
88
 
      if (render_func)
89
 
        (* render_func) (x + dx1, y + dy1, &c[0], render_data);
 
99
      render_func (x + dx1, y + dy1, &c[0], render_data);
90
100
 
91
101
      block[y1][x1].ready = TRUE;
92
102
      block[y1][x1].color = c[0];
102
112
    {
103
113
      num_samples++;
104
114
 
105
 
      if (render_func)
106
 
        (* render_func) (x + dx3, y + dy1, &c[1], render_data);
 
115
      render_func (x + dx3, y + dy1, &c[1], render_data);
107
116
 
108
117
      block[y1][x3].ready = TRUE;
109
118
      block[y1][x3].color = c[1];
119
128
    {
120
129
      num_samples++;
121
130
 
122
 
      if (render_func)
123
 
        (* render_func) (x + dx1, y + dy3, &c[2], render_data);
 
131
      render_func (x + dx1, y + dy3, &c[2], render_data);
124
132
 
125
133
      block[y3][x1].ready = TRUE;
126
134
      block[y3][x1].color = c[2];
136
144
    {
137
145
      num_samples++;
138
146
 
139
 
      if (render_func)
140
 
        (* render_func) (x + dx3, y + dy3, &c[3], render_data);
 
147
      render_func (x + dx3, y + dy3, &c[3], render_data);
141
148
 
142
149
      block[y3][x3].ready = TRUE;
143
150
      block[y3][x3].color = c[3];