diff options
Diffstat (limited to 'chrome/browser')
10 files changed, 41 insertions, 43 deletions
diff --git a/chrome/browser/aeropeek_manager.cc b/chrome/browser/aeropeek_manager.cc index 79107e1..e81ea50 100644 --- a/chrome/browser/aeropeek_manager.cc +++ b/chrome/browser/aeropeek_manager.cc @@ -1244,7 +1244,7 @@ bool AeroPeekManager::GetTabPreview(int tab_id, SkBitmap* preview) { &canvas)) return false; - const SkBitmap& bitmap = skia::GetTopDevice(canvas)->accessBitmap(false); + const SkBitmap& bitmap = canvas.getTopPlatformDevice().accessBitmap(false); bitmap.copyTo(preview, SkBitmap::kARGB_8888_Config); return true; } diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc index 2bb87d9..139d55b 100644 --- a/chrome/browser/extensions/extension_tabs_module.cc +++ b/chrome/browser/extensions/extension_tabs_module.cc @@ -1205,7 +1205,7 @@ bool CaptureVisibleTabFunction::CaptureSnapshotFromBackingStore( VLOG(1) << "captureVisibleTab() got image from backing store."; SendResultFromBitmap( - skia::GetTopDevice(temp_canvas)->accessBitmap(false)); + temp_canvas.getTopPlatformDevice().accessBitmap(false)); return true; } diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index b8e12cf..407bc1d3 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -169,22 +169,20 @@ void DrawDeemphasized(const SkColor& color, HDC backing_store_dc, HDC paint_dc) { gfx::CanvasSkia canvas(paint_rect.width(), paint_rect.height(), true); - { - skia::ScopedPlatformPaint scoped_platform_paint(&canvas); - HDC dc = scoped_platform_paint.GetPlatformSurface(); - BitBlt(dc, - 0, - 0, - paint_rect.width(), - paint_rect.height(), - backing_store_dc, - paint_rect.x(), - paint_rect.y(), - SRCCOPY); - } + HDC dc = canvas.beginPlatformPaint(); + BitBlt(dc, + 0, + 0, + paint_rect.width(), + paint_rect.height(), + backing_store_dc, + paint_rect.x(), + paint_rect.y(), + SRCCOPY); + canvas.endPlatformPaint(); canvas.FillRectInt(color, 0, 0, paint_rect.width(), paint_rect.height()); - skia::DrawToNativeContext(&canvas, paint_dc, paint_rect.x(), - paint_rect.y(), NULL); + canvas.getTopPlatformDevice().drawToHDC(paint_dc, paint_rect.x(), + paint_rect.y(), NULL); } // The plugin wrapper window which lives in the browser process has this proc @@ -963,8 +961,8 @@ void RenderWidgetHostViewWin::DrawBackground(const RECT& dirty_rect, dc_rect.right - dc_rect.left, dc_rect.bottom - dc_rect.top); - skia::DrawToNativeContext(&canvas, *dc, dirty_rect.left, dirty_rect.top, - NULL); + canvas.getTopPlatformDevice().drawToHDC(*dc, dirty_rect.left, + dirty_rect.top, NULL); } else { HBRUSH white_brush = reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)); dc->FillRect(&dirty_rect, white_brush); diff --git a/chrome/browser/tab_contents/thumbnail_generator.cc b/chrome/browser/tab_contents/thumbnail_generator.cc index 257d2bd..76e15ca 100644 --- a/chrome/browser/tab_contents/thumbnail_generator.cc +++ b/chrome/browser/tab_contents/thumbnail_generator.cc @@ -21,6 +21,7 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_service.h" #include "googleurl/src/gurl.h" +#include "skia/ext/bitmap_platform_device.h" #include "skia/ext/image_operations.h" #include "skia/ext/platform_canvas.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -79,7 +80,7 @@ SkBitmap GetBitmapForBackingStore( if (!backing_store->CopyFromBackingStore(gfx::Rect(backing_store->size()), &temp_canvas)) return result; - const SkBitmap& bmp = skia::GetTopDevice(temp_canvas)->accessBitmap(false); + const SkBitmap& bmp = temp_canvas.getTopPlatformDevice().accessBitmap(false); // Check if a clipped thumbnail is requested. if (options & ThumbnailGenerator::kClippedThumbnail) { diff --git a/chrome/browser/tab_contents/thumbnail_generator_unittest.cc b/chrome/browser/tab_contents/thumbnail_generator_unittest.cc index 1c8ba8c..93a43f2 100644 --- a/chrome/browser/tab_contents/thumbnail_generator_unittest.cc +++ b/chrome/browser/tab_contents/thumbnail_generator_unittest.cc @@ -103,11 +103,11 @@ class ThumbnailGeneratorTest : public testing::Test { transport_dib_->GetPlatformCanvas(kBitmapWidth, kBitmapHeight)); switch (type) { case TRANSPORT_BLACK: - skia::GetTopDevice(*canvas)->accessBitmap(true).eraseARGB( + canvas->getTopPlatformDevice().accessBitmap(true).eraseARGB( 0xFF, 0, 0, 0); break; case TRANSPORT_WHITE: - skia::GetTopDevice(*canvas)->accessBitmap(true).eraseARGB( + canvas->getTopPlatformDevice().accessBitmap(true).eraseARGB( 0xFF, 0xFF, 0xFF, 0xFF); break; case TRANSPORT_OTHER: @@ -211,7 +211,7 @@ TEST(ThumbnailGeneratorSimpleTest, CalculateBoringScore_SingleColor) { // Fill all pixesl in black. canvas.FillRectInt(kBlack, 0, 0, kSize.width(), kSize.height()); - SkBitmap bitmap = skia::GetTopDevice(canvas)->accessBitmap(false); + SkBitmap bitmap = canvas.getTopPlatformDevice().accessBitmap(false); // The thumbnail should deserve the highest boring score. EXPECT_DOUBLE_EQ(1.0, ThumbnailGenerator::CalculateBoringScore(&bitmap)); } @@ -227,7 +227,7 @@ TEST(ThumbnailGeneratorSimpleTest, CalculateBoringScore_TwoColors) { // Fill the left half pixels in white. canvas.FillRectInt(kWhite, 0, 0, kSize.width() / 2, kSize.height()); - SkBitmap bitmap = skia::GetTopDevice(canvas)->accessBitmap(false); + SkBitmap bitmap = canvas.getTopPlatformDevice().accessBitmap(false); ASSERT_EQ(kSize.width(), bitmap.width()); ASSERT_EQ(kSize.height(), bitmap.height()); // The thumbnail should be less boring because two colors are used. @@ -237,7 +237,7 @@ TEST(ThumbnailGeneratorSimpleTest, CalculateBoringScore_TwoColors) { TEST(ThumbnailGeneratorSimpleTest, GetClippedBitmap_TallerThanWide) { // The input bitmap is vertically long. gfx::CanvasSkia canvas(40, 90, true); - const SkBitmap bitmap = skia::GetTopDevice(canvas)->accessBitmap(false); + const SkBitmap bitmap = canvas.getTopPlatformDevice().accessBitmap(false); // The desired size is square. ThumbnailGenerator::ClipResult clip_result = ThumbnailGenerator::kNotClipped; @@ -253,7 +253,7 @@ TEST(ThumbnailGeneratorSimpleTest, GetClippedBitmap_TallerThanWide) { TEST(ThumbnailGeneratorSimpleTest, GetClippedBitmap_WiderThanTall) { // The input bitmap is horizontally long. gfx::CanvasSkia canvas(90, 40, true); - const SkBitmap bitmap = skia::GetTopDevice(canvas)->accessBitmap(false); + const SkBitmap bitmap = canvas.getTopPlatformDevice().accessBitmap(false); // The desired size is square. ThumbnailGenerator::ClipResult clip_result = ThumbnailGenerator::kNotClipped; @@ -269,7 +269,7 @@ TEST(ThumbnailGeneratorSimpleTest, GetClippedBitmap_WiderThanTall) { TEST(ThumbnailGeneratorSimpleTest, GetClippedBitmap_NotClipped) { // The input bitmap is square. gfx::CanvasSkia canvas(40, 40, true); - const SkBitmap bitmap = skia::GetTopDevice(canvas)->accessBitmap(false); + const SkBitmap bitmap = canvas.getTopPlatformDevice().accessBitmap(false); // The desired size is square. ThumbnailGenerator::ClipResult clip_result = ThumbnailGenerator::kNotClipped; @@ -285,7 +285,7 @@ TEST(ThumbnailGeneratorSimpleTest, GetClippedBitmap_NotClipped) { TEST(ThumbnailGeneratorSimpleTest, GetClippedBitmap_NonSquareOutput) { // The input bitmap is square. gfx::CanvasSkia canvas(40, 40, true); - const SkBitmap bitmap = skia::GetTopDevice(canvas)->accessBitmap(false); + const SkBitmap bitmap = canvas.getTopPlatformDevice().accessBitmap(false); // The desired size is horizontally long. ThumbnailGenerator::ClipResult clip_result = ThumbnailGenerator::kNotClipped; diff --git a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc index 95336a1..9394154 100644 --- a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc @@ -655,8 +655,7 @@ SkBitmap TabRendererGtk::PaintBitmap() { cairo_surface_t* TabRendererGtk::PaintToSurface() { gfx::CanvasSkia canvas(width(), height(), false); Paint(&canvas); - return cairo_surface_reference(cairo_get_target( - skia::BeginPlatformPaint(&canvas))); + return cairo_surface_reference(cairo_get_target(canvas.beginPlatformPaint())); } void TabRendererGtk::SchedulePaint() { diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc index 70f6443..0817323 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc @@ -2315,7 +2315,7 @@ void OmniboxViewWin::DrawSlashForInsecureScheme(HDC hdc, } // Now copy what we drew to the target HDC. - skia::DrawToNativeContext(&canvas, hdc, + canvas.getTopPlatformDevice().drawToHDC(hdc, scheme_rect.left + canvas_paint_clip_rect.left - canvas_clip_rect.left, std::max(scheme_rect.top, client_rect.top) + canvas_paint_clip_rect.top - canvas_clip_rect.top, &canvas_paint_clip_rect); diff --git a/chrome/browser/ui/views/tabs/dragged_tab_view.cc b/chrome/browser/ui/views/tabs/dragged_tab_view.cc index b9bc63e..4689239 100644 --- a/chrome/browser/ui/views/tabs/dragged_tab_view.cc +++ b/chrome/browser/ui/views/tabs/dragged_tab_view.cc @@ -135,7 +135,7 @@ void DraggedTabView::PaintDetachedView(gfx::Canvas* canvas) { gfx::Size ps = GetPreferredSize(); gfx::CanvasSkia scale_canvas(ps.width(), ps.height(), false); SkBitmap& bitmap_device = const_cast<SkBitmap&>( - skia::GetTopDevice(scale_canvas)->accessBitmap(true)); + scale_canvas.getTopPlatformDevice().accessBitmap(true)); bitmap_device.eraseARGB(0, 0, 0, 0); int tab_height = renderer_bounds_.back().height(); diff --git a/chrome/browser/ui/views/tabs/native_view_photobooth_win.cc b/chrome/browser/ui/views/tabs/native_view_photobooth_win.cc index c545d44..4bfd3609 100644 --- a/chrome/browser/ui/views/tabs/native_view_photobooth_win.cc +++ b/chrome/browser/ui/views/tabs/native_view_photobooth_win.cc @@ -110,9 +110,9 @@ void NativeViewPhotoboothWin::PaintScreenshotIntoCanvas( SRCCOPY); // Windows screws up the alpha channel on all text it draws, and so we need // to call makeOpaque _after_ the blit to correct for this. - skia::MakeOpaque(canvas->AsCanvasSkia(), target_bounds.x(), - target_bounds.y(), target_bounds.width(), - target_bounds.height()); + canvas->AsCanvasSkia()->getTopPlatformDevice().makeOpaque( + target_bounds.x(), target_bounds.y(), target_bounds.width(), + target_bounds.height()); ReleaseDC(current_hwnd_, source_dc); canvas->EndPlatformPaint(); } diff --git a/chrome/browser/ui/views/theme_helpers.cc b/chrome/browser/ui/views/theme_helpers.cc index 1708049..4b0f6b3 100644 --- a/chrome/browser/ui/views/theme_helpers.cc +++ b/chrome/browser/ui/views/theme_helpers.cc @@ -9,6 +9,7 @@ #include <atltheme.h> #include "base/logging.h" +#include "skia/ext/bitmap_platform_device_win.h" #include "third_party/skia/include/effects/SkGradientShader.h" #include "ui/gfx/canvas_skia.h" @@ -31,10 +32,10 @@ void GetRebarGradientColors(int width, int x1, int x2, // On Windows XP+, if using a Theme, we can ask the theme to render the // gradient for us. if (!theme.IsThemeNull()) { - skia::ScopedPlatformPaint scoped_platform_paint(&canvas); - HDC dc = scoped_platform_paint.GetPlatformSurface(); + HDC dc = canvas.beginPlatformPaint(); RECT rect = { 0, 0, width, 1 }; theme.DrawThemeBackground(dc, 0, 0, &rect, NULL); + canvas.endPlatformPaint(); } else { // On Windows 2000 or Windows XP+ with the Classic theme selected, we need // to build our own gradient using system colors. @@ -63,12 +64,11 @@ void GetRebarGradientColors(int width, int x1, int x2, // Extract the color values from the selected pixels // The | in the following operations forces the alpha to 0xFF. This is // needed as windows sets the alpha to 0 when it renders. - SkDevice* device = skia::GetTopDevice(canvas); - const SkBitmap& bitmap = device->accessBitmap(false); - SkAutoLockPixels lock(bitmap); - - *c1 = 0xFF000000 | bitmap.getColor(x1, 0); - *c2 = 0xFF000000 | bitmap.getColor(x2, 0); + skia::BitmapPlatformDevice& device = + static_cast<skia::BitmapPlatformDevice&>( + canvas.getTopPlatformDevice()); + *c1 = 0xFF000000 | device.getColorAt(x1, 0); + *c2 = 0xFF000000 | device.getColorAt(x2, 0); } void GetDarkLineColor(SkColor* dark_color) { |