summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/printing/renderer/DEPS2
-rw-r--r--components/printing/renderer/print_web_view_helper.cc3
-rw-r--r--components/printing/renderer/print_web_view_helper_mac.mm4
-rw-r--r--content/plugin/webplugin_proxy.cc4
-rw-r--r--content/renderer/npapi/webplugin_delegate_proxy.cc4
-rw-r--r--content/renderer/pepper/pepper_plugin_instance_impl.cc2
-rw-r--r--content/renderer/pepper/ppb_image_data_impl.cc7
-rw-r--r--printing/pdf_metafile_skia.cc3
-rw-r--r--printing/pdf_metafile_skia.h8
-rw-r--r--skia/ext/platform_canvas.h8
-rw-r--r--skia/ext/platform_canvas_unittest.cc23
-rw-r--r--ui/gfx/blit_unittest.cc4
-rw-r--r--ui/gfx/canvas.h4
-rw-r--r--ui/gfx/canvas_paint_mac.mm2
-rw-r--r--ui/surface/transport_dib_posix.cc3
-rw-r--r--ui/surface/transport_dib_win.cc4
16 files changed, 45 insertions, 40 deletions
diff --git a/components/printing/renderer/DEPS b/components/printing/renderer/DEPS
index ada73c4..e0bb7ef 100644
--- a/components/printing/renderer/DEPS
+++ b/components/printing/renderer/DEPS
@@ -1,6 +1,6 @@
include_rules = [
"+grit/components_resources.h",
"+net/base",
- "+skia/ext",
+ "+third_party/skia",
"+ui/base",
]
diff --git a/components/printing/renderer/print_web_view_helper.cc b/components/printing/renderer/print_web_view_helper.cc
index dce40c4..6a8f1c3 100644
--- a/components/printing/renderer/print_web_view_helper.cc
+++ b/components/printing/renderer/print_web_view_helper.cc
@@ -49,6 +49,7 @@
#include "third_party/WebKit/public/web/WebSettings.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "third_party/WebKit/public/web/WebViewClient.h"
+#include "third_party/skia/include/core/SkCanvas.h"
#include "ui/base/resource/resource_bundle.h"
using content::WebPreferences;
@@ -1772,7 +1773,7 @@ void PrintWebViewHelper::PrintPageInternal(
float platform_scale_factor = css_scale_factor;
#endif // defined(OS_WIN)
- skia::PlatformCanvas* canvas = metafile->GetVectorCanvasForNewPage(
+ SkCanvas* canvas = metafile->GetVectorCanvasForNewPage(
page_size, canvas_area, platform_scale_factor);
if (!canvas)
return;
diff --git a/components/printing/renderer/print_web_view_helper_mac.mm b/components/printing/renderer/print_web_view_helper_mac.mm
index e94f21e..08a1c10 100644
--- a/components/printing/renderer/print_web_view_helper_mac.mm
+++ b/components/printing/renderer/print_web_view_helper_mac.mm
@@ -12,9 +12,9 @@
#include "components/printing/common/print_messages.h"
#include "printing/metafile_skia_wrapper.h"
#include "printing/page_size_margins.h"
-#include "skia/ext/platform_canvas.h"
#include "third_party/WebKit/public/platform/WebCanvas.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
+#include "third_party/skia/include/core/SkCanvas.h"
namespace printing {
@@ -138,7 +138,7 @@ void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params,
params.display_header_footer ? gfx::Rect(*page_size) : content_area;
{
- skia::PlatformCanvas* canvas = metafile->GetVectorCanvasForNewPage(
+ SkCanvas* canvas = metafile->GetVectorCanvasForNewPage(
*page_size, canvas_area, scale_factor);
if (!canvas)
return;
diff --git a/content/plugin/webplugin_proxy.cc b/content/plugin/webplugin_proxy.cc
index f9ce4a3..c03b4fd 100644
--- a/content/plugin/webplugin_proxy.cc
+++ b/content/plugin/webplugin_proxy.cc
@@ -305,7 +305,7 @@ void WebPluginProxy::Paint(const gfx::Rect& rect) {
#else
// See above comment about windowless_context_ changing.
// http::/crbug.com/139462
- skia::RefPtr<skia::PlatformCanvas> saved_canvas = windowless_canvas();
+ skia::RefPtr<SkCanvas> saved_canvas = windowless_canvas();
saved_canvas->save();
@@ -376,7 +376,7 @@ void WebPluginProxy::UpdateGeometry(
void WebPluginProxy::CreateCanvasFromHandle(
const TransportDIB::Handle& dib_handle,
const gfx::Rect& window_rect,
- skia::RefPtr<skia::PlatformCanvas>* canvas) {
+ skia::RefPtr<SkCanvas>* canvas) {
*canvas = skia::AdoptRef(skia::CreatePlatformCanvas(
window_rect.width(), window_rect.height(), true, dib_handle.GetHandle(),
skia::RETURN_NULL_ON_FAILURE));
diff --git a/content/renderer/npapi/webplugin_delegate_proxy.cc b/content/renderer/npapi/webplugin_delegate_proxy.cc
index a14a7a9..b8ac39c 100644
--- a/content/renderer/npapi/webplugin_delegate_proxy.cc
+++ b/content/renderer/npapi/webplugin_delegate_proxy.cc
@@ -555,7 +555,7 @@ static size_t BitmapSizeForPluginRect(const gfx::Rect& plugin_rect) {
bool WebPluginDelegateProxy::CreateLocalBitmap(
std::vector<uint8_t>* memory,
- scoped_ptr<skia::PlatformCanvas>* canvas) {
+ scoped_ptr<SkCanvas>* canvas) {
const size_t size = BitmapSizeForPluginRect(plugin_rect_);
memory->resize(size);
if (memory->size() != size)
@@ -569,7 +569,7 @@ bool WebPluginDelegateProxy::CreateLocalBitmap(
bool WebPluginDelegateProxy::CreateSharedBitmap(
scoped_ptr<SharedMemoryBitmap>* memory,
- scoped_ptr<skia::PlatformCanvas>* canvas) {
+ scoped_ptr<SkCanvas>* canvas) {
*memory = ChildThreadImpl::current()
->shared_bitmap_manager()
->AllocateSharedMemoryBitmap(plugin_rect_.size());
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc
index 5d5679b..c9beb71 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc
@@ -3004,7 +3004,7 @@ PP_Resource PepperPluginInstanceImpl::CreateImage(gfx::ImageSkia* source_image,
if (!mapper.is_valid())
return 0;
- skia::PlatformCanvas* canvas = image_data->GetPlatformCanvas();
+ SkCanvas* canvas = image_data->GetPlatformCanvas();
// Note: Do not SkBitmap::copyTo the canvas bitmap directly because it will
// ignore the allocated pixels in shared memory and re-allocate a new buffer.
canvas->writePixels(image_skia_rep.sk_bitmap(), 0, 0);
diff --git a/content/renderer/pepper/ppb_image_data_impl.cc b/content/renderer/pepper/ppb_image_data_impl.cc
index 56cc373..cf446a1 100644
--- a/content/renderer/pepper/ppb_image_data_impl.cc
+++ b/content/renderer/pepper/ppb_image_data_impl.cc
@@ -18,6 +18,7 @@
#include "ppapi/c/ppb_image_data.h"
#include "ppapi/thunk/thunk.h"
#include "skia/ext/platform_canvas.h"
+#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColorPriv.h"
#include "third_party/skia/include/core/SkDevice.h"
#include "third_party/skia/include/core/SkPixmap.h"
@@ -112,7 +113,7 @@ int32_t PPB_ImageData_Impl::GetSharedMemory(base::SharedMemory** shm,
return backend_->GetSharedMemory(shm, byte_count);
}
-skia::PlatformCanvas* PPB_ImageData_Impl::GetPlatformCanvas() {
+SkCanvas* PPB_ImageData_Impl::GetPlatformCanvas() {
return backend_->GetPlatformCanvas();
}
@@ -197,7 +198,7 @@ int32_t ImageDataPlatformBackend::GetSharedMemory(base::SharedMemory** shm,
return PP_OK;
}
-skia::PlatformCanvas* ImageDataPlatformBackend::GetPlatformCanvas() {
+SkCanvas* ImageDataPlatformBackend::GetPlatformCanvas() {
return mapped_canvas_.get();
}
@@ -258,7 +259,7 @@ int32_t ImageDataSimpleBackend::GetSharedMemory(base::SharedMemory** shm,
return PP_OK;
}
-skia::PlatformCanvas* ImageDataSimpleBackend::GetPlatformCanvas() {
+SkCanvas* ImageDataSimpleBackend::GetPlatformCanvas() {
return NULL;
}
diff --git a/printing/pdf_metafile_skia.cc b/printing/pdf_metafile_skia.cc
index 04a8c40f..1a60b5b 100644
--- a/printing/pdf_metafile_skia.cc
+++ b/printing/pdf_metafile_skia.cc
@@ -15,6 +15,7 @@
#include "base/time/time.h"
#include "printing/print_settings.h"
#include "skia/ext/refptr.h"
+#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkData.h"
#include "third_party/skia/include/core/SkDocument.h"
#include "third_party/skia/include/core/SkPictureRecorder.h"
@@ -114,7 +115,7 @@ bool PdfMetafileSkia::StartPage(const gfx::Size& page_size,
NULL, 0);
}
-skia::PlatformCanvas* PdfMetafileSkia::GetVectorCanvasForNewPage(
+SkCanvas* PdfMetafileSkia::GetVectorCanvasForNewPage(
const gfx::Size& page_size,
const gfx::Rect& content_area,
const float& scale_factor) {
diff --git a/printing/pdf_metafile_skia.h b/printing/pdf_metafile_skia.h
index cd92d618..aa5acd7 100644
--- a/printing/pdf_metafile_skia.h
+++ b/printing/pdf_metafile_skia.h
@@ -75,13 +75,13 @@ class PRINTING_EXPORT PdfMetafileSkia : public Metafile {
// This method calls StartPage and then returns an appropriate
// PlatformCanvas implementation bound to the context created by
- // StartPage or NULL on error. The skia::PlatformCanvas pointer that
+ // StartPage or NULL on error. The SkCanvas pointer that
// is returned is owned by this PdfMetafileSkia object and does not
// need to be ref()ed or unref()ed. The canvas will remain valid
// until FinishPage() or FinishDocument() is called.
- skia::PlatformCanvas* GetVectorCanvasForNewPage(const gfx::Size& page_size,
- const gfx::Rect& content_area,
- const float& scale_factor);
+ SkCanvas* GetVectorCanvasForNewPage(const gfx::Size& page_size,
+ const gfx::Rect& content_area,
+ const float& scale_factor);
private:
scoped_ptr<PdfMetafileSkiaData> data_;
diff --git a/skia/ext/platform_canvas.h b/skia/ext/platform_canvas.h
index 89b8c32..5b8849b 100644
--- a/skia/ext/platform_canvas.h
+++ b/skia/ext/platform_canvas.h
@@ -20,9 +20,11 @@
class SkBaseDevice;
-namespace skia {
+// A PlatformCanvas is a software-rasterized SkCanvas which is *also*
+// addressable by the platform-specific drawing API (GDI, Core Graphics,
+// Cairo...).
-typedef SkCanvas PlatformCanvas;
+namespace skia {
//
// Note about error handling.
@@ -51,7 +53,7 @@ enum OnFailureType {
OnFailureType failure_type);
// Draws the top layer of the canvas into the specified HDC. Only works
- // with a PlatformCanvas with a BitmapPlatformDevice.
+ // with a SkCanvas with a BitmapPlatformDevice.
SK_API void DrawToNativeContext(SkCanvas* canvas,
HDC hdc,
int x,
diff --git a/skia/ext/platform_canvas_unittest.cc b/skia/ext/platform_canvas_unittest.cc
index 57b37f8..e0f8981 100644
--- a/skia/ext/platform_canvas_unittest.cc
+++ b/skia/ext/platform_canvas_unittest.cc
@@ -14,6 +14,7 @@
#include "skia/ext/platform_device.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkColorPriv.h"
#include "third_party/skia/include/core/SkPixelRef.h"
@@ -41,10 +42,10 @@ bool IsOfColor(const SkBitmap& bitmap, int x, int y, uint32_t color) {
// rectangle filled to rect_color. This function ignores the alpha channel,
// since Windows will sometimes clear the alpha channel when drawing, and we
// will fix that up later in cases it's necessary.
-bool VerifyRect(const PlatformCanvas& canvas,
+bool VerifyRect(const SkCanvas& canvas,
uint32_t canvas_color, uint32_t rect_color,
int x, int y, int w, int h) {
- const SkBitmap bitmap = skia::ReadPixels(const_cast<PlatformCanvas*>(&canvas));
+ const SkBitmap bitmap = skia::ReadPixels(const_cast<SkCanvas*>(&canvas));
SkAutoLockPixels lock(bitmap);
for (int cur_y = 0; cur_y < bitmap.height(); cur_y++) {
@@ -68,7 +69,7 @@ bool VerifyRect(const PlatformCanvas& canvas,
// Return true if canvas has something that passes for a rounded-corner
// rectangle. Basically, we're just checking to make sure that the pixels in the
// middle are of rect_color and pixels in the corners are of canvas_color.
-bool VerifyRoundedRect(const PlatformCanvas& canvas,
+bool VerifyRoundedRect(const SkCanvas& canvas,
uint32_t canvas_color,
uint32_t rect_color,
int x,
@@ -97,19 +98,19 @@ bool VerifyRoundedRect(const PlatformCanvas& canvas,
// Checks whether there is a white canvas with a black square at the given
// location in pixels (not in the canvas coordinate system).
-bool VerifyBlackRect(const PlatformCanvas& canvas, int x, int y, int w, int h) {
+bool VerifyBlackRect(const SkCanvas& canvas, int x, int y, int w, int h) {
return VerifyRect(canvas, SK_ColorWHITE, SK_ColorBLACK, x, y, w, h);
}
#if !defined(USE_AURA) // http://crbug.com/154358
// Check that every pixel in the canvas is a single color.
-bool VerifyCanvasColor(const PlatformCanvas& canvas, uint32_t canvas_color) {
+bool VerifyCanvasColor(const SkCanvas& canvas, uint32_t canvas_color) {
return VerifyRect(canvas, canvas_color, 0, 0, 0, 0, 0);
}
#endif // !defined(USE_AURA)
#if defined(OS_WIN)
-void DrawNativeRect(PlatformCanvas& canvas, int x, int y, int w, int h) {
+void DrawNativeRect(SkCanvas& canvas, int x, int y, int w, int h) {
skia::ScopedPlatformPaint scoped_platform_paint(&canvas);
HDC dc = scoped_platform_paint.GetPlatformSurface();
@@ -121,7 +122,7 @@ void DrawNativeRect(PlatformCanvas& canvas, int x, int y, int w, int h) {
FillRect(dc, &inner_rc, reinterpret_cast<HBRUSH>(GetStockObject(BLACK_BRUSH)));
}
#elif defined(OS_MACOSX)
-void DrawNativeRect(PlatformCanvas& canvas, int x, int y, int w, int h) {
+void DrawNativeRect(SkCanvas& canvas, int x, int y, int w, int h) {
skia::ScopedPlatformPaint scoped_platform_paint(&canvas);
CGContextRef context = scoped_platform_paint.GetPlatformSurface();
@@ -133,14 +134,14 @@ void DrawNativeRect(PlatformCanvas& canvas, int x, int y, int w, int h) {
CGContextFillRect(context, inner_rc);
}
#else
-void DrawNativeRect(PlatformCanvas& canvas, int x, int y, int w, int h) {
+void DrawNativeRect(SkCanvas& canvas, int x, int y, int w, int h) {
NOTIMPLEMENTED();
}
#endif
// Clips the contents of the canvas to the given rectangle. This will be
// intersected with any existing clip.
-void AddClip(PlatformCanvas& canvas, int x, int y, int w, int h) {
+void AddClip(SkCanvas& canvas, int x, int y, int w, int h) {
SkRect rect;
rect.set(SkIntToScalar(x), SkIntToScalar(y),
SkIntToScalar(x + w), SkIntToScalar(y + h));
@@ -149,7 +150,7 @@ void AddClip(PlatformCanvas& canvas, int x, int y, int w, int h) {
class LayerSaver {
public:
- LayerSaver(PlatformCanvas& canvas, int x, int y, int w, int h)
+ LayerSaver(SkCanvas& canvas, int x, int y, int w, int h)
: canvas_(canvas),
x_(x),
y_(y),
@@ -176,7 +177,7 @@ class LayerSaver {
int bottom() const { return y_ + h_; }
private:
- PlatformCanvas& canvas_;
+ SkCanvas& canvas_;
int x_, y_, w_, h_;
};
diff --git a/ui/gfx/blit_unittest.cc b/ui/gfx/blit_unittest.cc
index e624591..12c6c40 100644
--- a/ui/gfx/blit_unittest.cc
+++ b/ui/gfx/blit_unittest.cc
@@ -21,7 +21,7 @@ namespace {
// 0x00000000 0x01010101
// 0x12121212 0xFFFFFFFF
template <int w, int h>
-void SetToCanvas(skia::PlatformCanvas* canvas, uint8_t values[h][w]) {
+void SetToCanvas(SkCanvas* canvas, uint8_t values[h][w]) {
ASSERT_EQ(w, canvas->imageInfo().width());
ASSERT_EQ(h, canvas->imageInfo().height());
@@ -44,7 +44,7 @@ void SetToCanvas(skia::PlatformCanvas* canvas, uint8_t values[h][w]) {
// values, where each value has been duplicated into each channel of the given
// bitmap (see SetToCanvas above).
template <int w, int h>
-void VerifyCanvasValues(skia::PlatformCanvas* canvas, uint8_t values[h][w]) {
+void VerifyCanvasValues(SkCanvas* canvas, uint8_t values[h][w]) {
SkBitmap bitmap = skia::ReadPixels(canvas);
SkAutoLockPixels lock(bitmap);
ASSERT_EQ(w, bitmap.width());
diff --git a/ui/gfx/canvas.h b/ui/gfx/canvas.h
index 311cf38..dd30d54 100644
--- a/ui/gfx/canvas.h
+++ b/ui/gfx/canvas.h
@@ -409,7 +409,7 @@ class GFX_EXPORT Canvas {
const Rect& display_rect,
int flags);
- skia::PlatformCanvas* platform_canvas() { return owned_canvas_.get(); }
+ SkCanvas* platform_canvas() { return owned_canvas_.get(); }
SkCanvas* sk_canvas() { return canvas_; }
float image_scale() const { return image_scale_; }
@@ -439,7 +439,7 @@ class GFX_EXPORT Canvas {
// Canvas::Scale() does not affect |image_scale_|.
float image_scale_;
- skia::RefPtr<skia::PlatformCanvas> owned_canvas_;
+ skia::RefPtr<SkCanvas> owned_canvas_;
SkCanvas* canvas_;
DISALLOW_COPY_AND_ASSIGN(Canvas);
diff --git a/ui/gfx/canvas_paint_mac.mm b/ui/gfx/canvas_paint_mac.mm
index cc1c6a4..cc926d2 100644
--- a/ui/gfx/canvas_paint_mac.mm
+++ b/ui/gfx/canvas_paint_mac.mm
@@ -60,7 +60,7 @@ void CanvasSkiaPaint::Init(bool opaque) {
gfx::Size size(NSWidth(rectangle_), NSHeight(rectangle_));
RecreateBackingCanvas(size, scale, opaque);
- skia::PlatformCanvas* canvas = platform_canvas();
+ SkCanvas* canvas = sk_canvas();
canvas->clear(SkColorSetARGB(0, 0, 0, 0));
// Need to translate so that the dirty region appears at the origin of the
diff --git a/ui/surface/transport_dib_posix.cc b/ui/surface/transport_dib_posix.cc
index be1a373..aada735 100644
--- a/ui/surface/transport_dib_posix.cc
+++ b/ui/surface/transport_dib_posix.cc
@@ -57,8 +57,7 @@ bool TransportDIB::is_valid_handle(Handle dib) {
return base::SharedMemory::IsHandleValid(dib);
}
-skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h,
- bool opaque) {
+SkCanvas* TransportDIB::GetPlatformCanvas(int w, int h, bool opaque) {
if ((!memory() && !Map()) || !VerifyCanvasSize(w, h))
return NULL;
return skia::CreatePlatformCanvas(w, h, opaque,
diff --git a/ui/surface/transport_dib_win.cc b/ui/surface/transport_dib_win.cc
index 82eabf8..f002f55 100644
--- a/ui/surface/transport_dib_win.cc
+++ b/ui/surface/transport_dib_win.cc
@@ -58,7 +58,7 @@ bool TransportDIB::is_valid_handle(Handle dib) {
return dib.IsValid();
}
-skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h,
+SkCanvas* TransportDIB::GetPlatformCanvas(int w, int h,
bool opaque) {
// This DIB already mapped the file into this process, but PlatformCanvas
// will map it again.
@@ -67,7 +67,7 @@ skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h,
// We can't check the canvas size before mapping, but it's safe because
// Windows will fail to map the section if the dimensions of the canvas
// are too large.
- skia::PlatformCanvas* canvas = skia::CreatePlatformCanvas(
+ SkCanvas* canvas = skia::CreatePlatformCanvas(
w, h, opaque, shared_memory_.handle().GetHandle(),
skia::RETURN_NULL_ON_FAILURE);