summaryrefslogtreecommitdiffstats
path: root/o3d/core
diff options
context:
space:
mode:
authortschmelcher@chromium.org <tschmelcher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-01 02:16:39 +0000
committertschmelcher@chromium.org <tschmelcher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-01 02:16:39 +0000
commit32decac151899504d64ae28e7d4b46fd7f6abfab (patch)
tree827f709969ca87672f51ba26a87bdef443fef982 /o3d/core
parentac52deb9b4c1644a5146aec1c71c163a9d8b6aa9 (diff)
downloadchromium_src-32decac151899504d64ae28e7d4b46fd7f6abfab.zip
chromium_src-32decac151899504d64ae28e7d4b46fd7f6abfab.tar.gz
chromium_src-32decac151899504d64ae28e7d4b46fd7f6abfab.tar.bz2
O2D: Add an API to set the pattern extension method.
TEST=pending: loaded O2D and verified the API functions BUG=none Review URL: http://codereview.chromium.org/6409019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73243 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/core')
-rw-r--r--o3d/core/cross/cairo/pattern.cc24
-rw-r--r--o3d/core/cross/cairo/pattern.h13
2 files changed, 34 insertions, 3 deletions
diff --git a/o3d/core/cross/cairo/pattern.cc b/o3d/core/cross/cairo/pattern.cc
index d3362de..c387d12 100644
--- a/o3d/core/cross/cairo/pattern.cc
+++ b/o3d/core/cross/cairo/pattern.cc
@@ -84,7 +84,29 @@ void Pattern::SetAffineTransform(double xx,
cairo_pattern_set_matrix(pattern_, &matrix);
}
-void Pattern::set_filter(Filter filter) {
+void Pattern::set_extend(ExtendType extend) {
+ cairo_extend_t cairo_extend;
+ switch (extend) {
+ case NONE:
+ cairo_extend = CAIRO_EXTEND_NONE;
+ break;
+ case REPEAT:
+ cairo_extend = CAIRO_EXTEND_REPEAT;
+ break;
+ case REFLECT:
+ cairo_extend = CAIRO_EXTEND_REFLECT;
+ break;
+ case PAD:
+ cairo_extend = CAIRO_EXTEND_PAD;
+ break;
+ default:
+ DCHECK(false);
+ return;
+ }
+ cairo_pattern_set_extend(pattern_, cairo_extend);
+}
+
+void Pattern::set_filter(FilterType filter) {
cairo_filter_t cairo_filter;
switch (filter) {
case FAST:
diff --git a/o3d/core/cross/cairo/pattern.h b/o3d/core/cross/cairo/pattern.h
index 6927ee22..ef8bda9 100644
--- a/o3d/core/cross/cairo/pattern.h
+++ b/o3d/core/cross/cairo/pattern.h
@@ -49,7 +49,14 @@ class Pattern : public ObjectBase {
public:
typedef SmartPointer<Pattern> Ref;
- enum Filter {
+ enum ExtendType {
+ NONE,
+ REPEAT,
+ REFLECT,
+ PAD
+ };
+
+ enum FilterType {
FAST,
GOOD,
BEST,
@@ -87,7 +94,9 @@ class Pattern : public ObjectBase {
double x0,
double y0);
- void set_filter(Filter filter);
+ void set_extend(ExtendType extend);
+
+ void set_filter(FilterType filter);
private:
Pattern(ServiceLocator* service_locator, cairo_pattern_t* pattern);