Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: ui/gfx/canvas_skia_linux.cc

Issue 6879013: skia::PlatformCanvas is being deprecated. Going forward we will use gfx::Canvas wherever we need ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/canvas_skia.cc ('k') | ui/gfx/canvas_skia_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ui/gfx/canvas_skia.cc ('k') | ui/gfx/canvas_skia_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698