diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/aeropeek_manager.cc | 2 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_tabs_module.cc | 2 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_widget_host_view_win.cc | 32 | ||||
-rw-r--r-- | chrome/browser/tab_contents/thumbnail_generator.cc | 3 | ||||
-rw-r--r-- | chrome/browser/tab_contents/thumbnail_generator_unittest.cc | 16 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc | 3 | ||||
-rw-r--r-- | chrome/browser/ui/views/omnibox/omnibox_view_win.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/views/tabs/dragged_tab_view.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/views/tabs/native_view_photobooth_win.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/views/theme_helpers.cc | 16 | ||||
-rw-r--r-- | chrome/renderer/chrome_render_view_observer.cc | 13 | ||||
-rw-r--r-- | chrome/renderer/print_web_view_helper_linux.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/print_web_view_helper_win.cc | 6 | ||||
-rw-r--r-- | chrome/renderer/safe_browsing/phishing_thumbnailer.cc | 6 |
14 files changed, 57 insertions, 54 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) { diff --git a/chrome/renderer/chrome_render_view_observer.cc b/chrome/renderer/chrome_render_view_observer.cc index 9c19c19..113dc62 100644 --- a/chrome/renderer/chrome_render_view_observer.cc +++ b/chrome/renderer/chrome_render_view_observer.cc @@ -26,6 +26,7 @@ #include "content/renderer/content_renderer_client.h" #include "googleurl/src/gurl.h" #include "net/base/data_url.h" +#include "skia/ext/bitmap_platform_device.h" #include "skia/ext/image_operations.h" #include "skia/ext/platform_canvas.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" @@ -594,9 +595,10 @@ bool ChromeRenderViewObserver::CaptureFrameThumbnail(WebView* view, if (!PaintViewIntoCanvas(view, canvas)) return false; - SkDevice* device = skia::GetTopDevice(canvas); + skia::BitmapPlatformDevice& device = + static_cast<skia::BitmapPlatformDevice&>(canvas.getTopPlatformDevice()); - const SkBitmap& src_bmp = device->accessBitmap(false); + const SkBitmap& src_bmp = device.accessBitmap(false); SkRect dest_rect = { 0, 0, SkIntToScalar(w), SkIntToScalar(h) }; float dest_aspect = dest_rect.width() / dest_rect.height(); @@ -631,7 +633,7 @@ bool ChromeRenderViewObserver::CaptureFrameThumbnail(WebView* view, score->at_top = (view->mainFrame()->scrollOffset().height == 0); SkBitmap subset; - device->accessBitmap(false).extractSubset(&subset, src_rect); + device.accessBitmap(false).extractSubset(&subset, src_rect); // First do a fast downsample by powers of two to get close to the final size. SkBitmap downsampled_subset = @@ -657,9 +659,10 @@ bool ChromeRenderViewObserver::CaptureSnapshot(WebView* view, if (!PaintViewIntoCanvas(view, canvas)) return false; - SkDevice* device = skia::GetTopDevice(canvas); + skia::BitmapPlatformDevice& device = + static_cast<skia::BitmapPlatformDevice&>(canvas.getTopPlatformDevice()); - const SkBitmap& bitmap = device->accessBitmap(false); + const SkBitmap& bitmap = device.accessBitmap(false); if (!bitmap.copyTo(snapshot, SkBitmap::kARGB_8888_Config)) return false; diff --git a/chrome/renderer/print_web_view_helper_linux.cc b/chrome/renderer/print_web_view_helper_linux.cc index a5eabfd..c5e8e5a 100644 --- a/chrome/renderer/print_web_view_helper_linux.cc +++ b/chrome/renderer/print_web_view_helper_linux.cc @@ -220,7 +220,7 @@ void PrintWebViewHelper::PrintPageInternal( gfx::Rect content_area(margin_left_in_points, margin_top_in_points, content_width_in_points, content_height_in_points); - SkDevice* device = metafile->StartPageForVectorCanvas( + skia::PlatformDevice* device = metafile->StartPageForVectorCanvas( page_size, content_area, 1.0f); if (!device) return; diff --git a/chrome/renderer/print_web_view_helper_win.cc b/chrome/renderer/print_web_view_helper_win.cc index 5b502c4..4151818 100644 --- a/chrome/renderer/print_web_view_helper_win.cc +++ b/chrome/renderer/print_web_view_helper_win.cc @@ -81,7 +81,7 @@ void PrintWebViewHelper::PrintPageInternal( scoped_ptr<Metafile> metafile(new printing::NativeMetafile); metafile->Init(); DCHECK(metafile->context()); - skia::InitializeDC(metafile->context()); + skia::PlatformDevice::InitializeDC(metafile->context()); int page_number = params.page_number; @@ -228,7 +228,7 @@ void PrintWebViewHelper::RenderPage( static_cast<int>(margin_top_in_points), static_cast<int>(content_width_in_points), static_cast<int>(content_height_in_points)); - SkDevice* device = (*metafile)->StartPageForVectorCanvas( + skia::PlatformDevice* device = (*metafile)->StartPageForVectorCanvas( page_size, content_area, frame->getPrintPageShrink(page_number)); DCHECK(device); // The printPage method may take a reference to the canvas we pass down, so it @@ -290,7 +290,7 @@ void PrintWebViewHelper::RenderPage( metafile2->Init(); HDC hdc = metafile2->context(); DCHECK(hdc); - skia::InitializeDC(hdc); + skia::PlatformDevice::InitializeDC(hdc); RECT metafile_bounds = (*metafile)->GetPageBounds(1).ToRECT(); // Process the old metafile, placing all non-AlphaBlend calls into the diff --git a/chrome/renderer/safe_browsing/phishing_thumbnailer.cc b/chrome/renderer/safe_browsing/phishing_thumbnailer.cc index e8a3b4f..3235ea3 100644 --- a/chrome/renderer/safe_browsing/phishing_thumbnailer.cc +++ b/chrome/renderer/safe_browsing/phishing_thumbnailer.cc @@ -8,6 +8,7 @@ #include "base/metrics/histogram.h" #include "base/time.h" #include "content/renderer/render_view.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" @@ -52,11 +53,12 @@ SkBitmap GrabPhishingThumbnail(RenderView* render_view, view->paint(webkit_glue::ToWebCanvas(&canvas), WebRect(0, 0, view_size.width(), view_size.height())); - SkDevice* device = skia::GetTopDevice(canvas); + skia::BitmapPlatformDevice& device = + static_cast<skia::BitmapPlatformDevice&>(canvas.getTopPlatformDevice()); // Now resize the thumbnail to the right size. Note: it is important that we // use this resize algorithm here. - const SkBitmap& bitmap = device->accessBitmap(false); + const SkBitmap& bitmap = device.accessBitmap(false); SkBitmap thumbnail = skia::ImageOperations::Resize( bitmap, skia::ImageOperations::RESIZE_LANCZOS3, |