OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010, Google Inc. | 2 * Copyright 2010, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 double blue, | 66 double blue, |
67 double alpha) { | 67 double alpha) { |
68 return WrapCairoPattern(pack, | 68 return WrapCairoPattern(pack, |
69 cairo_pattern_create_rgba(red, green, blue, alpha)); | 69 cairo_pattern_create_rgba(red, green, blue, alpha)); |
70 } | 70 } |
71 | 71 |
72 Pattern::~Pattern() { | 72 Pattern::~Pattern() { |
73 cairo_pattern_destroy(pattern_); | 73 cairo_pattern_destroy(pattern_); |
74 } | 74 } |
75 | 75 |
| 76 void Pattern::SetAffineTransform(double xx, |
| 77 double yx, |
| 78 double xy, |
| 79 double yy, |
| 80 double x0, |
| 81 double y0) { |
| 82 cairo_matrix_t matrix; |
| 83 cairo_matrix_init(&matrix, xx, yx, xy, yy, x0, y0); |
| 84 cairo_pattern_set_matrix(pattern_, &matrix); |
| 85 } |
| 86 |
76 Pattern::Pattern(ServiceLocator* service_locator, cairo_pattern_t* pattern) | 87 Pattern::Pattern(ServiceLocator* service_locator, cairo_pattern_t* pattern) |
77 : ObjectBase(service_locator), | 88 : ObjectBase(service_locator), |
78 pattern_(pattern) { | 89 pattern_(pattern) { |
79 } | 90 } |
80 | 91 |
81 Pattern* Pattern::WrapCairoPattern(Pack* pack, cairo_pattern_t* pattern) { | 92 Pattern* Pattern::WrapCairoPattern(Pack* pack, cairo_pattern_t* pattern) { |
82 cairo_status_t status = cairo_pattern_status(pattern); | 93 cairo_status_t status = cairo_pattern_status(pattern); |
83 if (CAIRO_STATUS_SUCCESS != status) { | 94 if (CAIRO_STATUS_SUCCESS != status) { |
84 DLOG(ERROR) << "Error creating Cairo pattern: " << status; | 95 DLOG(ERROR) << "Error creating Cairo pattern: " << status; |
85 cairo_pattern_destroy(pattern); | 96 cairo_pattern_destroy(pattern); |
86 return NULL; | 97 return NULL; |
87 } | 98 } |
88 Pattern* p = new Pattern(pack->service_locator(), pattern); | 99 Pattern* p = new Pattern(pack->service_locator(), pattern); |
89 pack->RegisterObject(p); | 100 pack->RegisterObject(p); |
90 return p; | 101 return p; |
91 } | 102 } |
92 | 103 |
93 } // namespace o2d | 104 } // namespace o2d |
94 | 105 |
95 } // namespace o3d | 106 } // namespace o3d |
OLD | NEW |