diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-15 07:37:29 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-15 07:37:29 +0000 |
commit | 82522511b7921e8c61742ebd80a4c674c56e7e48 (patch) | |
tree | 381d71de2b9c7b99675e6f2b4523ae0876c72ce8 /app | |
parent | 631cf822bd6e64cf469544b42c9975f5602c29a6 (diff) | |
download | chromium_src-82522511b7921e8c61742ebd80a4c674c56e7e48.zip chromium_src-82522511b7921e8c61742ebd80a4c674c56e7e48.tar.gz chromium_src-82522511b7921e8c61742ebd80a4c674c56e7e48.tar.bz2 |
ChromeCanvas->gfx::Canvas
Rename files too.
TBR=brettw
http://crbug.com/11387
Review URL: http://codereview.chromium.org/113443
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16148 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r-- | app/DEPS | 8 | ||||
-rw-r--r-- | app/app.vcproj | 16 | ||||
-rw-r--r-- | app/gfx/canvas.cc (renamed from app/gfx/chrome_canvas.cc) | 77 | ||||
-rw-r--r-- | app/gfx/canvas.h (renamed from app/gfx/chrome_canvas.h) | 40 | ||||
-rw-r--r-- | app/gfx/canvas_linux.cc (renamed from app/gfx/chrome_canvas_linux.cc) | 38 | ||||
-rw-r--r-- | app/gfx/canvas_win.cc (renamed from app/gfx/chrome_canvas_win.cc) | 76 | ||||
-rw-r--r-- | app/gfx/font.h (renamed from app/gfx/chrome_font.h) | 2 | ||||
-rw-r--r-- | app/gfx/font_gtk.cc (renamed from app/gfx/chrome_font_gtk.cc) | 2 | ||||
-rw-r--r-- | app/gfx/font_mac.mm (renamed from app/gfx/chrome_font_mac.mm) | 2 | ||||
-rw-r--r-- | app/gfx/font_skia.cc (renamed from app/gfx/chrome_font_skia.cc) | 2 | ||||
-rw-r--r-- | app/gfx/font_unittest.cc (renamed from app/gfx/chrome_font_unittest.cc) | 2 | ||||
-rw-r--r-- | app/gfx/font_win.cc (renamed from app/gfx/chrome_font_win.cc) | 3 | ||||
-rw-r--r-- | app/gfx/icon_util.h | 6 | ||||
-rw-r--r-- | app/gfx/insets.h | 6 | ||||
-rw-r--r-- | app/gfx/path.h | 6 | ||||
-rw-r--r-- | app/gfx/text_elider.cc | 2 | ||||
-rw-r--r-- | app/gfx/text_elider.h | 8 | ||||
-rw-r--r-- | app/gfx/text_elider_unittest.cc | 2 | ||||
-rw-r--r-- | app/l10n_util.cc | 6 | ||||
-rw-r--r-- | app/l10n_util.h | 8 | ||||
-rw-r--r-- | app/resource_bundle.cc | 2 | ||||
-rw-r--r-- | app/resource_bundle_linux.cc | 2 | ||||
-rw-r--r-- | app/resource_bundle_mac.mm | 2 | ||||
-rw-r--r-- | app/resource_bundle_win.cc | 2 | ||||
-rw-r--r-- | app/win_util.h | 2 |
25 files changed, 163 insertions, 159 deletions
@@ -1,11 +1,11 @@ include_rules = [ - # TODO(beng): Modify this link to be more specific about what resource - # headers are included once app gets its own strings. - "+grit", + # TODO(beng): swap these with app/views specific generated resources. + "+grit/generated_resources.h", + "+grit/locale_settings.h", + "+grit/theme_resources.h", "+net", # TODO(beng): Sever these links once we have extracted all deps from # chrome/common. "+chrome/common/chrome_paths.h", - "+skia", ] diff --git a/app/app.vcproj b/app/app.vcproj index 37a051d..92b555c 100644 --- a/app/app.vcproj +++ b/app/app.vcproj @@ -125,35 +125,35 @@ Name="gfx"
>
<File
- RelativePath=".\gfx\chrome_canvas.cc"
+ RelativePath=".\gfx\canvas.cc"
>
</File>
<File
- RelativePath=".\gfx\chrome_canvas.h"
+ RelativePath=".\gfx\canvas.h"
>
</File>
<File
- RelativePath=".\gfx\chrome_canvas_win.cc"
+ RelativePath=".\gfx\canvas_win.cc"
>
</File>
<File
- RelativePath=".\gfx\chrome_font.h"
+ RelativePath=".\gfx\color_utils.cc"
>
</File>
<File
- RelativePath=".\gfx\chrome_font_win.cc"
+ RelativePath=".\gfx\color_utils.h"
>
</File>
<File
- RelativePath=".\gfx\color_utils.cc"
+ RelativePath=".\gfx\favicon_size.h"
>
</File>
<File
- RelativePath=".\gfx\color_utils.h"
+ RelativePath=".\gfx\font.h"
>
</File>
<File
- RelativePath=".\gfx\favicon_size.h"
+ RelativePath=".\gfx\font_win.cc"
>
</File>
<File
diff --git a/app/gfx/chrome_canvas.cc b/app/gfx/canvas.cc index 4419b0f..8df6b39 100644 --- a/app/gfx/chrome_canvas.cc +++ b/app/gfx/canvas.cc @@ -2,17 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include <limits> -#include "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "app/l10n_util.h" #include "base/gfx/rect.h" #include "base/logging.h" #include "third_party/skia/include/core/SkShader.h" -bool ChromeCanvas::GetClipRect(gfx::Rect* r) { +namespace gfx { + +bool Canvas::GetClipRect(gfx::Rect* r) { SkRect clip; if (!getClipBounds(&clip)) { if (r) @@ -25,30 +27,29 @@ bool ChromeCanvas::GetClipRect(gfx::Rect* r) { return true; } -bool ChromeCanvas::ClipRectInt(int x, int y, int w, int h) { +bool Canvas::ClipRectInt(int x, int y, int w, int h) { SkRect new_clip; new_clip.set(SkIntToScalar(x), SkIntToScalar(y), SkIntToScalar(x + w), SkIntToScalar(y + h)); return clipRect(new_clip); } -bool ChromeCanvas::IntersectsClipRectInt(int x, int y, int w, int h) { +bool Canvas::IntersectsClipRectInt(int x, int y, int w, int h) { SkRect clip; return getClipBounds(&clip) && clip.intersect(SkIntToScalar(x), SkIntToScalar(y), SkIntToScalar(x + w), SkIntToScalar(y + h)); } -void ChromeCanvas::TranslateInt(int x, int y) { +void Canvas::TranslateInt(int x, int y) { translate(SkIntToScalar(x), SkIntToScalar(y)); } -void ChromeCanvas::ScaleInt(int x, int y) { +void Canvas::ScaleInt(int x, int y) { scale(SkIntToScalar(x), SkIntToScalar(y)); } -void ChromeCanvas::FillRectInt(const SkColor& color, - int x, int y, int w, int h) { +void Canvas::FillRectInt(const SkColor& color, int x, int y, int w, int h) { SkPaint paint; paint.setColor(color); paint.setStyle(SkPaint::kFill_Style); @@ -56,20 +57,17 @@ void ChromeCanvas::FillRectInt(const SkColor& color, FillRectInt(x, y, w, h, paint); } -void ChromeCanvas::FillRectInt(int x, int y, int w, int h, - const SkPaint& paint) { +void Canvas::FillRectInt(int x, int y, int w, int h, const SkPaint& paint) { SkIRect rc = {x, y, x + w, y + h}; drawIRect(rc, paint); } -void ChromeCanvas::DrawRectInt(const SkColor& color, - int x, int y, int w, int h) { +void Canvas::DrawRectInt(const SkColor& color, int x, int y, int w, int h) { DrawRectInt(color, x, y, w, h, SkPorterDuff::kSrcOver_Mode); } -void ChromeCanvas::DrawRectInt(const SkColor& color, - int x, int y, int w, int h, - SkPorterDuff::Mode mode) { +void Canvas::DrawRectInt(const SkColor& color, int x, int y, int w, int h, + SkPorterDuff::Mode mode) { SkPaint paint; paint.setColor(color); paint.setStyle(SkPaint::kStroke_Style); @@ -83,8 +81,7 @@ void ChromeCanvas::DrawRectInt(const SkColor& color, drawIRect(rc, paint); } -void ChromeCanvas::DrawLineInt(const SkColor& color, - int x1, int y1, int x2, int y2) { +void Canvas::DrawLineInt(const SkColor& color, int x1, int y1, int x2, int y2) { SkPaint paint; paint.setColor(color); paint.setStrokeWidth(SkIntToScalar(1)); @@ -92,7 +89,7 @@ void ChromeCanvas::DrawLineInt(const SkColor& color, SkIntToScalar(y2), paint); } -void ChromeCanvas::DrawFocusRect(int x, int y, int width, int height) { +void Canvas::DrawFocusRect(int x, int y, int width, int height) { // Create a 2D bitmap containing alternating on/off pixels - we do this // so that you never get two pixels of the same color around the edges // of the focus rect (this may mean that opposing edges of the rect may @@ -146,28 +143,28 @@ void ChromeCanvas::DrawFocusRect(int x, int y, int width, int height) { drawRect(rect, paint); } -void ChromeCanvas::DrawBitmapInt(const SkBitmap& bitmap, int x, int y) { +void Canvas::DrawBitmapInt(const SkBitmap& bitmap, int x, int y) { drawBitmap(bitmap, SkIntToScalar(x), SkIntToScalar(y)); } -void ChromeCanvas::DrawBitmapInt(const SkBitmap& bitmap, int x, int y, - const SkPaint& paint) { +void Canvas::DrawBitmapInt(const SkBitmap& bitmap, int x, int y, + const SkPaint& paint) { drawBitmap(bitmap, SkIntToScalar(x), SkIntToScalar(y), &paint); } -void ChromeCanvas::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) { +void Canvas::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) { SkPaint p; DrawBitmapInt(bitmap, src_x, src_y, src_w, src_h, dest_x, dest_y, dest_w, dest_h, filter, p); } -void ChromeCanvas::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) { +void Canvas::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) { DLOG_ASSERT(src_x + src_w < std::numeric_limits<int16_t>::max() && src_y + src_h < std::numeric_limits<int16_t>::max()); if (src_w <= 0 || src_h <= 0 || dest_w <= 0 || dest_h <= 0) { @@ -216,22 +213,20 @@ void ChromeCanvas::DrawBitmapInt(const SkBitmap& bitmap, int src_x, int src_y, drawRect(dest_rect, p); } -void ChromeCanvas::DrawStringInt(const std::wstring& text, - const gfx::Font& font, - const SkColor& color, - int x, int y, - int w, int h) { +void Canvas::DrawStringInt(const std::wstring& text, + const gfx::Font& font, + const SkColor& color, + int x, int y, int w, int h) { DrawStringInt(text, font, color, x, y, w, h, l10n_util::DefaultCanvasTextAlignment()); } -void ChromeCanvas::TileImageInt(const SkBitmap& bitmap, - int x, int y, int w, int h) { +void Canvas::TileImageInt(const SkBitmap& bitmap, int x, int y, int w, int h) { TileImageInt(bitmap, 0, 0, x, y, w, h); } -void ChromeCanvas::TileImageInt(const SkBitmap& bitmap, int src_x, int src_y, - int dest_x, int dest_y, int w, int h) { +void Canvas::TileImageInt(const SkBitmap& bitmap, int src_x, int src_y, + int dest_x, int dest_y, int w, int h) { if (!IntersectsClipRectInt(dest_x, dest_y, w, h)) return; @@ -253,7 +248,7 @@ void ChromeCanvas::TileImageInt(const SkBitmap& bitmap, int src_x, int src_y, restore(); } -SkBitmap ChromeCanvas::ExtractBitmap() { +SkBitmap Canvas::ExtractBitmap() { const SkBitmap& device_bitmap = getDevice()->accessBitmap(false); // Make a bitmap to return, and a canvas to draw into it. We don't just want @@ -263,3 +258,5 @@ SkBitmap ChromeCanvas::ExtractBitmap() { device_bitmap.copyTo(&result, SkBitmap::kARGB_8888_Config); return result; } + +} // namespace gfx diff --git a/app/gfx/chrome_canvas.h b/app/gfx/canvas.h index 84c5320..e1d20b8 100644 --- a/app/gfx/chrome_canvas.h +++ b/app/gfx/canvas.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef APP_GFX_CHROME_CANVAS_H_ -#define APP_GFX_CHROME_CANVAS_H_ +#ifndef APP_GFX_CANVAS_H_ +#define APP_GFX_CANVAS_H_ #if defined(OS_WIN) #include <windows.h> @@ -14,19 +14,17 @@ #include "base/basictypes.h" #include "skia/ext/platform_canvas.h" -namespace gfx { -class Font; -class Rect; -} - #if defined(OS_LINUX) typedef struct _cairo cairo_t; #endif -// ChromeCanvas is the SkCanvas used by Views for all painting. It -// provides a handful of methods for the common operations used throughout -// Views. With few exceptions, you should NOT create a ChromeCanvas directly, -// rather one will be passed to you via the various paint methods in view. +namespace gfx { + +class Font; +class Rect; + +// Canvas is a SkCanvas subclass that 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 @@ -39,7 +37,7 @@ typedef struct _cairo cairo_t; // source and destination colors are combined. Unless otherwise specified, // the variant that does not take a SkPorterDuff::Mode uses a transfer mode // of kSrcOver_Mode. -class ChromeCanvas : public skia::PlatformCanvas { +class Canvas : public skia::PlatformCanvas { public: // Specifies the alignment for text rendered with the DrawStringInt method. enum { @@ -69,13 +67,13 @@ class ChromeCanvas : public skia::PlatformCanvas { CHARACTER_BREAK = 1024, }; - // Creates an empty ChromeCanvas. Callers must use initialize before using - // the canvas. - ChromeCanvas(); + // Creates an empty Canvas. Callers must use initialize before using the + // canvas. + Canvas(); - ChromeCanvas(int width, int height, bool is_opaque); + Canvas(int width, int height, bool is_opaque); - virtual ~ChromeCanvas(); + virtual ~Canvas(); // Retrieves the clip rectangle and sets it in the specified rectangle if any. // Returns true if the clip rect is non-empty. @@ -207,11 +205,13 @@ class ChromeCanvas : public skia::PlatformCanvas { int flags); #endif - DISALLOW_EVIL_CONSTRUCTORS(ChromeCanvas); + DISALLOW_COPY_AND_ASSIGN(Canvas); }; #if defined(OS_WIN) || defined(OS_LINUX) -typedef skia::CanvasPaintT<ChromeCanvas> ChromeCanvasPaint; +typedef skia::CanvasPaintT<Canvas> CanvasPaint; #endif -#endif // APP_GFX_CHROME_CANVAS_H_ +} // namespace gfx; + +#endif // #ifndef APP_GFX_CANVAS_H_ diff --git a/app/gfx/chrome_canvas_linux.cc b/app/gfx/canvas_linux.cc index 12602d9..feb5b7f 100644 --- a/app/gfx/chrome_canvas_linux.cc +++ b/app/gfx/canvas_linux.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include <pango/pango.h> -#include "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "base/gfx/rect.h" #include "base/logging.h" #include "base/string_util.h" @@ -41,24 +41,26 @@ PangoFontDescription* PangoFontFromGfxFont(const gfx::Font& gfx_font) { } // namespace -ChromeCanvas::ChromeCanvas(int width, int height, bool is_opaque) +namespace gfx { + +Canvas::Canvas(int width, int height, bool is_opaque) : skia::PlatformCanvasLinux(width, height, is_opaque) { } -ChromeCanvas::ChromeCanvas() : skia::PlatformCanvasLinux() { +Canvas::Canvas() : skia::PlatformCanvasLinux() { } -ChromeCanvas::~ChromeCanvas() { +Canvas::~Canvas() { } // static -void ChromeCanvas::SizeStringInt(const std::wstring& text, - const gfx::Font& font, - int* width, int* height, int flags) { +void Canvas::SizeStringInt(const std::wstring& text, + const gfx::Font& font, + int* width, int* height, int flags) { NOTIMPLEMENTED(); } -void ChromeCanvas::ApplySkiaMatrixToCairoContext(cairo_t* cr) { +void Canvas::ApplySkiaMatrixToCairoContext(cairo_t* cr) { const SkMatrix& skia_matrix = getTotalMatrix(); cairo_matrix_t cairo_matrix; cairo_matrix_init(&cairo_matrix, @@ -71,10 +73,10 @@ void ChromeCanvas::ApplySkiaMatrixToCairoContext(cairo_t* cr) { cairo_set_matrix(cr, &cairo_matrix); } -void ChromeCanvas::DrawStringInt(const std::wstring& text, - const gfx::Font& font, - const SkColor& color, int x, int y, int w, - int h, int flags) { +void Canvas::DrawStringInt(const std::wstring& text, + const gfx::Font& font, + const SkColor& color, int x, int y, int w, int h, + int flags) { cairo_surface_t* surface = beginPlatformPaint(); cairo_t* cr = cairo_create(surface); // We're going to draw onto the surface directly. This circumvents the matrix @@ -88,8 +90,8 @@ void ChromeCanvas::DrawStringInt(const std::wstring& text, SkColorGetG(color) / 255.0, SkColorGetB(color) / 255.0); - // TODO(deanm): Implement the rest of the ChromeCanvas flags. - if (!(flags & ChromeCanvas::NO_ELLIPSIS)) + // TODO(deanm): Implement the rest of the Canvas flags. + if (!(flags & Canvas::NO_ELLIPSIS)) pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_END); pango_layout_set_width(layout, w * PANGO_SCALE); @@ -119,9 +121,9 @@ void ChromeCanvas::DrawStringInt(const std::wstring& text, int width, height; pango_layout_get_size(layout, &width, &height); - if (flags & ChromeCanvas::TEXT_VALIGN_TOP) { + if (flags & Canvas::TEXT_VALIGN_TOP) { // Cairo should draw from the top left corner already. - } else if (flags & ChromeCanvas::TEXT_VALIGN_BOTTOM) { + } else if (flags & Canvas::TEXT_VALIGN_BOTTOM) { y = y + (h - (height / PANGO_SCALE)); } else { // Vertically centered. @@ -135,3 +137,5 @@ void ChromeCanvas::DrawStringInt(const std::wstring& text, cairo_destroy(cr); // NOTE: beginPlatformPaint returned its surface, we shouldn't destroy it. } + +} // namespace gfx diff --git a/app/gfx/chrome_canvas_win.cc b/app/gfx/canvas_win.cc index 267a510..2d818d4 100644 --- a/app/gfx/chrome_canvas_win.cc +++ b/app/gfx/canvas_win.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include <limits> -#include "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "app/l10n_util.h" #include "base/gfx/rect.h" #include "third_party/skia/include/core/SkShader.h" @@ -33,47 +33,47 @@ void DoDrawText(HDC hdc, const std::wstring& text, DrawText(hdc, string_ptr, string_size, text_bounds, flags); } -// Compute the windows flags necessary to implement the provided text -// ChromeCanvas flags. +// Compute the windows flags necessary to implement the provided text Canvas +// flags. int ComputeFormatFlags(int flags, const std::wstring& text) { int f = 0; // Setting the text alignment explicitly in case it hasn't already been set. // This will make sure that we don't align text to the left on RTL locales // just because no alignment flag was passed to DrawStringInt(). - if (!(flags & (ChromeCanvas::TEXT_ALIGN_CENTER | - ChromeCanvas::TEXT_ALIGN_RIGHT | - ChromeCanvas::TEXT_ALIGN_LEFT))) { + if (!(flags & (gfx::Canvas::TEXT_ALIGN_CENTER | + gfx::Canvas::TEXT_ALIGN_RIGHT | + gfx::Canvas::TEXT_ALIGN_LEFT))) { flags |= l10n_util::DefaultCanvasTextAlignment(); } - if (flags & ChromeCanvas::HIDE_PREFIX) + if (flags & gfx::Canvas::HIDE_PREFIX) f |= DT_HIDEPREFIX; - else if ((flags & ChromeCanvas::SHOW_PREFIX) == 0) + else if ((flags & gfx::Canvas::SHOW_PREFIX) == 0) f |= DT_NOPREFIX; - if (flags & ChromeCanvas::MULTI_LINE) { + if (flags & gfx::Canvas::MULTI_LINE) { f |= DT_WORDBREAK; - if (flags & ChromeCanvas::CHARACTER_BREAK) + if (flags & gfx::Canvas::CHARACTER_BREAK) f |= DT_EDITCONTROL; } else { f |= DT_SINGLELINE | DT_VCENTER; - if (!(flags & ChromeCanvas::NO_ELLIPSIS)) + if (!(flags & gfx::Canvas::NO_ELLIPSIS)) f |= DT_END_ELLIPSIS; } // vertical alignment - if (flags & ChromeCanvas::TEXT_VALIGN_TOP) + if (flags & gfx::Canvas::TEXT_VALIGN_TOP) f |= DT_TOP; - else if (flags & ChromeCanvas::TEXT_VALIGN_BOTTOM) + else if (flags & gfx::Canvas::TEXT_VALIGN_BOTTOM) f |= DT_BOTTOM; else f |= DT_VCENTER; // horizontal alignment - if (flags & ChromeCanvas::TEXT_ALIGN_CENTER) + if (flags & gfx::Canvas::TEXT_ALIGN_CENTER) f |= DT_CENTER; - else if (flags & ChromeCanvas::TEXT_ALIGN_RIGHT) + else if (flags & gfx::Canvas::TEXT_ALIGN_RIGHT) f |= DT_RIGHT; else f |= DT_LEFT; @@ -117,20 +117,22 @@ int ComputeFormatFlags(int flags, const std::wstring& text) { } // anonymous namespace -ChromeCanvas::ChromeCanvas(int width, int height, bool is_opaque) +namespace gfx { + +Canvas::Canvas(int width, int height, bool is_opaque) : skia::PlatformCanvasWin(width, height, is_opaque) { } -ChromeCanvas::ChromeCanvas() : skia::PlatformCanvasWin() { +Canvas::Canvas() : skia::PlatformCanvasWin() { } -ChromeCanvas::~ChromeCanvas() { +Canvas::~Canvas() { } // static -void ChromeCanvas::SizeStringInt(const std::wstring& text, - const gfx::Font& font, - int *width, int *height, int flags) { +void Canvas::SizeStringInt(const std::wstring& text, + const gfx::Font& font, + int *width, int *height, int flags) { HDC dc = GetDC(NULL); HFONT old_font = static_cast<HFONT>(SelectObject(dc, font.hfont())); RECT b; @@ -153,9 +155,9 @@ void ChromeCanvas::SizeStringInt(const std::wstring& text, ReleaseDC(NULL, dc); } -void ChromeCanvas::DrawStringInt(const std::wstring& text, HFONT font, - const SkColor& color, int x, int y, int w, - int h, int flags) { +void Canvas::DrawStringInt(const std::wstring& text, HFONT font, + const SkColor& color, int x, int y, int w, int h, + int flags) { if (!IntersectsClipRectInt(x, y, w, h)) return; @@ -181,10 +183,10 @@ void ChromeCanvas::DrawStringInt(const std::wstring& text, HFONT font, getTopPlatformDevice().makeOpaque(x, y, w, h); } -void ChromeCanvas::DrawStringInt(const std::wstring& text, - const gfx::Font& font, - const SkColor& color, - int x, int y, int w, int h, int flags) { +void Canvas::DrawStringInt(const std::wstring& text, + const gfx::Font& font, + const SkColor& color, + int x, int y, int w, int h, int flags) { DrawStringInt(text, font.hfont(), color, x, y, w, h, flags); } @@ -215,19 +217,19 @@ static bool pixelShouldGetHalo(const SkBitmap& bitmap, int x, int y, return false; } -void ChromeCanvas::DrawStringWithHalo(const std::wstring& text, - const gfx::Font& font, - const SkColor& text_color, - const SkColor& halo_color_in, - int x, int y, int w, int h, - int flags) { +void Canvas::DrawStringWithHalo(const std::wstring& text, + const gfx::Font& font, + const SkColor& text_color, + const SkColor& halo_color_in, + int x, int y, int w, int h, + int flags) { // Some callers will have semitransparent halo colors, which we don't handle // (since the resulting image can have 1-bit transparency only). SkColor halo_color = halo_color_in | 0xFF000000; // Create a temporary buffer filled with the halo color. It must leave room // for the 1-pixel border around the text. - ChromeCanvas text_canvas(w + 2, h + 2, true); + Canvas text_canvas(w + 2, h + 2, true); SkPaint bkgnd_paint; bkgnd_paint.setColor(halo_color); text_canvas.FillRectInt(0, 0, w + 2, h + 2, bkgnd_paint); @@ -262,3 +264,5 @@ void ChromeCanvas::DrawStringWithHalo(const std::wstring& text, // Draw the halo bitmap with blur. drawBitmap(text_bitmap, SkIntToScalar(x - 1), SkIntToScalar(y - 1)); } + +} // namespace gfx diff --git a/app/gfx/chrome_font.h b/app/gfx/font.h index a4b14e9..bf759f75 100644 --- a/app/gfx/chrome_font.h +++ b/app/gfx/font.h @@ -111,7 +111,7 @@ class Font { // copied. static Font CreateFont(HFONT hfont); - // Returns the handle to the underlying HFONT. This is used by ChromeCanvas to + // Returns the handle to the underlying HFONT. This is used by gfx::Canvas to // draw text. HFONT hfont() const { return font_ref_->hfont(); } diff --git a/app/gfx/chrome_font_gtk.cc b/app/gfx/font_gtk.cc index babeff5..3b78d02 100644 --- a/app/gfx/chrome_font_gtk.cc +++ b/app/gfx/font_gtk.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 "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include <fontconfig/fontconfig.h> #include <gtk/gtk.h> diff --git a/app/gfx/chrome_font_mac.mm b/app/gfx/font_mac.mm index 885c3b1..b39ebea 100644 --- a/app/gfx/chrome_font_mac.mm +++ b/app/gfx/font_mac.mm @@ -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 "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include <Cocoa/Cocoa.h> diff --git a/app/gfx/chrome_font_skia.cc b/app/gfx/font_skia.cc index 9622a70..0b0b979 100644 --- a/app/gfx/chrome_font_skia.cc +++ b/app/gfx/font_skia.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 "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "base/logging.h" #include "base/sys_string_conversions.h" diff --git a/app/gfx/chrome_font_unittest.cc b/app/gfx/font_unittest.cc index 0bb840b4..3a13e2f6 100644 --- a/app/gfx/chrome_font_unittest.cc +++ b/app/gfx/font_unittest.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 "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/app/gfx/chrome_font_win.cc b/app/gfx/font_win.cc index 1cbe500..7323e9c 100644 --- a/app/gfx/chrome_font_win.cc +++ b/app/gfx/font_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 "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include <windows.h> #include <math.h> @@ -13,7 +13,6 @@ #include "base/logging.h" #include "base/win_util.h" #include "grit/generated_resources.h" -#include "grit/locale_settings.h" namespace gfx { diff --git a/app/gfx/icon_util.h b/app/gfx/icon_util.h index 9066df9..f7199ea 100644 --- a/app/gfx/icon_util.h +++ b/app/gfx/icon_util.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_COMMON_ICON_UTIL_H__ -#define CHROME_COMMON_ICON_UTIL_H__ +#ifndef APP_ICON_UTIL_H_ +#define APP_ICON_UTIL_H_ #include <windows.h> #include <string> @@ -190,4 +190,4 @@ class IconUtil { DISALLOW_IMPLICIT_CONSTRUCTORS(IconUtil); }; -#endif // CHROME_COMMON_ICON_UTIL_H__ +#endif // APP_ICON_UTIL_H_ diff --git a/app/gfx/insets.h b/app/gfx/insets.h index 741de3a2..a90e3a4 100644 --- a/app/gfx/insets.h +++ b/app/gfx/insets.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_COMMON_GFX_INSETS_H__ -#define CHROME_COMMON_GFX_INSETS_H__ +#ifndef APP_GFX_INSETS_H_ +#define APP_GFX_INSETS_H_ namespace gfx { @@ -66,4 +66,4 @@ class Insets { } // namespace -#endif // CHROME_COMMON_GFX_INSETS_H__ +#endif // APP_GFX_INSETS_H_ diff --git a/app/gfx/path.h b/app/gfx/path.h index ac7537c..9c70209 100644 --- a/app/gfx/path.h +++ b/app/gfx/path.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_COMMON_GFX_CHROME_PATH_H_ -#define CHROME_COMMON_GFX_CHROME_PATH_H_ +#ifndef APP_GFX_PATH_H_ +#define APP_GFX_PATH_H_ #include "base/basictypes.h" @@ -37,4 +37,4 @@ class Path : public SkPath { } -#endif // #ifndef CHROME_COMMON_GFX_CHROME_PATH_H_ +#endif // #ifndef APP_GFX_PATH_H_ diff --git a/app/gfx/text_elider.cc b/app/gfx/text_elider.cc index 93653e0..7568aef 100644 --- a/app/gfx/text_elider.cc +++ b/app/gfx/text_elider.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 "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "app/gfx/text_elider.h" #include "base/file_path.h" #include "base/string_util.h" diff --git a/app/gfx/text_elider.h b/app/gfx/text_elider.h index 5872ed4..c0d0be6 100644 --- a/app/gfx/text_elider.h +++ b/app/gfx/text_elider.h @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_COMMON_GFX_TEXT_ELIDER_H_ -#define CHROME_COMMON_GFX_TEXT_ELIDER_H_ +#ifndef APP_GFX_TEXT_ELIDER_H_ +#define APP_GFX_TEXT_ELIDER_H_ #include <unicode/coll.h> #include <unicode/uchar.h> -#include "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "base/basictypes.h" #include "base/string16.h" @@ -96,4 +96,4 @@ class SortedDisplayURL { } // namespace gfx. -#endif // CHROME_COMMON_GFX_TEXT_ELIDER_H_ +#endif // APP_GFX_TEXT_ELIDER_H_ diff --git a/app/gfx/text_elider_unittest.cc b/app/gfx/text_elider_unittest.cc index 28691d7..7887d68 100644 --- a/app/gfx/text_elider_unittest.cc +++ b/app/gfx/text_elider_unittest.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 "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "app/gfx/text_elider.h" #include "base/file_path.h" #include "base/string_util.h" diff --git a/app/l10n_util.cc b/app/l10n_util.cc index adbef03..611c21a 100644 --- a/app/l10n_util.cc +++ b/app/l10n_util.cc @@ -7,7 +7,7 @@ #include "app/l10n_util.h" #include "app/app_switches.h" -#include "app/gfx/chrome_canvas.h" +#include "app/gfx/canvas.h" #include "app/resource_bundle.h" #include "base/command_line.h" #include "base/file_util.h" @@ -611,9 +611,9 @@ void WrapPathWithLTRFormatting(const FilePath& path, int DefaultCanvasTextAlignment() { if (GetTextDirection() == LEFT_TO_RIGHT) { - return ChromeCanvas::TEXT_ALIGN_LEFT; + return gfx::Canvas::TEXT_ALIGN_LEFT; } else { - return ChromeCanvas::TEXT_ALIGN_RIGHT; + return gfx::Canvas::TEXT_ALIGN_RIGHT; } } diff --git a/app/l10n_util.h b/app/l10n_util.h index aafd658..bbf04eb 100644 --- a/app/l10n_util.h +++ b/app/l10n_util.h @@ -188,12 +188,12 @@ void WrapPathWithLTRFormatting(const FilePath& path, string16* rtl_safe_path); // Returns the default text alignment to be used when drawing text on a -// ChromeCanvas based on the directionality of the system locale language. This -// function is used by ChromeCanvas::DrawStringInt when the text alignment is +// gfx::Canvas based on the directionality of the system locale language. This +// function is used by gfx::Canvas::DrawStringInt when the text alignment is // not specified. // -// This function returns either ChromeCanvas::TEXT_ALIGN_LEFT or -// ChromeCanvas::TEXT_ALIGN_RIGHT. +// This function returns either gfx::Canvas::TEXT_ALIGN_LEFT or +// gfx::Canvas::TEXT_ALIGN_RIGHT. int DefaultCanvasTextAlignment(); // Compares the two strings using the specified collator. diff --git a/app/resource_bundle.cc b/app/resource_bundle.cc index 96bc714..2ee2243 100644 --- a/app/resource_bundle.cc +++ b/app/resource_bundle.cc @@ -4,7 +4,7 @@ #include "app/resource_bundle.h" -#include "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "base/gfx/png_decoder.h" #include "base/logging.h" #include "base/string_piece.h" diff --git a/app/resource_bundle_linux.cc b/app/resource_bundle_linux.cc index 2d47ae5..6f4b43f 100644 --- a/app/resource_bundle_linux.cc +++ b/app/resource_bundle_linux.cc @@ -6,7 +6,7 @@ #include <gtk/gtk.h> -#include "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "app/gfx/gtk_util.h" #include "app/l10n_util.h" #include "base/base_paths.h" diff --git a/app/resource_bundle_mac.mm b/app/resource_bundle_mac.mm index 710364b..f8aab45 100644 --- a/app/resource_bundle_mac.mm +++ b/app/resource_bundle_mac.mm @@ -6,7 +6,7 @@ #import <Foundation/Foundation.h> -#include "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "app/l10n_util.h" #include "base/base_paths.h" #include "base/data_pack.h" diff --git a/app/resource_bundle_win.cc b/app/resource_bundle_win.cc index f65ee2b..1d0d28f 100644 --- a/app/resource_bundle_win.cc +++ b/app/resource_bundle_win.cc @@ -6,7 +6,7 @@ #include <atlbase.h> -#include "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "app/l10n_util.h" #include "base/file_util.h" #include "base/logging.h" diff --git a/app/win_util.h b/app/win_util.h index 2b5bdce..19bbba7 100644 --- a/app/win_util.h +++ b/app/win_util.h @@ -10,7 +10,7 @@ #include <string> #include <vector> -#include "app/gfx/chrome_font.h" +#include "app/gfx/font.h" #include "base/fix_wp64.h" #include "base/gfx/rect.h" #include "base/scoped_handle.h" |