Index: ui/gfx/canvas_skia_win.cc |
=================================================================== |
--- ui/gfx/canvas_skia_win.cc (revision 85672) |
+++ ui/gfx/canvas_skia_win.cc (working copy) |
@@ -138,7 +138,7 @@ |
// Changes the alpha of the given bitmap. |
// If |fade_to_right| is true then the rect fades from opaque to clear, |
// otherwise the rect fades from clear to opaque. |
-void FadeBitmapRect(skia::BitmapPlatformDevice& bmp_device, |
+void FadeBitmapRect(SkDevice& bmp_device, |
const gfx::Rect& rect, |
bool fade_to_right) { |
SkBitmap bmp = bmp_device.accessBitmap(true); |
@@ -164,14 +164,14 @@ |
// this function draws black on white. It then uses the intensity of black |
// to determine how much alpha to use. The text is drawn in |gfx_text_rect| and |
// clipped to |gfx_draw_rect|. |
-void DrawTextAndClearBackground(skia::BitmapPlatformDevice& bmp_device, |
+void DrawTextAndClearBackground(SkDevice& bmp_device, |
HFONT font, |
COLORREF text_color, |
const string16& text, |
int flags, |
const gfx::Rect& gfx_text_rect, |
const gfx::Rect& gfx_draw_rect) { |
- HDC hdc = bmp_device.BeginPlatformPaint(); |
+ HDC hdc = skia::BeginPlatformPaint(&bmp_device); |
// Clear the background by filling with white. |
HBRUSH fill_brush = static_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)); |
@@ -218,14 +218,14 @@ |
} |
} |
- bmp_device.EndPlatformPaint(); |
+ skia::EndPlatformPaint(&bmp_device); |
} |
// Draws the given text with a fade out gradient. |bmp_device| is a bitmap |
// that is used to temporary drawing. The text is drawn in |text_rect| and |
// clipped to |draw_rect|. |
void DrawTextGradientPart(HDC hdc, |
- skia::BitmapPlatformDevice& bmp_device, |
+ SkDevice& bmp_device, |
const string16& text, |
const SkColor& color, |
HFONT font, |
@@ -238,11 +238,11 @@ |
FadeBitmapRect(bmp_device, draw_rect, fade_to_right); |
BLENDFUNCTION blend = {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA}; |
- HDC bmp_hdc = bmp_device.BeginPlatformPaint(); |
+ HDC bmp_hdc = skia::BeginPlatformPaint(&bmp_device); |
AlphaBlend(hdc, draw_rect.x(), draw_rect.y(), draw_rect.width(), |
draw_rect.height(), bmp_hdc, draw_rect.x(), draw_rect.y(), |
draw_rect.width(), draw_rect.height(), blend); |
- bmp_device.EndPlatformPaint(); |
+ skia::EndPlatformPaint(&bmp_device); |
} |
enum PrimarySide { |
@@ -347,7 +347,7 @@ |
const int kMaxStringLength = 32768 - 1; // So the trailing \0 fits in 32K. |
string16 clamped_string(text.substr(0, kMaxStringLength)); |
- HDC dc = beginPlatformPaint(); |
+ HDC dc = skia::BeginPlatformPaint(this); |
SetBkMode(dc, TRANSPARENT); |
HFONT old_font = (HFONT)SelectObject(dc, font); |
COLORREF brush_color = RGB(SkColorGetR(color), SkColorGetG(color), |
@@ -356,7 +356,7 @@ |
int f = ComputeFormatFlags(flags, clamped_string); |
DoDrawText(dc, clamped_string, &text_bounds, f); |
- endPlatformPaint(); |
+ skia::EndPlatformPaint(this); |
// Restore the old font. This way we don't have to worry if the caller |
// deletes the font and the DC lives longer. |
@@ -365,8 +365,8 @@ |
// Windows will have cleared the alpha channel of the text we drew. Assume |
// we're drawing to an opaque surface, or at least the text rect area is |
// opaque. |
- getTopPlatformDevice().makeOpaque(clip.fLeft, clip.fTop, |
- clip.width(), clip.height()); |
+ skia::MakeOpaque(&getTopDevice(), clip.fLeft, clip.fTop, clip.width(), |
+ clip.height()); |
} |
void CanvasSkia::DrawStringInt(const string16& text, |
@@ -430,11 +430,11 @@ |
// opaque. We have to do this first since pixelShouldGetHalo will check for |
// 0 to see if a pixel has been modified to transparent, and black text that |
// Windows draw will look transparent to it! |
- text_canvas.getTopPlatformDevice().makeOpaque(0, 0, w + 2, h + 2); |
+ skia::MakeOpaque(&text_canvas.getTopDevice(), 0, 0, w + 2, h + 2); |
uint32_t halo_premul = SkPreMultiplyColor(halo_color); |
SkBitmap& text_bitmap = const_cast<SkBitmap&>( |
- text_canvas.getTopPlatformDevice().accessBitmap(true)); |
+ text_canvas.getTopDevice().accessBitmap(true)); |
for (int cur_y = 0; cur_y < h + 2; cur_y++) { |
uint32_t* text_row = text_bitmap.getAddr32(0, cur_y); |
for (int cur_x = 0; cur_x < w + 2; cur_x++) { |
@@ -553,12 +553,12 @@ |
text_rect.set_width(text_rect.width() + offset_x); |
// Create a temporary bitmap to draw the gradient to. |
- scoped_ptr<skia::BitmapPlatformDevice> gradient_bitmap( |
+ scoped_ptr<SkDevice> gradient_bitmap( |
skia::BitmapPlatformDevice::create( |
display_rect.width(), display_rect.height(), false, NULL)); |
DCHECK(gradient_bitmap.get()); |
- HDC hdc = beginPlatformPaint(); |
+ HDC hdc = skia::BeginPlatformPaint(this); |
if (is_truncating_head) |
DrawTextGradientPart(hdc, *gradient_bitmap, text, color, |
font.GetNativeFont(), text_rect, head_part, is_rtl, |
@@ -567,7 +567,7 @@ |
DrawTextGradientPart(hdc, *gradient_bitmap, text, color, |
font.GetNativeFont(), text_rect, tail_part, !is_rtl, |
flags); |
- endPlatformPaint(); |
+ skia::EndPlatformPaint(this); |
// Draw the solid part. |
save(kClip_SaveFlag); |