Index: ui/gfx/canvas_skia_linux.cc |
=================================================================== |
--- ui/gfx/canvas_skia_linux.cc (revision 82144) |
+++ ui/gfx/canvas_skia_linux.cc (working copy) |
@@ -11,6 +11,7 @@ |
#include "base/logging.h" |
#include "base/utf_string_conversions.h" |
+#include "ui/gfx/blit.h" |
#include "ui/gfx/font.h" |
#include "ui/gfx/gtk_util.h" |
#include "ui/gfx/platform_font_gtk.h" |
@@ -208,7 +209,7 @@ |
text_height_(0) { |
DCHECK(!bounds_.IsEmpty()); |
- cr_ = canvas_->beginPlatformPaint(); |
+ cr_ = canvas_->BeginPlatformPaint(); |
layout_ = pango_cairo_create_layout(cr_); |
SetupPangoLayout(layout_, text, font, bounds_.width(), flags_); |
@@ -262,11 +263,12 @@ |
void DrawStringContext::DrawWithHalo(const SkColor& text_color, |
const SkColor& halo_color) { |
- gfx::CanvasSkia text_canvas(bounds_.width() + 2, bounds_.height() + 2, false); |
+ gfx::CanvasSkia text_canvas; |
+ text_canvas.Init(bounds_.width() + 2, bounds_.height() + 2, false); |
text_canvas.FillRectInt(static_cast<SkColor>(0), |
0, 0, bounds_.width() + 2, bounds_.height() + 2); |
- cairo_t* text_cr = text_canvas.beginPlatformPaint(); |
+ cairo_t* text_cr = text_canvas.BeginPlatformPaint(); |
cairo_move_to(text_cr, 2, 1); |
pango_cairo_layout_path(text_cr, layout_); |
@@ -288,10 +290,10 @@ |
SkColorGetA(text_color) / 255.0); |
cairo_fill(text_cr); |
- text_canvas.endPlatformPaint(); |
+ text_canvas.EndPlatformPaint(); |
const SkBitmap& text_bitmap = const_cast<SkBitmap&>( |
- text_canvas.getTopPlatformDevice().accessBitmap(false)); |
+ text_canvas.skia_canvas()->getTopDevice()->accessBitmap(false)); |
canvas_->DrawBitmapInt(text_bitmap, text_x_ - 1, text_y_ - 1); |
} |
@@ -299,16 +301,6 @@ |
namespace gfx { |
-CanvasSkia::CanvasSkia(int width, int height, bool is_opaque) |
- : skia::PlatformCanvas(width, height, is_opaque) { |
-} |
- |
-CanvasSkia::CanvasSkia() : skia::PlatformCanvas() { |
-} |
- |
-CanvasSkia::~CanvasSkia() { |
-} |
- |
// static |
void CanvasSkia::SizeStringInt(const string16& text, |
const gfx::Font& font, |
@@ -379,7 +371,7 @@ |
return; |
} |
- cairo_t* cr = beginPlatformPaint(); |
+ cairo_t* cr = BeginPlatformPaint(); |
gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y); |
cairo_paint(cr); |
} |
@@ -389,4 +381,15 @@ |
return 0; |
} |
+void CanvasSkia::BlitToNativeContext(const Rect& src_rect, |
+ const Point& dst_origin, |
+ NativeDrawingContext dst_context) { |
+ BlitContextToContext( |
+ dst_context, |
+ Rect(dst_origin, src_rect.size()), |
+ BeginPlatformPaint(), |
+ src_rect.origin()); |
+ EndPlatformPaint(); |
+} |
+ |
} // namespace gfx |