support direct writing to top layer, and hide getTopLayer()

this should remove many of the chrome callers that today call
accessBitmap on the toplayer, so they can read/write those pixels.

The ultimate fix will be to support custom allocation of raster layers
(via GDI/cairo/mac) so we can remove PlatformDevice subclassing in
skia/ext

BUG=skia:
R=bsalomon@google.com, scroggo@google.com

Review URL: https://codereview.chromium.org/197433002

git-svn-id: http://skia.googlecode.com/svn/trunk@13774 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 9fbb37b..4086291 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1040,6 +1040,15 @@
     return dev ? dev->peekPixels(info, rowBytes) : NULL;
 }
 
+void* SkCanvas::accessTopLayerPixels(SkImageInfo* info, size_t* rowBytes) {
+    return this->onAccessTopLayerPixels(info, rowBytes);
+}
+
+void* SkCanvas::onAccessTopLayerPixels(SkImageInfo* info, size_t* rowBytes) {
+    SkBaseDevice* dev = this->getTopDevice();
+    return dev ? dev->accessPixels(info, rowBytes) : NULL;
+}
+
 SkAutoROCanvasPixels::SkAutoROCanvasPixels(SkCanvas* canvas) {
     fAddr = canvas->peekPixels(&fInfo, &fRowBytes);
     if (NULL == fAddr) {
@@ -1713,6 +1722,11 @@
     (void)rgn.getBoundaryPath(path);
 }
 
+GrRenderTarget* SkCanvas::internal_private_accessTopLayerRenderTarget() {
+    SkBaseDevice* dev = this->getTopDevice();
+    return dev ? dev->accessRenderTarget() : NULL;
+}
+
 SkBaseDevice* SkCanvas::createLayerDevice(const SkImageInfo& info) {
     SkBaseDevice* device = this->getTopDevice();
     return device ? device->createCompatibleDeviceForSaveLayer(info) : NULL;