diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gfx/canvas.cc | 2 | ||||
-rw-r--r-- | ui/gfx/canvas.h | 12 | ||||
-rw-r--r-- | ui/gfx/canvas_direct2d.cc | 8 | ||||
-rw-r--r-- | ui/gfx/canvas_direct2d.h | 6 | ||||
-rw-r--r-- | ui/gfx/canvas_direct2d_unittest.cc | 14 | ||||
-rw-r--r-- | ui/gfx/canvas_skia.cc | 8 | ||||
-rw-r--r-- | ui/gfx/canvas_skia.h | 7 | ||||
-rw-r--r-- | ui/gfx/canvas_skia_win.cc | 4 | ||||
-rw-r--r-- | ui/gfx/compositor/layer.cc | 6 | ||||
-rw-r--r-- | ui/gfx/render_text.cc | 2 | ||||
-rw-r--r-- | ui/gfx/render_text_linux.h | 2 | ||||
-rw-r--r-- | ui/gfx/render_text_win.h | 2 | ||||
-rw-r--r-- | ui/gfx/skia_util.h | 6 | ||||
-rw-r--r-- | ui/gfx/win_util.h | 3 |
14 files changed, 38 insertions, 44 deletions
diff --git a/ui/gfx/canvas.cc b/ui/gfx/canvas.cc index 2ac1718..619f93f 100644 --- a/ui/gfx/canvas.cc +++ b/ui/gfx/canvas.cc @@ -22,4 +22,4 @@ const SkCanvas* Canvas::GetSkCanvas() const { return NULL; } -} // namespace gfx; +} // namespace gfx diff --git a/ui/gfx/canvas.h b/ui/gfx/canvas.h index 33b9f4e..189aeb4 100644 --- a/ui/gfx/canvas.h +++ b/ui/gfx/canvas.h @@ -19,7 +19,6 @@ class SkCanvas; namespace ui { class Transform; - typedef unsigned int TextureID; } @@ -99,17 +98,12 @@ class UI_EXPORT Canvas { // call Restore() more times than Save*(). virtual void Restore() = 0; - // Wrapper function that takes integer arguments. // Returns true if the clip is non-empty. - // See clipRect for specifics. - virtual bool ClipRectInt(const gfx::Rect& rect) = 0; + virtual bool ClipRect(const gfx::Rect& rect) = 0; - // Wrapper function that takes integer arguments. - // See translate() for specifics. - virtual void TranslateInt(int x, int y) = 0; + virtual void Translate(const gfx::Point& point) = 0; // Wrapper function that takes integer arguments. - // See scale() for specifics. virtual void ScaleInt(int x, int y) = 0; // Fills the specified region with the specified color using a transfer @@ -257,6 +251,6 @@ class UI_EXPORT CanvasPaint { virtual Canvas* AsCanvas() = 0; }; -} // namespace gfx; +} // namespace gfx #endif // UI_GFX_CANVAS_H_ diff --git a/ui/gfx/canvas_direct2d.cc b/ui/gfx/canvas_direct2d.cc index f824b4d..a1b3a9f 100644 --- a/ui/gfx/canvas_direct2d.cc +++ b/ui/gfx/canvas_direct2d.cc @@ -173,7 +173,7 @@ void CanvasDirect2D::Restore() { rt_->RestoreDrawingState(drawing_state_block_); } -bool CanvasDirect2D::ClipRectInt(const gfx::Rect& rect) { +bool CanvasDirect2D::ClipRect(const gfx::Rect& rect) { rt_->PushAxisAlignedClip(RectToRectF(rect), D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); // Increment the clip count so the call to PushAxisAlignedClip() can be @@ -182,13 +182,13 @@ bool CanvasDirect2D::ClipRectInt(const gfx::Rect& rect) { return !rect.IsEmpty(); } -void CanvasDirect2D::TranslateInt(int x, int y) { +void CanvasDirect2D::Translate(const gfx::Point& point) { D2D1_MATRIX_3X2_F raw; rt_->GetTransform(&raw); D2D1::Matrix3x2F transform(raw._11, raw._12, raw._21, raw._22, raw._31, raw._32); - transform = D2D1::Matrix3x2F::Translation(static_cast<float>(x), - static_cast<float>(y)) * transform; + transform = D2D1::Matrix3x2F::Translation( + static_cast<float>(point.x()), static_cast<float>(point.y())) * transform; rt_->SetTransform(transform); } diff --git a/ui/gfx/canvas_direct2d.h b/ui/gfx/canvas_direct2d.h index e5a8aadf..75c424c 100644 --- a/ui/gfx/canvas_direct2d.h +++ b/ui/gfx/canvas_direct2d.h @@ -31,8 +31,8 @@ class UI_EXPORT CanvasDirect2D : public Canvas { virtual void SaveLayerAlpha(uint8 alpha, const gfx::Rect& layer_bounds) OVERRIDE; virtual void Restore() OVERRIDE; - virtual bool ClipRectInt(const gfx::Rect& rect) OVERRIDE; - virtual void TranslateInt(int x, int y) OVERRIDE; + virtual bool ClipRect(const gfx::Rect& rect) OVERRIDE; + virtual void Translate(const gfx::Point& point) OVERRIDE; virtual void ScaleInt(int x, int y) OVERRIDE; virtual void FillRectInt(const SkColor& color, int x, int y, int w, int h) OVERRIDE; @@ -117,6 +117,6 @@ class UI_EXPORT CanvasDirect2D : public Canvas { DISALLOW_COPY_AND_ASSIGN(CanvasDirect2D); }; -} // namespace gfx; +} // namespace gfx #endif // UI_GFX_CANVAS_DIRECT2D_H_ diff --git a/ui/gfx/canvas_direct2d_unittest.cc b/ui/gfx/canvas_direct2d_unittest.cc index 61fc66b..db57990 100644 --- a/ui/gfx/canvas_direct2d_unittest.cc +++ b/ui/gfx/canvas_direct2d_unittest.cc @@ -220,7 +220,7 @@ TEST(CanvasDirect2D, ClipRect) { gfx::CanvasDirect2D canvas(window.rt()); canvas.FillRectInt(SK_ColorGREEN, 0, 0, 500, 500); - canvas.ClipRectInt(gfx::Rect(20, 20, 120, 120)); + canvas.ClipRect(gfx::Rect(20, 20, 120, 120)); canvas.FillRectInt(SK_ColorBLUE, 0, 0, 500, 500); } @@ -233,14 +233,14 @@ TEST(CanvasDirect2D, ClipRectWithTranslate) { // Repeat the same rendering as in ClipRect... canvas.Save(); canvas.FillRectInt(SK_ColorGREEN, 0, 0, 500, 500); - canvas.ClipRectInt(gfx::Rect(20, 20, 120, 120)); + canvas.ClipRect(gfx::Rect(20, 20, 120, 120)); canvas.FillRectInt(SK_ColorBLUE, 0, 0, 500, 500); canvas.Restore(); // ... then translate, clip and fill again relative to the new origin. canvas.Save(); - canvas.TranslateInt(150, 150); - canvas.ClipRectInt(gfx::Rect(10, 10, 110, 110)); + canvas.Translate(gfx::Point(150, 150)); + canvas.ClipRect(gfx::Rect(10, 10, 110, 110)); canvas.FillRectInt(SK_ColorRED, 0, 0, 500, 500); canvas.Restore(); } @@ -254,16 +254,16 @@ TEST(CanvasDirect2D, ClipRectWithScale) { // Repeat the same rendering as in ClipRect... canvas.Save(); canvas.FillRectInt(SK_ColorGREEN, 0, 0, 500, 500); - canvas.ClipRectInt(gfx::Rect(20, 20, 120, 120)); + canvas.ClipRect(gfx::Rect(20, 20, 120, 120)); canvas.FillRectInt(SK_ColorBLUE, 0, 0, 500, 500); canvas.Restore(); // ... then translate and scale, clip and fill again relative to the new // origin. canvas.Save(); - canvas.TranslateInt(150, 150); + canvas.Translate(gfx::Point(150, 150)); canvas.ScaleInt(2, 2); - canvas.ClipRectInt(gfx::Rect(10, 10, 110, 110)); + canvas.ClipRect(gfx::Rect(10, 10, 110, 110)); canvas.FillRectInt(SK_ColorRED, 0, 0, 500, 500); canvas.Restore(); } diff --git a/ui/gfx/canvas_skia.cc b/ui/gfx/canvas_skia.cc index bf87434..6550073 100644 --- a/ui/gfx/canvas_skia.cc +++ b/ui/gfx/canvas_skia.cc @@ -110,12 +110,12 @@ void CanvasSkia::Restore() { canvas_->restore(); } -bool CanvasSkia::ClipRectInt(const gfx::Rect& rect) { +bool CanvasSkia::ClipRect(const gfx::Rect& rect) { return canvas_->clipRect(gfx::RectToSkRect(rect)); } -void CanvasSkia::TranslateInt(int x, int y) { - canvas_->translate(SkIntToScalar(x), SkIntToScalar(y)); +void CanvasSkia::Translate(const gfx::Point& point) { + canvas_->translate(SkIntToScalar(point.x()), SkIntToScalar(point.y())); } void CanvasSkia::ScaleInt(int x, int y) { @@ -334,7 +334,7 @@ void CanvasSkia::TileImageInt(const SkBitmap& bitmap, canvas_->save(); canvas_->translate(SkIntToScalar(dest_x - src_x), SkIntToScalar(dest_y - src_y)); - ClipRectInt(gfx::Rect(src_x, src_y, w, h)); + ClipRect(gfx::Rect(src_x, src_y, w, h)); canvas_->drawPaint(paint); canvas_->restore(); } diff --git a/ui/gfx/canvas_skia.h b/ui/gfx/canvas_skia.h index e3d44cd..5bf2318 100644 --- a/ui/gfx/canvas_skia.h +++ b/ui/gfx/canvas_skia.h @@ -100,8 +100,8 @@ class UI_EXPORT CanvasSkia : public Canvas { virtual void SaveLayerAlpha(uint8 alpha, const gfx::Rect& layer_bounds) OVERRIDE; virtual void Restore() OVERRIDE; - virtual bool ClipRectInt(const gfx::Rect& rect) OVERRIDE; - virtual void TranslateInt(int x, int y) OVERRIDE; + virtual bool ClipRect(const gfx::Rect& rect) OVERRIDE; + virtual void Translate(const gfx::Point& point) OVERRIDE; virtual void ScaleInt(int x, int y) OVERRIDE; virtual void FillRectInt(const SkColor& color, int x, int y, int w, int h) OVERRIDE; @@ -196,9 +196,10 @@ class UI_EXPORT CanvasSkia : public Canvas { scoped_ptr<skia::PlatformCanvas> owned_canvas_; SkCanvas* canvas_; + DISALLOW_COPY_AND_ASSIGN(CanvasSkia); }; -} // namespace gfx; +} // namespace gfx #endif // UI_GFX_CANVAS_SKIA_H_ diff --git a/ui/gfx/canvas_skia_win.cc b/ui/gfx/canvas_skia_win.cc index 68deb73..1c45368 100644 --- a/ui/gfx/canvas_skia_win.cc +++ b/ui/gfx/canvas_skia_win.cc @@ -532,7 +532,7 @@ void CanvasSkia::DrawFadeTruncatingString( // Move the origin to |display_rect.origin()|. This simplifies all the // drawing so that both the source and destination can be (0,0). canvas_->save(SkCanvas::kMatrix_SaveFlag); - TranslateInt(display_rect.x(), display_rect.y()); + Translate(display_rect.origin()); gfx::Rect solid_part(gfx::Point(), display_rect.size()); gfx::Rect head_part; @@ -569,7 +569,7 @@ void CanvasSkia::DrawFadeTruncatingString( // Draw the solid part. canvas_->save(SkCanvas::kClip_SaveFlag); - ClipRectInt(solid_part); + ClipRect(solid_part); DrawStringInt(text, font, color, text_rect.x(), text_rect.y(), text_rect.width(), text_rect.height(), diff --git a/ui/gfx/compositor/layer.cc b/ui/gfx/compositor/layer.cc index b949cf9..2868f4d 100644 --- a/ui/gfx/compositor/layer.cc +++ b/ui/gfx/compositor/layer.cc @@ -8,8 +8,8 @@ #include "base/logging.h" #include "base/memory/scoped_ptr.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebExternalTextureLayer.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebContentLayer.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebExternalTextureLayer.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFloatPoint.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFloatRect.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" @@ -17,8 +17,8 @@ #if defined(USE_WEBKIT_COMPOSITOR) #include "ui/gfx/compositor/compositor_cc.h" #endif -#include "ui/gfx/compositor/layer_animation_manager.h" #include "ui/gfx/canvas_skia.h" +#include "ui/gfx/compositor/layer_animation_manager.h" #include "ui/gfx/interpolated_transform.h" #include "ui/gfx/point3.h" @@ -417,7 +417,7 @@ void Layer::UpdateLayerCanvas() { } scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvas( draw_rect.width(), draw_rect.height(), false)); - canvas->TranslateInt(-draw_rect.x(), -draw_rect.y()); + canvas->Translate(gfx::Point().Subtract(draw_rect.origin())); delegate_->OnPaintLayer(canvas.get()); SetCanvas(*canvas->GetSkCanvas(), draw_rect.origin()); #endif diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc index ec2b24e..503fffc 100644 --- a/ui/gfx/render_text.cc +++ b/ui/gfx/render_text.cc @@ -341,7 +341,7 @@ int RenderText::GetStringWidth() { void RenderText::Draw(Canvas* canvas) { // Clip the canvas to the text display area. - canvas->ClipRectInt(display_rect_); + canvas->ClipRect(display_rect_); // Draw the selection. std::vector<Rect> selection(GetSubstringBounds(GetSelectionStart(), diff --git a/ui/gfx/render_text_linux.h b/ui/gfx/render_text_linux.h index 497a47c..217b43a 100644 --- a/ui/gfx/render_text_linux.h +++ b/ui/gfx/render_text_linux.h @@ -118,6 +118,6 @@ class RenderTextLinux : public RenderText { DISALLOW_COPY_AND_ASSIGN(RenderTextLinux); }; -} // namespace gfx; +} // namespace gfx #endif // UI_GFX_RENDER_TEXT_LINUX_H_ diff --git a/ui/gfx/render_text_win.h b/ui/gfx/render_text_win.h index b3673664..2491b62 100644 --- a/ui/gfx/render_text_win.h +++ b/ui/gfx/render_text_win.h @@ -123,6 +123,6 @@ class RenderTextWin : public RenderText { DISALLOW_COPY_AND_ASSIGN(RenderTextWin); }; -} // namespace gfx; +} // namespace gfx #endif // UI_GFX_RENDER_TEXT_WIN_H_ diff --git a/ui/gfx/skia_util.h b/ui/gfx/skia_util.h index 0b43a4c..a9312ef 100644 --- a/ui/gfx/skia_util.h +++ b/ui/gfx/skia_util.h @@ -46,9 +46,9 @@ UI_EXPORT bool BitmapsAreEqual(const SkBitmap& bitmap1, // there was none. UI_EXPORT string16 RemoveAcceleratorChar(const string16& s, char16 accelerator_char, - int *accelerated_char_pos, - int *accelerated_char_span); + int* accelerated_char_pos, + int* accelerated_char_span); -} // namespace gfx; +} // namespace gfx #endif // UI_GFX_SKIA_UTIL_H_ diff --git a/ui/gfx/win_util.h b/ui/gfx/win_util.h index 67074d0..619097f 100644 --- a/ui/gfx/win_util.h +++ b/ui/gfx/win_util.h @@ -16,7 +16,6 @@ UI_EXPORT bool Direct2dIsAvailable(); // Returns true if DirectWrite is available, false otherwise. bool DirectWriteIsAvailable(); -} // namespace gfx; +} // namespace gfx #endif // UI_GFX_WIN_UTIL_H_ - |