| Index: ui/gfx/canvas_skia.h
|
| ===================================================================
|
| --- ui/gfx/canvas_skia.h (revision 82144)
|
| +++ ui/gfx/canvas_skia.h (working copy)
|
| @@ -7,8 +7,8 @@
|
| #pragma once
|
|
|
| #include "base/basictypes.h"
|
| +#include "base/scoped_ptr.h"
|
| #include "base/string16.h"
|
| -#include "skia/ext/platform_canvas.h"
|
| #include "ui/gfx/canvas.h"
|
|
|
| #if defined(OS_POSIX) && !defined(OS_MACOSX)
|
| @@ -19,9 +19,9 @@
|
|
|
| class Canvas;
|
|
|
| -// CanvasSkia is a SkCanvas subclass that provides a number of methods for
|
| -// common operations used throughout an application built using base/gfx and
|
| -// app/gfx.
|
| +// CanvasSkia is a Canvas subclass implemented using skia canvas.
|
| +// It provides a number of methods for common operations used throughout an
|
| +// application built using base/gfx and app/gfx.
|
| //
|
| // All methods that take integer arguments (as is used throughout views)
|
| // end with Int. If you need to use methods provided by the superclass
|
| @@ -34,8 +34,7 @@
|
| // source and destination colors are combined. Unless otherwise specified,
|
| // the variant that does not take a SkXfermode::Mode uses a transfer mode
|
| // of kSrcOver_Mode.
|
| -class CanvasSkia : public skia::PlatformCanvas,
|
| - public Canvas {
|
| +class CanvasSkia : public Canvas {
|
| public:
|
| enum TruncateFadeMode {
|
| TruncateFadeTail,
|
| @@ -43,12 +42,9 @@
|
| TruncateFadeHeadAndTail,
|
| };
|
|
|
| - // Creates an empty Canvas. Callers must use initialize before using the
|
| - // canvas.
|
| + // Creates an empty Canvas.
|
| + // Callers must use Init before using the canvas.
|
| CanvasSkia();
|
| -
|
| - CanvasSkia(int width, int height, bool is_opaque);
|
| -
|
| virtual ~CanvasSkia();
|
|
|
| // Compute the size required to draw some text with the provided font.
|
| @@ -69,6 +65,11 @@
|
| // gfx::Canvas::TEXT_ALIGN_RIGHT.
|
| static int DefaultCanvasTextAlignment();
|
|
|
| + bool Init(int width, int height, bool is_opaque);
|
| +
|
| + // Returns the underlying skia canvas.
|
| + SkCanvas* skia_canvas() { return skia_canvas_.get(); }
|
| +
|
| #if defined(OS_POSIX) && !defined(OS_MACOSX)
|
| // Draw the pixbuf in its natural size at (x, y).
|
| void DrawGdkPixbuf(GdkPixbuf* pixbuf, int x, int y);
|
| @@ -163,6 +164,17 @@
|
| virtual CanvasSkia* AsCanvasSkia();
|
| virtual const CanvasSkia* AsCanvasSkia() const;
|
|
|
| + // Blits a rectangle from this canvas into the destination context.
|
| + // This function uses two blit modes to achieve the final color:
|
| + // 1. Copy: If the source canvas is opaque the color data in the source
|
| + // rectangle is simply copied to the destination rectangle.
|
| + // 2. Blend: If the source canvas is translucent, the color data in the
|
| + // source rectangle is blended with that in the destination
|
| + // rectangle.
|
| + void BlitToNativeContext(const Rect& src_rect,
|
| + const Point& dst_origin,
|
| + NativeDrawingContext dst_context);
|
| +
|
| private:
|
| // Test whether the provided rectangle intersects the current clip rect.
|
| bool IntersectsClipRectInt(int x, int y, int w, int h);
|
| @@ -178,6 +190,7 @@
|
| int flags);
|
| #endif
|
|
|
| + scoped_ptr<SkCanvas> skia_canvas_;
|
| DISALLOW_COPY_AND_ASSIGN(CanvasSkia);
|
| };
|
|
|
|
|