diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-23 22:23:59 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-23 22:23:59 +0000 |
commit | 0f4fe844bd7ca7f0fa512a2e786d9debb2831526 (patch) | |
tree | f803b71c036a9fb0286298a366e682f65325d58d /gfx/canvas_direct2d_unittest.cc | |
parent | 04dd9d9de68e20da43e7e2f13a550ea7c8ca6fa3 (diff) | |
download | chromium_src-0f4fe844bd7ca7f0fa512a2e786d9debb2831526.zip chromium_src-0f4fe844bd7ca7f0fa512a2e786d9debb2831526.tar.gz chromium_src-0f4fe844bd7ca7f0fa512a2e786d9debb2831526.tar.bz2 |
Add support for brushes to gfx::Canvas... right now just LinearGradientBrush.
A native brush is created by gfx::Canvas::CreateLinearGradientBrush wrapped in a gfx::Brush. When gfx::Brush is deleted the platform wrapper frees the native brush.
BUG=none
TEST=see unittest.
Review URL: http://codereview.chromium.org/3038019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53534 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gfx/canvas_direct2d_unittest.cc')
-rw-r--r-- | gfx/canvas_direct2d_unittest.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gfx/canvas_direct2d_unittest.cc b/gfx/canvas_direct2d_unittest.cc index 541e3f0..d8c02c1 100644 --- a/gfx/canvas_direct2d_unittest.cc +++ b/gfx/canvas_direct2d_unittest.cc @@ -8,6 +8,7 @@ #include <vssym32.h> #include "base/command_line.h" +#include "base/scoped_ptr.h" #include "gfx/canvas_direct2d.h" #include "gfx/canvas_skia.h" #include "gfx/native_theme_win.h" @@ -202,3 +203,21 @@ TEST(CanvasDirect2D, ClipRectWithScale) { canvas.FillRectInt(SK_ColorRED, 0, 0, 500, 500); canvas.Restore(); } + +TEST(CanvasDirect2D, CreateLinearGradientBrush) { + TestWindow window; + gfx::CanvasDirect2D canvas(window.rt()); + + canvas.Save(); + SkColor colors[] = { SK_ColorRED, SK_ColorWHITE }; + float positions[] = { 0.0f, 1.0f }; + scoped_ptr<gfx::Brush> brush(canvas.CreateLinearGradientBrush( + gfx::Point(0, 0), + gfx::Point(100, 0), + colors, + positions, + 2, + gfx::Canvas::TileMode_Clamp)); + canvas.FillRectInt(brush.get(), 0, 0, 500, 500); + canvas.Restore(); +} |