diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-25 16:33:23 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-25 16:33:23 +0000 |
commit | 74db48eb22cd8bfe4d028418d99e7aee6c220930 (patch) | |
tree | 94b62cc97d669cb965d2073c5d9a72a4a3c3ee04 /gfx | |
parent | 2abd00dd89a5cbc9af4a88a59269fdf9f988cf12 (diff) | |
download | chromium_src-74db48eb22cd8bfe4d028418d99e7aee6c220930.zip chromium_src-74db48eb22cd8bfe4d028418d99e7aee6c220930.tar.gz chromium_src-74db48eb22cd8bfe4d028418d99e7aee6c220930.tar.bz2 |
Canvas refactoring part 3.
- Replace Canvas instance users with CanvasSkia users.
- Rename Canvas2 to Canvas.
- Delete Canvas subclass of CanvasSkia.
This has created some ugliness around the fact that people that used SkCanvas methods on Canvas now have to go through AsCanvasSkia first. This is temporary ugliness that will be eradicated as I incrementally build out the new Canvas API.
BUG=none
TEST=none
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50854 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/canvas.h | 200 | ||||
-rw-r--r-- | gfx/canvas_2.h | 201 | ||||
-rw-r--r-- | gfx/canvas_skia.cc | 43 | ||||
-rw-r--r-- | gfx/canvas_skia.h | 10 | ||||
-rw-r--r-- | gfx/canvas_skia_linux.cc | 2 | ||||
-rw-r--r-- | gfx/canvas_skia_mac.mm | 2 | ||||
-rw-r--r-- | gfx/canvas_skia_paint.h | 4 | ||||
-rw-r--r-- | gfx/canvas_skia_win.cc | 2 | ||||
-rw-r--r-- | gfx/font_mac.mm | 5 | ||||
-rw-r--r-- | gfx/font_skia.cc | 5 | ||||
-rw-r--r-- | gfx/font_win.cc | 5 | ||||
-rw-r--r-- | gfx/gfx.gyp | 1 |
12 files changed, 230 insertions, 250 deletions
diff --git a/gfx/canvas.h b/gfx/canvas.h index 589d77d..d66db03 100644 --- a/gfx/canvas.h +++ b/gfx/canvas.h @@ -5,27 +5,195 @@ #ifndef GFX_CANVAS_H_ #define GFX_CANVAS_H_ -#include "gfx/canvas_skia.h" +#include <string> + +#include "gfx/native_widget_types.h" +// TODO(beng): remove this include when we no longer depend on SkTypes. +#include "skia/ext/platform_canvas.h" namespace gfx { -// Temporary compatibility shim, remove once Canvas2->Canvas. -class Canvas : public CanvasSkia { +class CanvasSkia; +class Font; +class Rect; + +// TODO(beng): documentation. +class Canvas { public: - Canvas(int width, int height, bool is_opaque) - : CanvasSkia(width, height, is_opaque) { - } - Canvas() : CanvasSkia() {} - - // Overridden from Canvas2: - Canvas* AsCanvas() { - return this; - } - - private: - DISALLOW_COPY_AND_ASSIGN(Canvas); + // Specifies the alignment for text rendered with the DrawStringInt method. + enum { + TEXT_ALIGN_LEFT = 1, + TEXT_ALIGN_CENTER = 2, + TEXT_ALIGN_RIGHT = 4, + TEXT_VALIGN_TOP = 8, + TEXT_VALIGN_MIDDLE = 16, + TEXT_VALIGN_BOTTOM = 32, + + // Specifies the text consists of multiple lines. + MULTI_LINE = 64, + + // By default DrawStringInt does not process the prefix ('&') character + // specially. That is, the string "&foo" is rendered as "&foo". When + // rendering text from a resource that uses the prefix character for + // mnemonics, the prefix should be processed and can be rendered as an + // underline (SHOW_PREFIX), or not rendered at all (HIDE_PREFIX). + SHOW_PREFIX = 128, + HIDE_PREFIX = 256, + + // Prevent ellipsizing + NO_ELLIPSIS = 512, + + // Specifies if words can be split by new lines. + // This only works with MULTI_LINE. + CHARACTER_BREAK = 1024, + + // Instructs DrawStringInt() to render the text using RTL directionality. + // In most cases, passing this flag is not necessary because information + // about the text directionality is going to be embedded within the string + // in the form of special Unicode characters. However, we don't insert + // directionality characters into strings if the locale is LTR because some + // platforms (for example, an English Windows XP with no RTL fonts + // installed) don't support these characters. Thus, this flag should be + // used to render text using RTL directionality when the locale is LTR. + FORCE_RTL_DIRECTIONALITY = 2048, + }; + + virtual ~Canvas() {} + + // Creates an empty canvas. Must be initialized before it can be used. + static Canvas* CreateCanvas(); + + // Creates a canvas with the specified size. + static Canvas* CreateCanvas(int width, int height, bool is_opaque); + + // Retrieves the clip rectangle and sets it in the specified rectangle if any. + // Returns true if the clip rect is non-empty. + virtual bool GetClipRect(gfx::Rect* clip_rect) = 0; + + // Wrapper function that takes integer arguments. + // Returns true if the clip is non-empty. + // See clipRect for specifics. + virtual bool ClipRectInt(int x, int y, int w, int h) = 0; + + // Test whether the provided rectangle intersects the current clip rect. + virtual bool IntersectsClipRectInt(int x, int y, int w, int h) = 0; + + // Wrapper function that takes integer arguments. + // See translate() for specifics. + virtual void TranslateInt(int x, int y) = 0; + + // Wrapper function that takes integer arguments. + // See scale() for specifics. + virtual void ScaleInt(int x, int y) = 0; + + // Fills the given rectangle with the given paint's parameters. + virtual void FillRectInt(int x, int y, int w, int h, + const SkPaint& paint) = 0; + + // Fills the specified region with the specified color using a transfer + // mode of SkXfermode::kSrcOver_Mode. + virtual void FillRectInt(const SkColor& color, int x, int y, int w, + int h) = 0; + + // Draws a single pixel rect in the specified region with the specified + // color, using a transfer mode of SkXfermode::kSrcOver_Mode. + // + // NOTE: if you need a single pixel line, use DraLineInt. + virtual void DrawRectInt(const SkColor& color, int x, int y, int w, + int h) = 0; + + // Draws a single pixel rect in the specified region with the specified + // color and transfer mode. + // + // NOTE: if you need a single pixel line, use DraLineInt. + virtual void DrawRectInt(const SkColor& color, int x, int y, int w, int h, + SkXfermode::Mode mode) = 0; + + // Draws a single pixel line with the specified color. + virtual void DrawLineInt(const SkColor& color, int x1, int y1, int x2, + int y2) = 0; + + // Draws a bitmap with the origin at the specified location. The upper left + // corner of the bitmap is rendered at the specified location. + virtual void DrawBitmapInt(const SkBitmap& bitmap, int x, int y) = 0; + + // Draws a bitmap with the origin at the specified location, using the + // specified paint. The upper left corner of the bitmap is rendered at the + // specified location. + virtual void DrawBitmapInt(const SkBitmap& bitmap, int x, int y, + const SkPaint& paint) = 0; + + // Draws a portion of a bitmap in the specified location. The src parameters + // correspond to the region of the bitmap to draw in the region defined + // by the dest coordinates. + // + // If the width or height of the source differs from that of the destination, + // the bitmap will be scaled. When scaling down, it is highly recommended + // that you call buildMipMap(false) on your bitmap to ensure that it has + // a mipmap, which will result in much higher-quality output. Set |filter| + // to use filtering for bitmaps, otherwise the nearest-neighbor algorithm + // is used for resampling. + // + // An optional custom SkPaint can be provided. + virtual void DrawBitmapInt(const SkBitmap& bitmap, int src_x, int src_y, + int src_w, int src_h, int dest_x, int dest_y, + int dest_w, int dest_h, bool filter) = 0; + virtual void DrawBitmapInt(const SkBitmap& bitmap, int src_x, int src_y, + int src_w, int src_h, int dest_x, int dest_y, + int dest_w, int dest_h, bool filter, + const SkPaint& paint) = 0; + + // Draws text with the specified color, font and location. The text is + // aligned to the left, vertically centered, clipped to the region. If the + // text is too big, it is truncated and '...' is added to the end. + virtual void DrawStringInt(const std::wstring& text, const gfx::Font& font, + const SkColor& color, int x, int y, int w, + int h) = 0; + virtual void DrawStringInt(const std::wstring& text, const gfx::Font& font, + const SkColor& color, + const gfx::Rect& display_rect) = 0; + + // Draws text with the specified color, font and location. The last argument + // specifies flags for how the text should be rendered. It can be one of + // TEXT_ALIGN_CENTER, TEXT_ALIGN_RIGHT or TEXT_ALIGN_LEFT. + virtual void DrawStringInt(const std::wstring& text, const gfx::Font& font, + const SkColor& color, int x, int y, int w, int h, + int flags) = 0; + + // Draws a dotted gray rectangle used for focus purposes. + virtual void DrawFocusRect(int x, int y, int width, int height) = 0; + + // Tiles the image in the specified region. + virtual void TileImageInt(const SkBitmap& bitmap, int x, int y, int w, + int h) = 0; + virtual void TileImageInt(const SkBitmap& bitmap, int src_x, int src_y, + int dest_x, int dest_y, int w, int h) = 0; + + // TODO(beng): remove this once we don't need to use any skia-specific methods + // through this interface. + // A quick and dirty way to obtain the underlying SkCanvas. + virtual CanvasSkia* AsCanvasSkia() { return NULL; } + virtual const CanvasSkia* AsCanvasSkia() const { return NULL; } +}; + +class CanvasPaint { + public: + virtual ~CanvasPaint() {} + + // Creates a canvas that paints to |view| when it is destroyed. The canvas is + // sized to the client area of |view|. + static CanvasPaint* CreateCanvasPaint(gfx::NativeView view); + + // Returns true if the canvas has an invalid rect that needs to be repainted. + virtual bool IsValid() const = 0; + + // Returns the rectangle that is invalid. + virtual gfx::Rect GetInvalidRect() const = 0; + + // Returns the underlying Canvas. + virtual Canvas* AsCanvas() = 0; }; -} +} // namespace gfx; #endif // GFX_CANVAS_H_ diff --git a/gfx/canvas_2.h b/gfx/canvas_2.h deleted file mode 100644 index bf7e244..0000000 --- a/gfx/canvas_2.h +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef GFX_CANVAS_2_H_ -#define GFX_CANVAS_2_H_ - -#include <string> - -#include "gfx/native_widget_types.h" -// TODO(beng): remove this include when we no longer depend on SkTypes. -#include "skia/ext/platform_canvas.h" - -namespace gfx { - -class Canvas; -class Font; -class Rect; - -// TODO(beng): documentation. -class Canvas2 { - public: - // Specifies the alignment for text rendered with the DrawStringInt method. - enum { - TEXT_ALIGN_LEFT = 1, - TEXT_ALIGN_CENTER = 2, - TEXT_ALIGN_RIGHT = 4, - TEXT_VALIGN_TOP = 8, - TEXT_VALIGN_MIDDLE = 16, - TEXT_VALIGN_BOTTOM = 32, - - // Specifies the text consists of multiple lines. - MULTI_LINE = 64, - - // By default DrawStringInt does not process the prefix ('&') character - // specially. That is, the string "&foo" is rendered as "&foo". When - // rendering text from a resource that uses the prefix character for - // mnemonics, the prefix should be processed and can be rendered as an - // underline (SHOW_PREFIX), or not rendered at all (HIDE_PREFIX). - SHOW_PREFIX = 128, - HIDE_PREFIX = 256, - - // Prevent ellipsizing - NO_ELLIPSIS = 512, - - // Specifies if words can be split by new lines. - // This only works with MULTI_LINE. - CHARACTER_BREAK = 1024, - - // Instructs DrawStringInt() to render the text using RTL directionality. - // In most cases, passing this flag is not necessary because information - // about the text directionality is going to be embedded within the string - // in the form of special Unicode characters. However, we don't insert - // directionality characters into strings if the locale is LTR because some - // platforms (for example, an English Windows XP with no RTL fonts - // installed) don't support these characters. Thus, this flag should be - // used to render text using RTL directionality when the locale is LTR. - FORCE_RTL_DIRECTIONALITY = 2048, - }; - - virtual ~Canvas2() {} - - // Creates an empty canvas. Must be initialized before it can be used. - static Canvas2* CreateCanvas(); - - // Creates a canvas with the specified size. - static Canvas2* CreateCanvas(int width, int height, bool is_opaque); - - // Retrieves the clip rectangle and sets it in the specified rectangle if any. - // Returns true if the clip rect is non-empty. - virtual bool GetClipRect(gfx::Rect* clip_rect) = 0; - - // Wrapper function that takes integer arguments. - // Returns true if the clip is non-empty. - // See clipRect for specifics. - virtual bool ClipRectInt(int x, int y, int w, int h) = 0; - - // Test whether the provided rectangle intersects the current clip rect. - virtual bool IntersectsClipRectInt(int x, int y, int w, int h) = 0; - - // Wrapper function that takes integer arguments. - // See translate() for specifics. - virtual void TranslateInt(int x, int y) = 0; - - // Wrapper function that takes integer arguments. - // See scale() for specifics. - virtual void ScaleInt(int x, int y) = 0; - - // Fills the given rectangle with the given paint's parameters. - virtual void FillRectInt(int x, int y, int w, int h, - const SkPaint& paint) = 0; - - // Fills the specified region with the specified color using a transfer - // mode of SkXfermode::kSrcOver_Mode. - virtual void FillRectInt(const SkColor& color, int x, int y, int w, - int h) = 0; - - // Draws a single pixel rect in the specified region with the specified - // color, using a transfer mode of SkXfermode::kSrcOver_Mode. - // - // NOTE: if you need a single pixel line, use DraLineInt. - virtual void DrawRectInt(const SkColor& color, int x, int y, int w, - int h) = 0; - - // Draws a single pixel rect in the specified region with the specified - // color and transfer mode. - // - // NOTE: if you need a single pixel line, use DraLineInt. - virtual void DrawRectInt(const SkColor& color, int x, int y, int w, int h, - SkXfermode::Mode mode) = 0; - - // Draws a single pixel line with the specified color. - virtual void DrawLineInt(const SkColor& color, int x1, int y1, int x2, - int y2) = 0; - - // Draws a bitmap with the origin at the specified location. The upper left - // corner of the bitmap is rendered at the specified location. - virtual void DrawBitmapInt(const SkBitmap& bitmap, int x, int y) = 0; - - // Draws a bitmap with the origin at the specified location, using the - // specified paint. The upper left corner of the bitmap is rendered at the - // specified location. - virtual void DrawBitmapInt(const SkBitmap& bitmap, int x, int y, - const SkPaint& paint) = 0; - - // Draws a portion of a bitmap in the specified location. The src parameters - // correspond to the region of the bitmap to draw in the region defined - // by the dest coordinates. - // - // If the width or height of the source differs from that of the destination, - // the bitmap will be scaled. When scaling down, it is highly recommended - // that you call buildMipMap(false) on your bitmap to ensure that it has - // a mipmap, which will result in much higher-quality output. Set |filter| - // to use filtering for bitmaps, otherwise the nearest-neighbor algorithm - // is used for resampling. - // - // An optional custom SkPaint can be provided. - virtual void DrawBitmapInt(const SkBitmap& bitmap, int src_x, int src_y, - int src_w, int src_h, int dest_x, int dest_y, - int dest_w, int dest_h, bool filter) = 0; - virtual void DrawBitmapInt(const SkBitmap& bitmap, int src_x, int src_y, - int src_w, int src_h, int dest_x, int dest_y, - int dest_w, int dest_h, bool filter, - const SkPaint& paint) = 0; - - // Draws text with the specified color, font and location. The text is - // aligned to the left, vertically centered, clipped to the region. If the - // text is too big, it is truncated and '...' is added to the end. - virtual void DrawStringInt(const std::wstring& text, const gfx::Font& font, - const SkColor& color, int x, int y, int w, - int h) = 0; - virtual void DrawStringInt(const std::wstring& text, const gfx::Font& font, - const SkColor& color, - const gfx::Rect& display_rect) = 0; - - // Draws text with the specified color, font and location. The last argument - // specifies flags for how the text should be rendered. It can be one of - // TEXT_ALIGN_CENTER, TEXT_ALIGN_RIGHT or TEXT_ALIGN_LEFT. - virtual void DrawStringInt(const std::wstring& text, const gfx::Font& font, - const SkColor& color, int x, int y, int w, int h, - int flags) = 0; - - // Draws a dotted gray rectangle used for focus purposes. - virtual void DrawFocusRect(int x, int y, int width, int height) = 0; - - // Tiles the image in the specified region. - virtual void TileImageInt(const SkBitmap& bitmap, int x, int y, int w, - int h) = 0; - virtual void TileImageInt(const SkBitmap& bitmap, int src_x, int src_y, - int dest_x, int dest_y, int w, int h) = 0; - - // Extracts a bitmap from the contents of this canvas. - virtual SkBitmap ExtractBitmap() const = 0; - - // TODO(beng): remove this once we don't need to use any skia-specific methods - // through this interface. - // A quick and dirty way to obtain the underlying SkCanvas. - virtual Canvas* AsCanvas() { return NULL; } -}; - -class CanvasPaint2 { - public: - virtual ~CanvasPaint2() {} - - // Creates a canvas that paints to |view| when it is destroyed. The canvas is - // sized to the client area of |view|. - static CanvasPaint2* CreateCanvasPaint(gfx::NativeView view); - - // Returns true if the canvas has an invalid rect that needs to be repainted. - virtual bool IsValid() const = 0; - - // Returns the rectangle that is invalid. - virtual gfx::Rect GetInvalidRect() const = 0; - - // Returns the underlying Canvas2. - virtual Canvas2* AsCanvas2() = 0; -}; - -} // namespace gfx; - -#endif // GFX_CANVAS_2_H_ diff --git a/gfx/canvas_skia.cc b/gfx/canvas_skia.cc index 8fa763a..8fb752de 100644 --- a/gfx/canvas_skia.cc +++ b/gfx/canvas_skia.cc @@ -2,13 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "gfx/canvas.h" +#include "gfx/canvas_skia.h" #include <limits> #include "base/i18n/rtl.h" #include "base/logging.h" -#include "gfx/canvas.h" #include "gfx/font.h" #include "gfx/rect.h" #include "third_party/skia/include/core/SkShader.h" @@ -19,6 +18,17 @@ namespace gfx { +SkBitmap CanvasSkia::ExtractBitmap() const { + const SkBitmap& device_bitmap = getDevice()->accessBitmap(false); + + // Make a bitmap to return, and a canvas to draw into it. We don't just want + // to call extractSubset or the copy constructor, since we want an actual copy + // of the bitmap. + SkBitmap result; + device_bitmap.copyTo(&result, SkBitmap::kARGB_8888_Config); + return result; +} + bool CanvasSkia::GetClipRect(gfx::Rect* r) { SkRect clip; if (!getClipBounds(&clip)) { @@ -263,15 +273,12 @@ void CanvasSkia::TileImageInt(const SkBitmap& bitmap, int src_x, int src_y, restore(); } -SkBitmap CanvasSkia::ExtractBitmap() const { - const SkBitmap& device_bitmap = getDevice()->accessBitmap(false); +CanvasSkia* CanvasSkia::AsCanvasSkia() { + return this; +} - // Make a bitmap to return, and a canvas to draw into it. We don't just want - // to call extractSubset or the copy constuctor, since we want an actual copy - // of the bitmap. - SkBitmap result; - device_bitmap.copyTo(&result, SkBitmap::kARGB_8888_Config); - return result; +const CanvasSkia* CanvasSkia::AsCanvasSkia() const { + return this; } // static @@ -282,19 +289,19 @@ int CanvasSkia::DefaultCanvasTextAlignment() { } //////////////////////////////////////////////////////////////////////////////// -// Canvas2, public: +// Canvas, public: -Canvas2* Canvas2::CreateCanvas() { - return new Canvas; +Canvas* Canvas::CreateCanvas() { + return new CanvasSkia; } -Canvas2* Canvas2::CreateCanvas(int width, int height, bool is_opaque) { - return new Canvas(width, height, is_opaque); +Canvas* Canvas::CreateCanvas(int width, int height, bool is_opaque) { + return new CanvasSkia(width, height, is_opaque); } #if defined(OS_WIN) // TODO(beng): move to canvas_win.cc, etc. -class CanvasPaintWin : public CanvasSkiaPaint, public CanvasPaint2 { +class CanvasPaintWin : public CanvasSkiaPaint, public CanvasPaint { public: CanvasPaintWin(gfx::NativeView view) : CanvasSkiaPaint(view) {} @@ -307,13 +314,13 @@ class CanvasPaintWin : public CanvasSkiaPaint, public CanvasPaint2 { return gfx::Rect(paintStruct().rcPaint); } - virtual Canvas2* AsCanvas2() { + virtual Canvas* AsCanvas() { return this; } }; #endif -CanvasPaint2* CanvasPaint2::CreateCanvasPaint(gfx::NativeView view) { +CanvasPaint* CanvasPaint::CreateCanvasPaint(gfx::NativeView view) { #if defined(OS_WIN) return new CanvasPaintWin(view); #else diff --git a/gfx/canvas_skia.h b/gfx/canvas_skia.h index 9a976fd..cae4ac1 100644 --- a/gfx/canvas_skia.h +++ b/gfx/canvas_skia.h @@ -6,7 +6,7 @@ #define GFX_CANVAS_SKIA_H_ #include "base/basictypes.h" -#include "gfx/canvas_2.h" +#include "gfx/canvas.h" #include "skia/ext/platform_canvas.h" #if defined(OS_POSIX) && !defined(OS_MACOSX) @@ -33,7 +33,7 @@ class Canvas; // the variant that does not take a SkXfermode::Mode uses a transfer mode // of kSrcOver_Mode. class CanvasSkia : public skia::PlatformCanvas, - public Canvas2 { + public Canvas { public: // Creates an empty Canvas. Callers must use initialize before using the // canvas. @@ -76,6 +76,9 @@ class CanvasSkia : public skia::PlatformCanvas, int x, int y, int w, int h, int flags); #endif + // Extracts a bitmap from the contents of this canvas. + SkBitmap ExtractBitmap() const; + // Overridden from Canvas2: virtual bool GetClipRect(gfx::Rect* clip_rect); virtual bool ClipRectInt(int x, int y, int w, int h); @@ -115,7 +118,8 @@ class CanvasSkia : public skia::PlatformCanvas, virtual void TileImageInt(const SkBitmap& bitmap, int x, int y, int w, int h); virtual void TileImageInt(const SkBitmap& bitmap, int src_x, int src_y, int dest_x, int dest_y, int w, int h); - virtual SkBitmap ExtractBitmap() const; + virtual CanvasSkia* AsCanvasSkia(); + virtual const CanvasSkia* AsCanvasSkia() const; private: #if defined(OS_WIN) diff --git a/gfx/canvas_skia_linux.cc b/gfx/canvas_skia_linux.cc index 59e0e29..680476f 100644 --- a/gfx/canvas_skia_linux.cc +++ b/gfx/canvas_skia_linux.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "gfx/canvas.h" +#include "gfx/canvas_skia.h" #include <cairo/cairo.h> #include <gtk/gtk.h> diff --git a/gfx/canvas_skia_mac.mm b/gfx/canvas_skia_mac.mm index 29102fd..7836869 100644 --- a/gfx/canvas_skia_mac.mm +++ b/gfx/canvas_skia_mac.mm @@ -4,7 +4,7 @@ #import <Cocoa/Cocoa.h> -#include "gfx/canvas.h" +#include "gfx/canvas_skia.h" #include "base/scoped_cftyperef.h" #include "base/sys_string_conversions.h" diff --git a/gfx/canvas_skia_paint.h b/gfx/canvas_skia_paint.h index 4e6f768..ac11ff0 100644 --- a/gfx/canvas_skia_paint.h +++ b/gfx/canvas_skia_paint.h @@ -5,7 +5,7 @@ #ifndef GFX_CANVAS_SKIA_PAINT_H_ #define GFX_CANVAS_SKIA_PAINT_H_ -#include "gfx/canvas.h" +#include "gfx/canvas_skia.h" #include "skia/ext/canvas_paint.h" // Define a gfx::CanvasSkiaPaint type that wraps our gfx::Canvas like the @@ -13,7 +13,7 @@ namespace gfx { -typedef skia::CanvasPaintT<Canvas> CanvasSkiaPaint; +typedef skia::CanvasPaintT<CanvasSkia> CanvasSkiaPaint; } // namespace gfx diff --git a/gfx/canvas_skia_win.cc b/gfx/canvas_skia_win.cc index 4177ef5..f3c5f8f 100644 --- a/gfx/canvas_skia_win.cc +++ b/gfx/canvas_skia_win.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "gfx/canvas.h" +#include "gfx/canvas_skia.h" #include <limits> diff --git a/gfx/font_mac.mm b/gfx/font_mac.mm index f964d94..e569a35 100644 --- a/gfx/font_mac.mm +++ b/gfx/font_mac.mm @@ -9,7 +9,7 @@ #include "base/logging.h" #include "base/scoped_nsobject.h" #include "base/sys_string_conversions.h" -#include "gfx/canvas.h" +#include "gfx/canvas_skia.h" namespace gfx { @@ -60,7 +60,8 @@ int Font::ave_char_width() const { int Font::GetStringWidth(const std::wstring& text) const { int width = 0, height = 0; - Canvas::SizeStringInt(text, *this, &width, &height, gfx::Canvas::NO_ELLIPSIS); + CanvasSkia::SizeStringInt(text, *this, &width, &height, + gfx::Canvas::NO_ELLIPSIS); return width; } diff --git a/gfx/font_skia.cc b/gfx/font_skia.cc index 97a3c85..0289cdb 100644 --- a/gfx/font_skia.cc +++ b/gfx/font_skia.cc @@ -11,7 +11,7 @@ #include "base/logging.h" #include "base/string_piece.h" #include "base/sys_string_conversions.h" -#include "gfx/canvas.h" +#include "gfx/canvas_skia.h" #include "third_party/skia/include/core/SkTypeface.h" #include "third_party/skia/include/core/SkPaint.h" @@ -177,7 +177,8 @@ void Font::PaintSetup(SkPaint* paint) const { int Font::GetStringWidth(const std::wstring& text) const { int width = 0, height = 0; - Canvas::SizeStringInt(text, *this, &width, &height, gfx::Canvas::NO_ELLIPSIS); + CanvasSkia::SizeStringInt(text, *this, &width, &height, + gfx::Canvas::NO_ELLIPSIS); return width; } diff --git a/gfx/font_win.cc b/gfx/font_win.cc index 4d4d28e..f9b7243 100644 --- a/gfx/font_win.cc +++ b/gfx/font_win.cc @@ -12,7 +12,7 @@ #include "base/logging.h" #include "base/string_util.h" #include "base/win_util.h" -#include "gfx/canvas.h" +#include "gfx/canvas_skia.h" namespace gfx { @@ -171,7 +171,8 @@ Font Font::DeriveFont(int size_delta, int style) const { int Font::GetStringWidth(const std::wstring& text) const { int width = 0, height = 0; - Canvas::SizeStringInt(text, *this, &width, &height, gfx::Canvas::NO_ELLIPSIS); + CanvasSkia::SizeStringInt(text, *this, &width, &height, + gfx::Canvas::NO_ELLIPSIS); return width; } diff --git a/gfx/gfx.gyp b/gfx/gfx.gyp index c0d4000..592901c 100644 --- a/gfx/gfx.gyp +++ b/gfx/gfx.gyp @@ -63,7 +63,6 @@ 'blit.cc', 'blit.h', 'canvas.h', - 'canvas_2.h', 'canvas_skia.h', 'canvas_skia.cc', 'canvas_skia_linux.cc', |