diff options
author | tschmelcher@chromium.org <tschmelcher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-01 02:16:39 +0000 |
---|---|---|
committer | tschmelcher@chromium.org <tschmelcher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-01 02:16:39 +0000 |
commit | 32decac151899504d64ae28e7d4b46fd7f6abfab (patch) | |
tree | 827f709969ca87672f51ba26a87bdef443fef982 /o3d | |
parent | ac52deb9b4c1644a5146aec1c71c163a9d8b6aa9 (diff) | |
download | chromium_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')
-rw-r--r-- | o3d/core/cross/cairo/pattern.cc | 24 | ||||
-rw-r--r-- | o3d/core/cross/cairo/pattern.h | 13 | ||||
-rw-r--r-- | o3d/plugin/idl/pattern.idl | 28 |
3 files changed, 59 insertions, 6 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); diff --git a/o3d/plugin/idl/pattern.idl b/o3d/plugin/idl/pattern.idl index d8cbb6a7..c6779de 100644 --- a/o3d/plugin/idl/pattern.idl +++ b/o3d/plugin/idl/pattern.idl @@ -38,9 +38,26 @@ namespace o2d { %] [nocpp, include="core/cross/cairo/pattern.h"] class Pattern : ObjectBase { %[ + Available extend methods. + + \var ExtendType, + \li NONE, Pixels outside of the source pattern are fully transparent + \li REPEAT, The pattern is tiled by repeating + \li REFLECT, The pattern is tiled by reflecting at the edges + \li PAD, Pixels outside of the pattern copy the closest pixel from the + source + %] + enum ExtendType { + NONE, + REPEAT, + REFLECT, + PAD + }; + + %[ Available resizing filters. - \var Filter, + \var FilterType, \li FAST, A high-performance filter, with quality similar to NEAREST \li GOOD, A reasonable-performance filter, with quality similar to BILINEAR \li BEST, The highest-quality available, performance may not be suitable @@ -48,7 +65,7 @@ namespace o2d { \li NEAREST, Nearest-neighbor filtering \li BILINEAR, Linear interpolation in two dimensions %] - enum Filter { + enum FilterType { FAST, GOOD, BEST, @@ -114,9 +131,14 @@ namespace o2d { double y0); %[ + The extend method to use to fill in areas outside of this Pattern. + %] + [setter] ExtendType extend; + + %[ The filter to use when resizing this Pattern. %] - [setter] Filter filter; + [setter] FilterType filter; }; // Pattern } // namespace o2d |